www in docker support

This commit is contained in:
MaddoScientisto 2026-04-22 18:41:37 +02:00
commit c227fce036
2145 changed files with 399596 additions and 58 deletions

View file

@ -0,0 +1,6 @@
Manifest-Version: 1.0
Created-By: Maven Jar Plugin 3.2.0
Build-Jdk-Spec: 17
Implementation-Title: Acxent Core Library
Implementation-Version: 1.0.1

View file

@ -0,0 +1,3 @@
artifactId=acxent-core
groupId=it.acxent
version=1.0.1

View file

@ -0,0 +1,362 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.acxent</groupId>
<artifactId>acxent-core</artifactId>
<version>1.0.1</version>
<name>Acxent Core Library</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.7.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>11</version>
</jdk>
</toolchains>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<id>OneBusWay</id>
<name>OneBusWay</name>
<url>http://nexus.onebusaway.org/nexus/content/repositories/public/</url>
<layout>default</layout>
</repository>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<id>github-repo</id>
<url>https://maven.pkg.github.com/acolzi/repo</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<layout>default</layout>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>github-repo</id>
<name>GitHub acolzi Apache Maven Packages</name>
<url>https://maven.pkg.github.com/acolzi/repo</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-excelant</artifactId>
<version>5.2.3</version>
<type>pom.sha512</type>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20230618</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.29</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.23.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-exec</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.16.1</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.9.0</version>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-junit</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
</dependency>
<dependency>
<groupId>jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>debugger-app</artifactId>
<version>2.0.29</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox-tools</artifactId>
<version>2.0.29</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.3</version> <!-- Versione compatibile con Servlet 4.0.1 -->
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.sanselan</groupId>
<artifactId>sanselan</artifactId>
<version>0.97-incubator</version>
</dependency>
<dependency>
<groupId>com.drewnoakes</groupId>
<artifactId>metadata-extractor</artifactId>
<version>2.18.0</version>
</dependency>
<dependency>
<groupId>javax.media</groupId>
<artifactId>jai_core</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>javax.media</groupId>
<artifactId>jai_codec</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.2-jre</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>9.5.0</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
<exclusions>
<exclusion>
<groupId>bouncycastle</groupId>
<artifactId>bcprov-jdk14</artifactId>
</exclusion>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk14</artifactId>
</exclusion>
<exclusion>
<groupId>bouncycastle</groupId>
<artifactId>bcmail-jdk14</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.xhtmlrenderer</groupId>
<artifactId>flying-saucer-pdf</artifactId>
<version>9.1.22</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk14</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.79</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.20.0</version>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-core</artifactId>
<version>11.5.3</version>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-openxml-objects</artifactId>
<version>11.5.3</version>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-openxml-objects-pml</artifactId>
<version>11.5.3</version>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-openxml-objects-sml</artifactId>
<version>11.5.3</version>
</dependency>
<!--
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j</artifactId>
<version>6.1.2</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
-->
<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-oauth2-http</artifactId>
<version>1.25.0</version>
</dependency>
<dependency>
<groupId>jakarta.websocket</groupId>
<artifactId>jakarta.websocket-api</artifactId>
<version>1.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.10.2</version>
</dependency>
<dependency>
<groupId>com.github.victools</groupId>
<artifactId>jsonschema-generator</artifactId>
<version>4.38.0</version>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>8.0.1.Final</version>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.19</version>
</dependency>
<!-- Dipendenza transitiva necessaria -->
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>jakarta.el</artifactId>
<version>4.0.2</version>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,27 @@
#####################################################
#### D E B U G #####################################
#####################################################
#debug=true e debugLevel=0 vede solo i fatal e manda le mail
#debug=false e debugLevel=0 vede solo i fatal ma non manda le mail
#livelli di debug:
# 0 1 2 3 4 5
# "FATAL! ", "INFO_1! ", "ERROR! ", "WARNING! ", "INFO! ", "DEBUG! "
USE_PARM_HT=true
DEBUG=true
LOG_FILE=/var/log/tomcat_f3.log
DEBUG_LEVEL=0
#####################################################
######PROPRIETA' UTILIZZATE DALLE SERVLET############
#####################################################
locale=IT
dataFormat=dd/MM/yyyy
maximumFractionDigits=2
minimumFractionDigits=2
#### PRAMETRI STANDARD PER EMAIL ###
#SMTP=localhost
#FROM=test@f3.com
#xTO=staff@f3.com
#xBCC=acolzi@f3.com
#xCC=staff@f3.com

View file

@ -0,0 +1,4 @@
SOURCE_DIR=/Users/acolzi/Documents/_f3/work/F3ct/DBComuni/wwwES3.1/www/
TARGET_DIR_1=/Users/acolzi/Documents/_f3/work/Coave/www/
TARGET_DIR_2=/Users/acolzi/Documents/_f3/work/miser/www2/
TARGET_DIR_3=/Users/acolzi/Documents/_f3/work/GAIAS/www/

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View file

@ -0,0 +1 @@
package com.f3.db;

View file

@ -0,0 +1 @@
acxent-core 4log

View file

@ -0,0 +1,69 @@
CREATE TABLE [LOG_MAIL] (
[id_logMail] INTEGER IDENTITY(0,1) NOT NULL,
[id_users] INTEGER,
[tsInvio] DATETIME,
[oggetto] VARCHAR(254),
[lmTo] VARCHAR(254),
[lmCc] VARCHAR(254),
[lmBcc] VARCHAR(254),
[testoMessaggio] TEXT,
[result] VARCHAR(1000),
[lastUpdId_user] INTEGER,
[lastUpdTmst] DATETIME,
[createTmst] DATETIME,
[encodedFields] varchar(1000),
CONSTRAINT [PK_LOG_MAIL] PRIMARY KEY ([id_logMail])
)
#
CREATE TABLE [LOG_MAIL_ATTACH] (
[id_logMailAttach] INTEGER IDENTITY(0,1) NOT NULL,
[nomeFile] VARCHAR(254),
[id_logMail] INTEGER,
[lastUpdId_user] INTEGER,
[lastUpdTmst] DATETIME,
[createTmst] DATETIME,
[encodedFields] varchar(1000),
CONSTRAINT [PK_LOG_MAIL_ATTACH] PRIMARY KEY ([id_logMailAttach])
)
#
CREATE TABLE [LOG] (
[id_log] INTEGER IDENTITY(0,1) NOT NULL,
[id_users] INTEGER,
[id_blacklist] INTEGER,
[dataLog] DATETIME,
[descrizione] TEXT,
[ipAddress] CHAR(60),
[flgMovimento] INTEGER,
[tabella] VARCHAR(60),
[oraLog] DATETIME,
[pk] VARCHAR(40),
[pkValue] VARCHAR(40),
[lastUpdId_user] INTEGER,
[lastUpdTmst] DATETIME,
[createTmst] DATETIME,
[encodedFields] varchar(1000),
CONSTRAINT [PK_LOG] PRIMARY KEY ([id_log])
)
CREATE INDEX [IDX_LOG_1] ON [LOG] ([pk])
CREATE INDEX [IDX_LOG_2] ON [LOG] ([dataLog])
CREATE INDEX [IDX_LOG_5] ON [LOG] ([pkValue])
CREATE INDEX [IDX_LOG_6] ON [LOG] ([id_users])
CREATE INDEX [IDX_LOG_8] ON [LOG] ([lastUpdTmst])
##da verificare
CREATE INDEX [IDX_LOG_TAB_MOV_BL[] ON [LOG] ([tabella], [flgMovimento], [id_blacklist]);
CREATE INDEX IDX_LOG_PURGE ON log (dataLog, id_log);
#ALTER TABLE [LOG_MAIL_ATTACH] ADD CONSTRAINT [LOG_MAIL_LOG_MAIL_ATTACH]
FOREIGN KEY ([id_logMail]) REFERENCES [LOG_MAIL] ([id_logMail])

View file

@ -0,0 +1,59 @@
CREATE TABLE IF NOT EXISTS `LOG_MAIL` (
`id_logMail` INTEGER NOT NULL AUTO_INCREMENT,
`id_users` INTEGER,
`oggetto` VARCHAR(254),
`tsInvio` DATETIME,
`lmTo` VARCHAR(254),
`lmCc` VARCHAR(254),
`lmBcc` VARCHAR(254),
`testoMessaggio` TEXT,
`result` VARCHAR(1000),
`lastUpdTmst` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`lastUpdId_user` int(11) DEFAULT NULL,
`createTmst` datetime DEFAULT NULL,
`encodedFields` varchar(1000) DEFAULT NULL,
CONSTRAINT `PK_LOG_MAIL` PRIMARY KEY (`id_logMail`)
);
#
CREATE TABLE IF NOT EXISTS `LOG_MAIL_ATTACH` (
`id_logMailAttach` INTEGER NOT NULL AUTO_INCREMENT,
`nomeFile` VARCHAR(254),
`id_logMail` INTEGER,
`lastUpdTmst` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`lastUpdId_user` int(11) DEFAULT NULL,
`createTmst` datetime DEFAULT NULL,
`encodedFields` varchar(1000) DEFAULT NULL,
CONSTRAINT `PK_LOG_MAIL_ATTACH` PRIMARY KEY (`id_logMailAttach`),
CONSTRAINT `LOG_MAIL_LOG_MAIL_ATTACH`
FOREIGN KEY (`id_logMail`) REFERENCES `LOG_MAIL` (`id_logMail`)
);
#
CREATE TABLE `LOG` (
`id_log` INTEGER NOT NULL AUTO_INCREMENT,
`id_users` INTEGER,
`id_blacklist` INTEGER,
`dataLog` DATE,
`descrizione` TEXT,
`ipAddress` CHAR(60),
`flgMovimento` INTEGER,
`tabella` VARCHAR(60),
`oraLog` TIME,
`pk` VARCHAR(40),
`pkValue` VARCHAR(40),
`lastUpdTmst` TIMESTAMP,
CONSTRAINT `PK_LOG` PRIMARY KEY (`id_log`)
);
CREATE INDEX `IDX_LOG_pk` ON `LOG` (`pk`);
CREATE INDEX `IDX_LOG_datalog` ON `LOG` (`dataLog`);
CREATE INDEX `IDX_LOG_pkValue` ON `LOG` (`pkValue`);
CREATE INDEX `IDX_LOG_id_users` ON `LOG` (`id_users`);
CREATE INDEX `IDX_LOG_lastupttmst` ON `LOG` (`lastUpdTmst` DESC);
CREATE INDEX `IDX_LOG_TAB_MOV_BL` ON `LOG` (`tabella`,`flgMovimento`,`id_blacklist`);
CREATE INDEX `IDX_LOG_PURGE` ON `LOG` (`dataLog`,`id_log`);

View file

@ -0,0 +1,59 @@
CREATE TABLE IF NOT EXISTS `LOG_MAIL` (
`id_logMail` INTEGER NOT NULL AUTO_INCREMENT,
`id_users` INTEGER,
`oggetto` VARCHAR(254),
`tsInvio` DATETIME,
`lmTo` VARCHAR(254),
`lmCc` VARCHAR(254),
`lmBcc` VARCHAR(254),
`testoMessaggio` TEXT,
`result` VARCHAR(1000),
`lastUpdTmst` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`lastUpdId_user` int(11) DEFAULT NULL,
`createTmst` datetime DEFAULT NULL,
`encodedFields` varchar(1000) DEFAULT NULL,
CONSTRAINT `PK_LOG_MAIL` PRIMARY KEY (`id_logMail`)
);
#
CREATE TABLE IF NOT EXISTS `LOG_MAIL_ATTACH` (
`id_logMailAttach` INTEGER NOT NULL AUTO_INCREMENT,
`nomeFile` VARCHAR(254),
`id_logMail` INTEGER,
`lastUpdTmst` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`lastUpdId_user` int(11) DEFAULT NULL,
`createTmst` datetime DEFAULT NULL,
`encodedFields` varchar(1000) DEFAULT NULL,
CONSTRAINT `PK_LOG_MAIL_ATTACH` PRIMARY KEY (`id_logMailAttach`),
CONSTRAINT `LOG_MAIL_LOG_MAIL_ATTACH`
FOREIGN KEY (`id_logMail`) REFERENCES `LOG_MAIL` (`id_logMail`)
);
#
CREATE TABLE IF NOT EXISTS `LOG` (
`id_log` INTEGER NOT NULL AUTO_INCREMENT,
`id_users` INTEGER,
`id_blacklist` INTEGER,
`dataLog` DATE,
`descrizione` TEXT,
`ipAddress` CHAR(60),
`flgMovimento` INTEGER,
`tabella` VARCHAR(60),
`oraLog` TIME,
`pk` VARCHAR(40),
`pkValue` VARCHAR(40),
`lastUpdTmst` TIMESTAMP,
CONSTRAINT `PK_LOG` PRIMARY KEY (`id_log`)
);
CREATE INDEX `IDX_LOG_pk` ON `LOG` (`pk`);
CREATE INDEX `IDX_LOG_datalog` ON `LOG` (`dataLog`);
CREATE INDEX `IDX_LOG_pkValue` ON `LOG` (`pkValue`);
CREATE INDEX `IDX_LOG_id_users` ON `LOG` (`id_users`);
CREATE INDEX `IDX_LOG_lastupttmst` ON `LOG` (`lastUpdTmst` DESC);
CREATE INDEX `IDX_LOG_TAB_MOV_BL` ON `LOG` (`tabella`,`flgMovimento`,`id_blacklist`);
CREATE INDEX `IDX_LOG_PURGE` ON `LOG` (`dataLog`,`id_log`);

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,5 @@
###### SENDING DEBUG MAIL PROPERTIES ##########
SMTP=localhost
FROM=f3jar@f3.com
TO=acolzi@f3.com

View file

@ -0,0 +1,16 @@
package it.acxent.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface CRDescriptor {
String descrizione() default "";
boolean abilita() default true;
}

View file

@ -0,0 +1 @@
package it.acxent.annotation;

View file

@ -0,0 +1,41 @@
package it.acxent.api;
public class ApiClientResult {
private String msg;
public ApiClientResult(String msg, boolean status, Object result) {
this.msg = msg;
this.ok = status;
this.result = result;
}
private boolean ok = true;
private Object result;
public ApiClientResult() {}
public String getMsg() {
return (this.msg == null) ? "" : this.msg.trim();
}
public void setMsg(String msg) {
this.msg = msg;
}
public boolean isOk() {
return this.ok;
}
public void setOk(boolean status) {
this.ok = status;
}
public Object getResult() {
return this.result;
}
public void setResult(Object result) {
this.result = result;
}
}

View file

@ -0,0 +1,116 @@
package it.acxent.api;
import it.acxent.common.Parm;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import java.util.Base64;
public abstract class _AblApiClient {
public static final String APPLICATION_JSON = "application/json";
public static final String IT_IT = "it-IT";
protected static final String UTF_8 = "UTF-8";
public static final String BEARER = "Bearer ";
private ApplParmFull apFull = null;
private boolean useSandbox;
private String endpointSandbox;
private String endpointProduction;
private String username;
private String password;
private String token;
public _AblApiClient(ApplParmFull apFull) {
this.apFull = apFull;
}
public _AblApiClient() {}
public static void initApplicationParms(ApplParmFull ap) {
if (ap != null) {
DBAdapter.logDebug(true, "api client: start");
String l_tipoParm = "API CLIENT";
Parm bean = new Parm(ap);
DBAdapter.logDebug(true, "api client initParms: stop");
}
}
public boolean isUseSandbox() {
return this.useSandbox;
}
public void setUseSandbox(boolean useSandbox) {
this.useSandbox = useSandbox;
}
protected String getBase64BasicCredential() {
String encoding = getUsername() + ":" + getUsername();
return "Basic " + Base64.getEncoder().encodeToString(encoding.getBytes());
}
public ApplParmFull getApFull() {
return this.apFull;
}
public void setApFull(ApplParmFull apFull) {
this.apFull = apFull;
}
public void setEndpointSandbox(String endpointSandbox) {
this.endpointSandbox = endpointSandbox;
}
public String getEndpointProduction() {
return this.endpointProduction;
}
public void setEndpointProduction(String endpointProduction) {
this.endpointProduction = endpointProduction;
}
public String getEndpointSandbox() {
return this.endpointSandbox;
}
public String getEndpoint() {
if (isUseSandbox())
return getEndpointSandbox();
return getEndpointProduction();
}
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public String getToken() {
return this.token;
}
public void setToken(String token) {
this.token = token;
}
protected String getTokenBearer() {
return "Bearer " + getToken();
}
}

View file

@ -0,0 +1 @@
package it.acxent.api;

View file

@ -0,0 +1,80 @@
package it.acxent.bookmark;
import it.acxent.util.AbMessages;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.util.Hashtable;
public class Bookmark implements Serializable {
private static final long serialVersionUID = 5581069861405842841L;
private Hashtable items = null;
private int numberOfItems = 0;
private String msg;
public Bookmark() {
this.items = new Hashtable();
}
public String addBookmarkItem(BookmarkItem theBI) {
if (!this.items.containsKey(theBI.getBookmarkItemId())) {
this.items.put(theBI.getBookmarkItemId(), theBI);
this.numberOfItems++;
setMsg(AbMessages.getMessage("BM_ITEM_ADDED"));
return AbMessages.getMessage("BM_ITEM_ADDED");
}
setMsg(AbMessages.getMessage("BM_ITEM_PRESENT"));
return AbMessages.getMessage("BM_ITEM_PRESENT");
}
public void clear() {
this.items.clear();
this.numberOfItems = 0;
}
protected void finalize() throws Throwable {
this.items.clear();
}
public Vectumerator getItems() {
return new Vectumerator(this.items.elements());
}
public String getMsg() {
if (this.msg == null)
return "";
String temp = this.msg;
setMsg(null);
return temp;
}
public int getNumberOfItems() {
return this.numberOfItems;
}
public String removeBookmarkItem(BookmarkItem theBI) {
if (this.items.containsKey(theBI.getBookmarkItemId())) {
this.items.remove(theBI.getBookmarkItemId());
this.numberOfItems--;
setMsg(AbMessages.getMessage("BM_ITEM_DELETED"));
return AbMessages.getMessage("BM_ITEM_DELETED");
}
setMsg(AbMessages.getMessage("BM_ITEM_NOT_PRESENT"));
return AbMessages.getMessage("BM_ITEM_NOT_PRESENT");
}
public String removeBookmarkItem(Long bookmarkItemId) {
if (this.items.containsKey(bookmarkItemId)) {
this.items.remove(bookmarkItemId);
this.numberOfItems--;
return AbMessages.getMessage("BM_ITEM_DELETED");
}
return AbMessages.getMessage("BM_ITEM_NOT_PRESENT");
}
private void setMsg(String newMsg) {
this.msg = newMsg;
}
}

View file

@ -0,0 +1,136 @@
package it.acxent.bookmark;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import java.io.Serializable;
public class BookmarkItem implements Serializable {
private static final long serialVersionUID = 4969897129141278294L;
private Object itemId;
private Class itemClass;
private ApplParmFull applParmFull;
private DBAdapter dbItem;
private String flgTipoBookmarkItem;
public static final String TIPO_RISORSA = "R";
public static final String TIPO_LINK = "L";
private String link;
private String itemDescription;
public BookmarkItem(Object anItemPrimaryKey, Class theItemClass, String theItemDescription, ApplParmFull theApplParmFull) {
setItemClass(theItemClass);
setApplParmFull(theApplParmFull);
setFflgTipoBookmarkItem("R");
setItemDescription(theItemDescription);
setItemId(anItemPrimaryKey);
}
public BookmarkItem(String link) {
setLink(link);
setFflgTipoBookmarkItem("L");
}
public ApplParmFull getApplParmFull() {
return this.applParmFull;
}
public Long getBookmarkItemId() {
if (getFlgTipoBookmarkItem().equals("L"))
return new Long((long)(getFlgTipoBookmarkItem() + getFlgTipoBookmarkItem()).hashCode());
return new Long(
(long)(getFlgTipoBookmarkItem() + getFlgTipoBookmarkItem() + String.valueOf(getItemId())).hashCode());
}
public DBAdapter getDbItem() {
if (this.dbItem == null && this.itemId != null)
try {
this
.dbItem = getItemClass().newInstance();
this.dbItem.setApFull(getApplParmFull());
this.dbItem.findByPrimaryKey(getItemId());
} catch (Exception e) {
e.printStackTrace();
}
return this.dbItem;
}
private Class getItemClass() {
return this.itemClass;
}
public String getItemDescription() {
return (this.itemDescription == null) ? "" : this.itemDescription;
}
public Object getItemId() {
return new Long((String)this.itemId);
}
public String getLink() {
return this.link;
}
private void setApplParmFull(ApplParmFull newApplParmFull) {
this.applParmFull = newApplParmFull;
}
private void setDbItem(DBAdapter newDbItem) {
this.dbItem = newDbItem;
}
private void setFflgTipoBookmarkItem(String newFflgTipoBookmarkItem) {
this.flgTipoBookmarkItem = newFflgTipoBookmarkItem;
}
private void setItemClass(Class newItemClass) {
this.itemClass = newItemClass;
}
private void setItemDescription(String newItemDescription) {
this.itemDescription = newItemDescription;
}
public void setItemId(Object newItemId) {
this.itemId = newItemId;
setDbItem(null);
}
private void setLink(String newLink) {
this.link = newLink;
}
public String getDescrizione() {
if (getFlgTipoBookmarkItem().equals("L"))
return getLink();
if (getFlgTipoBookmarkItem().equals("R"))
return getItemDescription();
return "???";
}
public String getFlgTipoBookmarkItem() {
return this.flgTipoBookmarkItem;
}
public String getTipoBookmarkItem() {
if (getFlgTipoBookmarkItem().equals("L"))
return "Link";
if (getFlgTipoBookmarkItem().equals("R"))
return "Risorsa";
return "???";
}
public String getItemClassType() {
return this.itemClass.toString().substring(6);
}
}

View file

@ -0,0 +1,15 @@
package it.acxent.cloudmsg;
public class ApnsJson {
private HeadersJson headers;
public HeadersJson getHeaders() {
if (this.headers == null)
this.headers = new HeadersJson();
return this.headers;
}
public void setHeaders(HeadersJson headers) {
this.headers = headers;
}
}

View file

@ -0,0 +1,51 @@
package it.acxent.cloudmsg;
public class CloudMsgJson {
private MsgJson notification;
private MsgJson data;
private String token;
private ApnsJson apns;
public CloudMsgJson(MsgJson notification, MsgJson data, String token) {
this.notification = notification;
this.data = data;
this.token = token;
}
public CloudMsgJson() {}
public MsgJson getNotification() {
return this.notification;
}
public void setNotification(MsgJson notification) {
this.notification = notification;
}
public MsgJson getData() {
return this.data;
}
public void setData(MsgJson data) {
this.data = data;
}
public String getToken() {
return this.token;
}
public void setToken(String to) {
this.token = to;
}
public ApnsJson getApns() {
return this.apns;
}
public void setApns(ApnsJson apns) {
this.apns = apns;
}
}

View file

@ -0,0 +1,16 @@
package it.acxent.cloudmsg;
import com.google.gson.annotations.SerializedName;
public class HeadersJson {
@SerializedName("apns-priority")
private String apnspriority;
public String getApnspriority() {
return (this.apnspriority == null) ? "10" : this.apnspriority.trim();
}
public void setApnspriority(String apnspriority) {
this.apnspriority = apnspriority;
}
}

View file

@ -0,0 +1,78 @@
package it.acxent.cloudmsg;
public class MsgJson {
public static final String NOTIFICATION_TYPE_NOTIFICATION = "notification";
private String notificationType;
private String title;
private String body;
private String sound;
private String priority;
private String click_action;
public MsgJson(String notificationType, String title, String body) {
this.title = title;
this.body = body;
}
public MsgJson(String notificationType, String title, String body, String click_action) {
this.title = title;
this.body = body;
this.click_action = click_action;
}
public MsgJson() {}
public String getNotificationType() {
return this.notificationType;
}
public void setNotificationType(String notificationType) {
this.notificationType = notificationType;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBody() {
return this.body;
}
public void setBody(String body) {
this.body = body;
}
public String getSound() {
return (this.sound == null) ? "default" : this.sound.trim();
}
public void setSound(String sound) {
this.sound = sound;
}
public String getPriority() {
return (this.priority == null) ? "high" : this.priority.trim();
}
public void setPriority(String priprity) {
this.priority = priprity;
}
public String getClick_action() {
return this.click_action;
}
public void setClick_action(String click_action) {
this.click_action = click_action;
}
}

View file

@ -0,0 +1,109 @@
package it.acxent.cloudmsg;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.gson.Gson;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
public class PushNotificationService {
private static final String MESSAGING_SCOPE = "https://www.googleapis.com/auth/firebase.messaging";
private static final String[] SCOPES = new String[] { "https://www.googleapis.com/auth/firebase.messaging" };
public PushNotificationService(String pathFileJsonAuth) {
setPathFileJsonAuth(pathFileJsonAuth);
}
private final String FIREBASE_API_URL_OLD = "https://fcm.googleapis.com/fcm/send";
private final String FIREBASE_API_URL = "https://fcm.googleapis.com/v1/projects/{projectid}/messages:send";
private String pathFileJsonAuth;
public static final String P_FIREBASE_JSON_AUTH_PRIVATE_KEY = "FIREBASE_JSON_AUTH_PRIVATE_KEY";
public void sendPushNotification(List<String> tokens, MsgJson notifica, MsgJson data, String projectId) {
tokens.forEach(token -> {
System.out.println("\nCalling fcm Server >>>>>>>");
String response = callToFcmServer(token, notifica, data, projectId);
System.out.println("Got response from fcm Server : " + response + "\n\n");
});
}
private String callToFcmServer(String token, MsgJson notifica, MsgJson data, String projectId) {
CloudMsgJson cmj = new CloudMsgJson(notifica, data, token);
StringBuilder result = new StringBuilder();
try {
CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost("https://fcm.googleapis.com/v1/projects/{projectid}/messages:send".replace("{projectid}", projectId));
request.setHeader("Content-Type", "application/json");
request.setHeader("Authorization", "Bearer " + getServiceAccountAccessToken(getPathFileJsonAuth()));
Gson gson = new Gson();
JSONObject joMessageV0 = new JSONObject(gson.toJson(cmj));
JSONObject joMessageV1 = new JSONObject();
joMessageV1.put("message", joMessageV0);
System.out.println("v0:\n" + joMessageV0.toString(4));
System.out.println("v1:\n" + joMessageV1.toString(4));
StringEntity params = new StringEntity(joMessageV1.toString());
request.setEntity((HttpEntity)params);
HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request);
String content = EntityUtils.toString(resp.getEntity());
int statusCode = resp.getStatusLine().getStatusCode();
result.append("Status Code: " + statusCode);
result.append("\nstatusCode = " + statusCode);
result.append("\ncontent = " + content);
} catch (Exception e) {
e.printStackTrace();
}
return result.toString();
}
private static String getServiceAccountAccessToken(String fileJsonAuth) throws IOException {
GoogleCredentials googleCredentials = GoogleCredentials.fromStream(new FileInputStream(fileJsonAuth))
.createScoped(Arrays.asList(SCOPES));
googleCredentials.refresh();
return googleCredentials.getAccessToken().getTokenValue();
}
public String getPathFileJsonAuth() {
return this.pathFileJsonAuth;
}
public void setPathFileJsonAuth(String firebaseServerkey) {
this.pathFileJsonAuth = firebaseServerkey;
}
private String callToFcmServerOLD(String token, MsgJson notifica, MsgJson data, String projectId) {
CloudMsgJson cmj = new CloudMsgJson(notifica, data, token);
StringBuilder result = new StringBuilder();
try {
CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build();
HttpPost request = new HttpPost("https://fcm.googleapis.com/v1/projects/{projectid}/messages:send".replace("{projectid}", projectId));
request.setHeader("Content-Type", "application/json");
request.setHeader("Authorization", "key=" + getPathFileJsonAuth());
Gson gson = new Gson();
StringEntity params = new StringEntity(gson.toJson(cmj));
request.setEntity((HttpEntity)params);
HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request);
String content = EntityUtils.toString(resp.getEntity());
int statusCode = resp.getStatusLine().getStatusCode();
result.append("Status Code: " + statusCode);
result.append("\nstatusCode = " + statusCode);
result.append("\ncontent = " + content);
} catch (Exception e) {
e.printStackTrace();
}
return result.toString();
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,32 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class AccessCR extends CRAdapter {
private String id_access;
private long flgTabella = -1L;
public AccessCR() {}
public AccessCR(ApplParmFull newAp) {
super(newAp);
}
public String getId_access() {
return this.id_access;
}
public void setId_access(String id_access) {
this.id_access = id_access;
}
public long getFlgTabella() {
return this.flgTabella;
}
public void setFlgTabella(long flgTabella) {
this.flgTabella = flgTabella;
}
}

View file

@ -0,0 +1,137 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class AccessDitta extends DBAdapter implements Serializable {
private static final long serialVersionUID = -1022126863968745800L;
private long id_accessDitta;
private String id_access;
private String attr1Maiuscoli;
private String attrMaiuscoli;
private String attrMinuscoli;
private String descrizione;
private long flgSafeUpdate;
private Access access;
public AccessDitta(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public AccessDitta() {}
public void setId_accessDitta(long newId_accessDitta) {
this.id_accessDitta = newId_accessDitta;
}
public void setId_access(String newId_access) {
this.id_access = newId_access;
setAccess(null);
}
public void setAttr1Maiuscoli(String newAttr1Maiuscoli) {
this.attr1Maiuscoli = newAttr1Maiuscoli;
}
public void setAttrMaiuscoli(String newAttrMaiuscoli) {
this.attrMaiuscoli = newAttrMaiuscoli;
}
public void setAttrMinuscoli(String newAttrMinuscoli) {
this.attrMinuscoli = newAttrMinuscoli;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setFlgSafeUpdate(long newFlgSafeUpdate) {
this.flgSafeUpdate = newFlgSafeUpdate;
}
public long getId_accessDitta() {
return this.id_accessDitta;
}
public String getId_access() {
return (this.id_access == null) ? "" : this.id_access.trim();
}
public String getAttr1Maiuscoli() {
return (this.attr1Maiuscoli == null) ? "" : this.attr1Maiuscoli.trim();
}
public String getAttrMaiuscoli() {
return (this.attrMaiuscoli == null) ? "" : this.attrMaiuscoli.trim();
}
public String getAttrMinuscoli() {
return (this.attrMinuscoli == null) ? "" : this.attrMinuscoli.trim();
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public long getFlgSafeUpdate() {
return this.flgSafeUpdate;
}
public void setAccess(Access newAccess) {
this.access = newAccess;
}
public Access getAccess() {
this.access = (Access)getSecondaryObject(this.access, Access.class,
getId_access());
return this.access;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<? extends DBAdapter> findByCR(AccessDittaCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from ACCESS_DITTA AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
}

View file

@ -0,0 +1,96 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class AccessDittaCR extends CRAdapter {
private long id_accessDitta;
private String id_access;
private String attr1Maiuscoli;
private String attrMaiuscoli;
private String attrMinuscoli;
private String descrizione;
private long flgSafeUpdate;
private Access access;
public AccessDittaCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public AccessDittaCR() {}
public void setId_accessDitta(long newId_accessDitta) {
this.id_accessDitta = newId_accessDitta;
}
public void setId_access(String newId_access) {
this.id_access = newId_access;
setAccess(null);
}
public void setAttr1Maiuscoli(String newAttr1Maiuscoli) {
this.attr1Maiuscoli = newAttr1Maiuscoli;
}
public void setAttrMaiuscoli(String newAttrMaiuscoli) {
this.attrMaiuscoli = newAttrMaiuscoli;
}
public void setAttrMinuscoli(String newAttrMinuscoli) {
this.attrMinuscoli = newAttrMinuscoli;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setFlgSafeUpdate(long newFlgSafeUpdate) {
this.flgSafeUpdate = newFlgSafeUpdate;
}
public long getId_accessDitta() {
return this.id_accessDitta;
}
public String getId_access() {
return (this.id_access == null) ? "" : this.id_access.trim();
}
public String getAttr1Maiuscoli() {
return (this.attr1Maiuscoli == null) ? "" : this.attr1Maiuscoli.trim();
}
public String getAttrMaiuscoli() {
return (this.attrMaiuscoli == null) ? "" : this.attrMaiuscoli.trim();
}
public String getAttrMinuscoli() {
return (this.attrMinuscoli == null) ? "" : this.attrMinuscoli.trim();
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public long getFlgSafeUpdate() {
return this.flgSafeUpdate;
}
public void setAccess(Access newAccess) {
this.access = newAccess;
}
public Access getAccess() {
this.access = (Access)getSecondaryObject(this.access, Access.class,
getId_access());
return this.access;
}
}

View file

@ -0,0 +1,190 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class AccessGroup extends DBAdapter implements Serializable {
private long id_accessGroup;
private String descrizione;
private String nota;
public AccessGroup(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public AccessGroup() {}
public void setId_accessGroup(long newId_accessGroup) {
this.id_accessGroup = newId_accessGroup;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public long getId_accessGroup() {
return this.id_accessGroup;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione;
}
public String getUsers() {
if (getId_accessGroup() != 0L) {
Vectumerator<UserAccessGroup> vec = getUserAccessGroup(0, 0);
StringBuffer temp = new StringBuffer();
while (vec.hasMoreElements()) {
UserAccessGroup row = vec.nextElement();
temp.append(row.getUsers().getCognomeNome());
if (vec.hasMoreElements())
temp.append(", ");
}
return temp.toString();
}
return "";
}
public String getAccesses() {
if (getId_accessGroup() != 0L) {
Vectumerator<AccessGroupAccess> vec = findAccessGroupAccess(0, 0);
StringBuffer temp = new StringBuffer();
while (vec.hasMoreElements()) {
AccessGroupAccess row = vec.nextElement();
temp.append(row.getAccess().getId_access());
temp.append(" (" + row.getRW() + ")");
if (vec.hasMoreElements())
temp.append(", ");
}
return temp.toString();
}
return "";
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator findByCR(AccessGroupCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from ACCESS_GROUP AS A";
String s_Sql_Order = " order by A.descrizione";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.descrizione like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public ResParm addUser(UserAccessGroup row) {
UserAccessGroup bean = new UserAccessGroup(getApFull());
if (row.getId_userAccessGroup() != 0L) {
bean.findByPrimaryKey(row.getId_userAccessGroup());
} else {
bean.findByAccessGroupUser(row.getId_accessGroup(), row.getId_users());
}
if (bean != null) {
row.setDBState(bean.getDBState());
row.setId_userAccessGroup(bean.getId_userAccessGroup());
} else {
row.setDBState(0);
}
return row.save();
}
public ResParm delAccess(AccessGroupAccess row) {
AccessGroupAccess bean = new AccessGroupAccess(getApFull());
bean.findByPrimaryKey(row.getId_accessGroupAccess());
return bean.delete();
}
public ResParm addAccess(AccessGroupAccess row) {
AccessGroupAccess bean = new AccessGroupAccess(getApFull());
if (row.getId_accessGroupAccess() != 0L) {
bean.findByPrimaryKey(row.getId_accessGroupAccess());
} else {
bean.findByAccessGroupAccess(row.getId_accessGroup(), row.getId_access());
}
if (bean != null) {
row.setDBState(bean.getDBState());
row.setId_accessGroupAccess(bean.getId_accessGroupAccess());
} else {
row.setDBState(0);
}
return row.save();
}
public ResParm delUser(UserAccessGroup row) {
UserAccessGroup bean = new UserAccessGroup(getApFull());
bean.findByPrimaryKey(row.getId_userAccessGroup());
return bean.delete();
}
public Vectumerator<AccessGroupAccess> findAccessGroupAccess(int pageNumber, int pageRows) {
return new AccessGroupAccess(getApFull()).findByAccessGroup(getId_accessGroup(), pageNumber, pageRows);
}
public Vectumerator getUserAccessGroup(int pageNumber, int pageRows) {
return new UserAccessGroup(getApFull()).findByAccessGroup(getId_accessGroup(), pageNumber, pageRows);
}
public long getFlgRW(String l_id_access) {
if (getId_accessGroup() == 0L)
return 0L;
AccessGroupAccess aga = new AccessGroupAccess(getApFull());
aga.findByAccessGroupAccess(getId_accessGroup(), l_id_access);
return aga.getFlgRW();
}
public ResParm duplica() {
if (getId_accessGroup() == 0L)
return new ResParm(false, "Errore! bean non valido!");
Vectumerator<AccessGroupAccess> vecAGA = findAccessGroupAccess(0, 0);
setId_accessGroup(0L);
setDBState(0);
setDescrizione(getDescrizione() + " copia");
ResParm rp = save();
if (rp.getStatus())
while (vecAGA.hasMoreElements()) {
AccessGroupAccess rowAGA = vecAGA.nextElement();
rowAGA.setId_accessGroupAccess(0L);
rowAGA.setDBState(0);
rowAGA.setId_accessGroup(getId_accessGroup());
rowAGA.save();
}
return new ResParm(false, "Errore! bean non valido!");
}
public String getNota() {
return (this.nota == null) ? "" : this.nota.trim();
}
public void setNota(String nota) {
this.nota = nota;
}
}

View file

@ -0,0 +1,150 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class AccessGroupAccess extends DBAdapter implements Serializable {
private static final long serialVersionUID = -218207150565122890L;
private long id_accessGroupAccess;
private long flgRW;
private String id_access;
private long id_accessGroup;
private Access access;
private AccessGroup accessGroup;
public AccessGroupAccess(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public AccessGroupAccess() {}
public void setId_accessGroupAccess(long newId_accessGroupAccess) {
this.id_accessGroupAccess = newId_accessGroupAccess;
}
public void setFlgRW(long newFlgRW) {
this.flgRW = newFlgRW;
}
public void setId_access(String newId_access) {
this.id_access = newId_access;
setAccess(null);
}
public void setId_accessGroup(long newId_accessGroup) {
this.id_accessGroup = newId_accessGroup;
setAccessGroup(null);
}
public long getId_accessGroupAccess() {
return this.id_accessGroupAccess;
}
public long getFlgRW() {
return this.flgRW;
}
public String getId_access() {
return (this.id_access == null) ? "" : this.id_access;
}
public long getId_accessGroup() {
return this.id_accessGroup;
}
public void setAccess(Access newAccess) {
this.access = newAccess;
}
public Access getAccess() {
this.access = (Access)getSecondaryObject(this.access, Access.class, getId_access());
return this.access;
}
public void setAccessGroup(AccessGroup newAccessGroup) {
this.accessGroup = newAccessGroup;
}
public AccessGroup getAccessGroup() {
this.accessGroup = (AccessGroup)getSecondaryObject((DBAdapter)this.accessGroup, AccessGroup.class, getId_accessGroup());
return this.accessGroup;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator findByCR(AccessGroupAccessCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from ACCESS_GROUP_ACCESS AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public String getRW() {
return DBAdapter.getRW(getFlgRW());
}
public Vectumerator<AccessGroupAccess> findByAccessGroup(long l_id_accessGroup, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from ACCESS_GROUP_ACCESS AS A, ACCESS AS B";
String s_Sql_Order = " order by B.descrizione";
WcString wc = new WcString();
wc.addWc("A.id_access=B.id_access");
wc.addWc("A.id_accessGroup =" + l_id_accessGroup);
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc));
return (Vectumerator)findRows(stmt, pageNumber, pageRows);
} catch (Exception e) {
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
public void findByAccessGroupAccess(long l_id_accessGroup, String l_id_access) {
String s_Sql_Find = "select A.* from ACCESS_GROUP_ACCESS AS A, ACCESS AS B";
String s_Sql_Order = " order by B.descrizione";
WcString wc = new WcString();
wc.addWc("A.id_access=B.id_access");
wc.addWc("A.id_accessGroup =" + l_id_accessGroup);
wc.addWc("A.id_access ='" + l_id_access + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc));
findFirstRecord(stmt);
} catch (Exception e) {
handleDebug(e);
}
}
}

View file

@ -0,0 +1,81 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
import it.acxent.db.DBAdapter;
public class AccessGroupAccessCR extends CRAdapter {
private long id_accessGroupAccess;
private long flgRW;
private String id_access;
private long id_accessGroup;
private Access access;
private AccessGroup accessGroup;
public AccessGroupAccessCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public AccessGroupAccessCR() {}
public void setId_accessGroupAccess(long newId_accessGroupAccess) {
this.id_accessGroupAccess = newId_accessGroupAccess;
}
public void setFlgRW(long newFlgRW) {
this.flgRW = newFlgRW;
}
public void setId_access(String newId_access) {
this.id_access = newId_access;
setAccess(null);
}
public void setId_accessGroup(long newId_accessGroup) {
this.id_accessGroup = newId_accessGroup;
setAccessGroup(null);
}
public long getId_accessGroupAccess() {
return this.id_accessGroupAccess;
}
public long getFlgRW() {
return this.flgRW;
}
public String getId_access() {
return (this.id_access == null) ? "" : this.id_access;
}
public long getId_accessGroup() {
return this.id_accessGroup;
}
public void setAccess(Access newAccess) {
this.access = newAccess;
}
public Access getAccess() {
this.access = (Access)getSecondaryObject(this.access, Access.class,
getId_access());
return this.access;
}
public void setAccessGroup(AccessGroup newAccessGroup) {
this.accessGroup = newAccessGroup;
}
public AccessGroup getAccessGroup() {
this.accessGroup = (AccessGroup)getSecondaryObject((DBAdapter)this.accessGroup, AccessGroup.class,
getId_accessGroup());
return this.accessGroup;
}
}

View file

@ -0,0 +1,32 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class AccessGroupCR extends CRAdapter {
private long id_accessGroup;
private String descrizione;
public AccessGroupCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public AccessGroupCR() {}
public void setId_accessGroup(long newId_accessGroup) {
this.id_accessGroup = newId_accessGroup;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public long getId_accessGroup() {
return this.id_accessGroup;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione;
}
}

View file

@ -0,0 +1,383 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
public class Blacklist extends DBAdapter implements Serializable {
private static final long serialVersionUID = 5750918920606244553L;
private long id_blacklist;
private long flgAttivo;
private String descrizione;
private String notaBlacklist;
private String eMail;
private String ipAddress;
private long fatalCount;
private Timestamp tmstStartCount;
private Timestamp tmstStartBlacklist;
private long ipMax;
private long ipMin;
private ArrayList<Integer> ipv4;
public Blacklist(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public Blacklist() {}
public void setId_blacklist(long newId_blackList) {
this.id_blacklist = newId_blackList;
}
public void setFlgAttivo(long newFlgAttivo) {
this.flgAttivo = newFlgAttivo;
}
public void setIpAddress(String newIpAddress) {
this.ipAddress = newIpAddress;
}
public void setEMail(String newEMail) {
this.eMail = newEMail;
}
public long getId_blacklist() {
return this.id_blacklist;
}
public String getAttivo() {
return (this.flgAttivo == 0L) ? "N" : "S";
}
public long getFlgAttivo() {
return this.flgAttivo;
}
public String getIpAddress() {
return (this.ipAddress == null) ? "" : this.ipAddress.trim();
}
public String getEMail() {
return (this.eMail == null) ? "" : this.eMail.trim();
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<Blacklist> findByCR(BlacklistCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from BLACKLIST AS A";
String s_Sql_Order = " order by A.tmstStartBlacklist desc";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.descrizione like '%" + token + "%' or A.ipAddress like '%" + token + "%' or A.eMail like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
if (CR.getFlgAttivo() == 0L) {
wc.addWc("(A.flgAttivo is null or A.flgAttivo=0)");
} else if (CR.getFlgAttivo() == 1L) {
wc.addWc("A.flgAttivo =1");
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return (Vectumerator)findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
public void findByIp(String l_ip, boolean soloAttivo) {
String s_Sql_Find = "select A.* from BLACKLIST AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.ipAddress like '" + l_ip + "%'");
if (soloAttivo)
wc.addWc("A.flgAttivo=1");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public void findByEmail(String l_eMail) {
String s_Sql_Find = "select A.* from BLACKLIST AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (l_eMail.indexOf("@") > 0) {
String temp = l_eMail.substring(l_eMail.indexOf("@"));
wc.addWc("(A.eMail like '" + temp + "%' or A.eMail like '%" + l_eMail + "%')");
} else {
wc.addWc("A.eMail like '%" + l_eMail + "%'");
}
wc.addWc("A.flgAttivo=1");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public String getDescrizioneCompleta() {
StringBuffer temp = new StringBuffer(getDescrizione());
temp.append(" ");
if (!getIpAddress().isEmpty()) {
temp.append("Ip addr.: ");
temp.append(getIpAddress());
}
if (!getEMail().isEmpty()) {
temp.append(" Email addr.: ");
temp.append(getEMail());
}
return temp.toString().trim();
}
public void setDescrizione(String descrizione) {
this.descrizione = descrizione;
}
public String getNotaBlacklist() {
return (this.notaBlacklist == null) ? "" : this.notaBlacklist.trim();
}
public void setNotaBlacklist(String notaBlacklist) {
this.notaBlacklist = notaBlacklist;
}
public long getFatalCount() {
return this.fatalCount;
}
public void setFatalCount(long fatalCount) {
this.fatalCount = fatalCount;
}
public Timestamp getTmstStartCount() {
return (this.tmstStartCount == null) ? getTimestamp() : this.tmstStartCount;
}
public void setTmstStartCount(Timestamp tmstStartCount) {
this.tmstStartCount = tmstStartCount;
}
public Timestamp getTmstStartBlacklist() {
return this.tmstStartBlacklist;
}
public void setTmstStartBlacklist(Timestamp tmstStartBlacklist) {
this.tmstStartBlacklist = tmstStartBlacklist;
}
public ResParm save() {
if (getIpAddress().isEmpty()) {
setIpMax(0L);
setIpMin(0L);
} else {
long max = 0L, min = 0L;
int pot = 24;
if (getIpv4() != null)
for (Integer element : getIpv4()) {
System.out.println(element);
if (element == 0) {
max += 255L * (long)Math.pow(2.0D, (double)pot);
} else {
max += (long)element * (long)Math.pow(2.0D, (double)pot);
min += (long)element * (long)Math.pow(2.0D, (double)pot);
}
pot -= 8;
}
setIpMax(max);
setIpMin(min);
System.out.println("" + max + " " + max);
}
if (getTmstStartBlacklist() == null)
setTmstStartBlacklist(new Timestamp(getNow().getTime()));
return super.save();
}
@Deprecated
public ArrayList<Integer> convertIpToIpv4Gpt(String l_ip) {
try {
ArrayList<Integer> l_ipv4 = new ArrayList<>();
StringTokenizer st = new StringTokenizer(l_ip, ".");
if (st.hasMoreTokens()) {
l_ipv4.add(Integer.valueOf(st.nextToken()));
} else {
l_ipv4.add(Integer.valueOf(0));
}
if (st.hasMoreTokens()) {
l_ipv4.add(Integer.valueOf(st.nextToken()));
} else {
l_ipv4.add(Integer.valueOf(0));
}
if (st.hasMoreTokens()) {
l_ipv4.add(Integer.valueOf(st.nextToken()));
} else {
l_ipv4.add(Integer.valueOf(0));
}
if (st.hasMoreTokens()) {
l_ipv4.add(Integer.valueOf(st.nextToken()));
} else {
l_ipv4.add(Integer.valueOf(0));
}
return l_ipv4;
} catch (Exception e) {
return null;
}
}
public ArrayList<Integer> convertIpToIpv4(String l_ip) {
try {
String[] parts = l_ip.trim().split("\\.");
if (parts.length != 4)
return null;
ArrayList<Integer> ipv4 = new ArrayList<>();
for (String part : parts) {
int val = Integer.parseInt(part);
if (val < 0 || val > 255)
return null;
ipv4.add(Integer.valueOf(val));
}
return ipv4;
} catch (Exception e) {
handleDebug("Errore in convertIpToIpv4 per input: " + l_ip, 3);
return null;
}
}
public long convertIpToLong(String l_ip) {
return convertIpv4ToLong(convertIpToIpv4(l_ip));
}
@Deprecated
public long convertIpv4ToLongGPT(ArrayList<Integer> l_ipv4) {
if (l_ipv4 != null) {
long res = 0L;
int pot = 24;
for (Integer element : l_ipv4) {
res += (long)element * (long)Math.pow(2.0D, (double)pot);
pot -= 8;
}
return res;
}
return -1L;
}
public long convertIpv4ToLong(ArrayList<Integer> l_ipv4) {
if (l_ipv4 == null || l_ipv4.size() != 4)
return -1L;
long res = 0L;
for (int i = 0; i < 4; i++) {
int octet = l_ipv4.get(i);
if (octet < 0 || octet > 255)
return -1L;
res |= (long)octet << 8 * (3 - i);
}
return res;
}
public long getIpMax(String l_ip) {
try {
long a = 0L, b = 0L, c = 0L, d = 0L;
StringTokenizer st = new StringTokenizer(l_ip, ".");
if (st.hasMoreTokens())
a = Long.valueOf(st.nextToken());
if (st.hasMoreTokens())
b = Long.valueOf(st.nextToken());
if (st.hasMoreTokens())
c = Long.valueOf(st.nextToken());
if (st.hasMoreTokens())
d = Long.valueOf(st.nextToken());
return d + c * 2L ^ 8L + b * 2L ^ 16L + a * 2L ^ 0x18L;
} catch (Exception e) {
return 0L;
}
}
public long getIpMax() {
return this.ipMax;
}
public void setIpMax(long ipMax) {
this.ipMax = ipMax;
}
public long getIpMin() {
return this.ipMin;
}
public void setIpMin(long ipMin) {
this.ipMin = ipMin;
}
protected void initFields() {
super.initFields();
setIpv4(null);
}
public ArrayList<Integer> getIpv4() {
if (getIpAddress().isEmpty())
return null;
this.ipv4 = convertIpToIpv4(getIpAddress());
return this.ipv4;
}
public void setIpv4(ArrayList<Integer> ipv4) {
this.ipv4 = ipv4;
}
public void findByIpV4(String l_ip, boolean soloAttivo) {
String s_Sql_Find = "select A.* from BLACKLIST AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
DBAdapter.printDebug(false, "IP RICERCA:" + l_ip);
long ipLong = convertIpToLong(l_ip);
wc.addWc("A.ipMax>=" + ipLong);
wc.addWc("A.ipMin<=" + ipLong);
if (soloAttivo)
wc.addWc("A.flgAttivo=1");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
}

View file

@ -0,0 +1,64 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class BlacklistCR extends CRAdapter {
private static final long serialVersionUID = -8588412967337016926L;
private long id_blacklist;
private long flgAttivo = -1L;
private String ipAddress;
private String eMail;
private String descrizione;
public BlacklistCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public BlacklistCR() {}
public void setId_blacklist(long newId_blackList) {
this.id_blacklist = newId_blackList;
}
public void setFlgAttivo(long newFlgAttivo) {
this.flgAttivo = newFlgAttivo;
}
public void setIpAddress(String newIpAddress) {
this.ipAddress = newIpAddress;
}
public void setEMail(String newEMail) {
this.eMail = newEMail;
}
public long getId_blacklist() {
return this.id_blacklist;
}
public long getFlgAttivo() {
return this.flgAttivo;
}
public String getIpAddress() {
return (this.ipAddress == null) ? "" : this.ipAddress.trim();
}
public String getEMail() {
return (this.eMail == null) ? "" : this.eMail.trim();
}
public String getDescrizione() {
return (this.descrizione == null) ? AB_EMPTY_STRING : this.descrizione.trim();
}
public void setDescrizione(String descrizione) {
this.descrizione = descrizione;
}
}

View file

@ -0,0 +1,8 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.ResParm;
public interface CrontabInterface {
ResParm crontabJob(ApplParmFull paramApplParmFull);
}

View file

@ -0,0 +1,45 @@
package it.acxent.common;
import java.io.Serializable;
public class DescLangItem implements Serializable {
private static final long serialVersionUID = -1620876542730237150L;
private String value;
private String lang;
private String campo;
public DescLangItem(String campo, String lang, String value) {
this.value = value;
this.lang = lang;
this.campo = campo;
}
public DescLangItem() {}
public String getCampo() {
return (this.campo == null) ? "" : this.campo.trim();
}
public void setCampo(String newCampo) {
this.campo = newCampo;
}
public String getLang() {
return (this.lang == null) ? "" : this.lang.trim();
}
public void setLang(String newLang) {
this.lang = newLang;
}
public String getValue() {
return (this.value == null) ? "" : this.value.trim();
}
public void setValue(String value) {
this.value = value;
}
}

View file

@ -0,0 +1,276 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Hashtable;
public class DescTxtLang extends DBAdapter implements Serializable {
private static Hashtable<String, Hashtable<String, Integer>> initTableDescLangDescriptorDb;
private String tabella;
private long idTabella;
private String campo;
private String lang;
private String descrizione;
private String descrizione254;
public DescTxtLang(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DescTxtLang() {}
public void setTabella(String newTabella) {
this.tabella = newTabella;
}
public void setIdTabella(long newIdTabella) {
this.idTabella = newIdTabella;
}
public void setCampo(String newCampo) {
this.campo = newCampo;
}
public void setLang(String newLang) {
this.lang = newLang;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public String getTabella() {
return (this.tabella == null) ? "" : this.tabella.trim();
}
public long getIdTabella() {
return this.idTabella;
}
public String getCampo() {
return (this.campo == null) ? "" : this.campo.trim();
}
public String getLang() {
return (this.lang == null) ? "" : this.lang.trim();
}
public String getDescrizioneScript() {
return DBAdapter.prepareScriptString(getDescrizione(), true, false);
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<DescTxtLang> findByCR(DescTxtLangCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from DESC_TXT_LANG AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return (Vectumerator)findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
public String getDescrizione254() {
return (this.descrizione254 == null) ? "" : this.descrizione254.trim();
}
public void setDescrizione254(String descrizione254) {
this.descrizione254 = descrizione254;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public String getDescrizione254Script() {
return DBAdapter.prepareScriptString(getDescrizione254(), true, false);
}
public void findByIdtabellaLangTabellaCampo(long l_idTabella, String l_lang, String l_tabella, String l_campo) {
String s_Sql_Find = "select A.* from DESC_TXT_LANG AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.idTabella=" + l_idTabella);
wc.addWc("A.lang='" + l_lang + "'");
wc.addWc("A.tabella='" + l_tabella + "'");
wc.addWc("A.campo='" + l_campo + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
findFirstRecord(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
}
}
public Vectumerator<DescTxtLang> findCampiByIdtabellaLangTabella(long l_idTabella, String l_lang, String l_tabella) {
String s_Sql_Find = "select A.* from DESC_TXT_LANG AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.idTabella=" + l_idTabella);
wc.addWc("A.lang='" + l_lang + "'");
wc.addWc("A.tabella='" + l_tabella + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return (Vectumerator)findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
protected final int getStringValueCase(String l_columnName) {
return 0;
}
public Vectumerator<? extends DBAdapter> findCampiTabella(String l_tabella) {
String s_Sql_Find = "select A.campo from DESC_TXT_LANG AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.tabella='" + l_tabella + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public ResParm deleteByTabellaIdtabella(String l_tabella, long l_id_tabella) {
String s_Sql_Find = "delete from DESC_TXT_LANG ";
WcString wc = new WcString();
wc.addWc("tabella='" + l_tabella + "'");
wc.addWc("idTabella=" + l_id_tabella);
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
return delete(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return new ResParm(false, e);
}
}
public Vectumerator findAllTxtByIdLangTable(long l_idTabella, String l_lang, String l_tabella) {
String s_Sql_Find = "select A.* from DESC_TXT_LANG AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.idTabella=" + l_idTabella);
if (!l_lang.isEmpty())
wc.addWc("A.lang='" + l_lang + "'");
wc.addWc("A.tabella='" + l_tabella + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public static void resetHashtables() {
if (initTableDescLangDescriptorDb != null)
initTableDescLangDescriptorDb.clear();
}
private static Hashtable<String, Hashtable<String, Integer>> getInitTableDescLangDescriptorDb() {
if (initTableDescLangDescriptorDb == null)
initTableDescLangDescriptorDb = new Hashtable<>();
return initTableDescLangDescriptorDb;
}
protected void fillFields(ResultSet rst) {
super.fillFields(rst);
int l_stringCaseValue = 0;
Hashtable<String, Integer> columnDescriptorHT = getInitTableDescLangDescriptorDb().get(getTabella() + getTabella());
if (columnDescriptorHT != null && columnDescriptorHT.containsKey(getCampo())) {
l_stringCaseValue = columnDescriptorHT.get(getCampo());
} else {
Access access = new Access(getApFull());
access.findByPrimaryKey(getTabella());
l_stringCaseValue = access.getTableColumnStringValueCase(getCampo());
if (columnDescriptorHT == null)
columnDescriptorHT = new Hashtable<>();
columnDescriptorHT.put(getCampo(), Integer.valueOf(l_stringCaseValue));
getInitTableDescLangDescriptorDb().put(getTabella() + getTabella(), columnDescriptorHT);
}
if (l_stringCaseValue != 0) {
String temp;
switch (l_stringCaseValue) {
case 1:
temp = getDescrizione();
if (temp != null) {
temp = temp.toUpperCase();
temp = temp.replaceAll("&EURO;", "&euro;");
}
setDescrizione(temp);
temp = getDescrizione254();
if (temp != null) {
temp = temp.toUpperCase();
temp = temp.replaceAll("&EURO;", "&euro;");
}
setDescrizione254(temp);
break;
case 2:
temp = getDescrizione();
if (temp != null)
temp = temp.toLowerCase();
setDescrizione(temp);
temp = getDescrizione254();
if (temp != null)
temp = temp.toLowerCase();
setDescrizione254(temp);
break;
case 3:
temp = getDescrizione();
if (temp != null)
temp = convertTo1stCap(temp);
setDescrizione(temp);
temp = getDescrizione254();
if (temp != null)
temp = temp.toLowerCase();
setDescrizione254(temp);
break;
}
}
}
}

View file

@ -0,0 +1,62 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class DescTxtLangCR extends CRAdapter {
private String tabella;
private long idTabella;
private String campo;
private String lang;
private String descrizione;
public DescTxtLangCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DescTxtLangCR() {}
public void setTabella(String newTabella) {
this.tabella = newTabella;
}
public void setIdTabella(long newIdTabella) {
this.idTabella = newIdTabella;
}
public void setCampo(String newCampo) {
this.campo = newCampo;
}
public void setLang(String newLang) {
this.lang = newLang;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public String getTabella() {
return (this.tabella == null) ? "" : this.tabella.trim();
}
public long getIdTabella() {
return this.idTabella;
}
public String getCampo() {
return (this.campo == null) ? "" : this.campo.trim();
}
public String getLang() {
return (this.lang == null) ? "" : this.lang.trim();
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
}

View file

@ -0,0 +1,54 @@
package it.acxent.common;
import java.io.Serializable;
public class DescTxtLangKey implements Serializable {
private String tabella;
private long idTabella;
private String campo;
private String lang;
public DescTxtLangKey() {}
public DescTxtLangKey(String newTabella, long newIdTabella, String newCampo, String newLang) {
setTabella(newTabella);
setIdTabella(newIdTabella);
setCampo(newCampo);
setLang(newLang);
}
public void setTabella(String newTabella) {
this.tabella = newTabella;
}
public void setIdTabella(long newIdTabella) {
this.idTabella = newIdTabella;
}
public void setCampo(String newCampo) {
this.campo = newCampo;
}
public void setLang(String newLang) {
this.lang = newLang;
}
public String getTabella() {
return (this.tabella == null) ? "" : this.tabella.trim();
}
public long getIdTabella() {
return this.idTabella;
}
public String getCampo() {
return (this.campo == null) ? "" : this.campo.trim();
}
public String getLang() {
return (this.lang == null) ? "" : this.lang.trim();
}
}

View file

@ -0,0 +1,55 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import java.io.Serializable;
public class Dictionary extends DBAdapter implements Serializable {
private String id_dictionary;
private String id_language;
private String descrizione;
public Dictionary() {
initFields();
}
public Dictionary(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public String getDescrizione() {
return (this.descrizione == null) ? "" :
this.descrizione;
}
public String getId_dictionary() {
return (this.id_dictionary == null) ? "" :
this.id_dictionary;
}
public String getId_language() {
return (this.id_language == null) ? "" :
this.id_language;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setId_dictionary(String newId_dictionary) {
this.id_dictionary = newId_dictionary;
}
public void setId_language(String newId_language) {
this.id_language = newId_language;
}
}

View file

@ -0,0 +1,25 @@
package it.acxent.common;
import java.io.Serializable;
public class DictionaryKey implements Serializable {
private String id_dictionary;
private String id_language;
public String getId_dictionary() {
return this.id_dictionary;
}
public String getId_language() {
return this.id_language;
}
public void setId_dictionary(String newId_dictionary) {
this.id_dictionary = newId_dictionary;
}
public void setId_language(String newId_language) {
this.id_language = newId_language;
}
}

View file

@ -0,0 +1,212 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class DittaCR extends CRAdapter {
private String cognome;
private String nome;
private String indirizzo;
private String numeroCivico;
private String descrizioneComune;
private String provinciaComune;
private String capComune;
private String capZona;
private String descrizioneNazione;
private String codFisc;
private String pIva;
private String eMail;
private String eMailAmm;
private String cellulare;
private String telefono;
private String telefonoAmm;
private String fax;
private String nota;
private String imgTmst;
private long id_ditta;
public DittaCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public DittaCR() {}
public void setCognome(String newCognome) {
this.cognome = newCognome;
}
public void setNome(String newNome) {
this.nome = newNome;
}
public void setIndirizzo(String newIndirizzo) {
this.indirizzo = newIndirizzo;
}
public void setNumeroCivico(String newNumeroCivico) {
this.numeroCivico = newNumeroCivico;
}
public void setDescrizioneComune(String newDescrizioneComune) {
this.descrizioneComune = newDescrizioneComune;
}
public void setProvinciaComune(String newProvinciaComune) {
this.provinciaComune = newProvinciaComune;
}
public void setCapComune(String newCapComune) {
this.capComune = newCapComune;
}
public void setCapZona(String newCapZona) {
this.capZona = newCapZona;
}
public void setDescrizioneNazione(String newDescrizioneNazione) {
this.descrizioneNazione = newDescrizioneNazione;
}
public void setCodFisc(String newCodFisc) {
this.codFisc = newCodFisc;
}
public void setPIva(String newPIva) {
this.pIva = newPIva;
}
public void setEMail(String newEMail) {
this.eMail = newEMail;
}
public void setEMailAmm(String newEMailAmm) {
this.eMailAmm = newEMailAmm;
}
public void setCellulare(String newCellulare) {
this.cellulare = newCellulare;
}
public void setTelefono(String newTelefono) {
this.telefono = newTelefono;
}
public void setTelefonoAmm(String newTelefonoAmm) {
this.telefonoAmm = newTelefonoAmm;
}
public void setFax(String newFax) {
this.fax = newFax;
}
public void setNota(String newNota) {
this.nota = newNota;
}
public void setImgTmst(String newImgTmst) {
this.imgTmst = newImgTmst;
}
public String getCognome() {
return (this.cognome == null) ? "" : this.cognome.trim();
}
public String getNome() {
return (this.nome == null) ? "" : this.nome.trim();
}
public String getIndirizzo() {
return (this.indirizzo == null) ? "" : this.indirizzo.trim();
}
public String getNumeroCivico() {
return (this.numeroCivico == null) ? "" : this.numeroCivico.trim();
}
public String getDescrizioneComune() {
return (this.descrizioneComune == null) ? "" : this.descrizioneComune.trim();
}
public String getProvinciaComune() {
return (this.provinciaComune == null) ? "" : this.provinciaComune.trim();
}
public String getCapComune() {
return (this.capComune == null) ? "" : this.capComune.trim();
}
public String getCapZona() {
return (this.capZona == null) ? "" : this.capZona.trim();
}
public String getDescrizioneNazione() {
return (this.descrizioneNazione == null) ? "" : this.descrizioneNazione.trim();
}
public String getCodFisc() {
return (this.codFisc == null) ? "" : this.codFisc.trim();
}
public String getPIva() {
return (this.pIva == null) ? "" : this.pIva.trim();
}
public String getEMail() {
return (this.eMail == null) ? "" : this.eMail.trim();
}
public String getEMailAmm() {
return (this.eMailAmm == null) ? "" : this.eMailAmm.trim();
}
public String getCellulare() {
return (this.cellulare == null) ? "" : this.cellulare.trim();
}
public String getTelefono() {
return (this.telefono == null) ? "" : this.telefono.trim();
}
public String getTelefonoAmm() {
return (this.telefonoAmm == null) ? "" : this.telefonoAmm.trim();
}
public String getFax() {
return (this.fax == null) ? "" : this.fax.trim();
}
public String getNota() {
return (this.nota == null) ? "" : this.nota.trim();
}
public String getImgTmst() {
return (this.imgTmst == null) ? "" : this.imgTmst.trim();
}
public long getId_ditta() {
return this.id_ditta;
}
public void setId_ditta(long id_ditta) {
this.id_ditta = id_ditta;
}
}

View file

@ -0,0 +1,113 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class FieldCache extends DBAdapter implements Serializable {
private static final long serialVersionUID = 1720535007805L;
private long id_fieldCache;
private String fieldTag;
private String descrizione;
public FieldCache(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public FieldCache() {}
public void setId_fieldCache(long newId_fieldCache) {
this.id_fieldCache = newId_fieldCache;
}
public void setFieldTag(String newFieldTag) {
this.fieldTag = newFieldTag;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public long getId_fieldCache() {
return this.id_fieldCache;
}
public String getFieldTag() {
return (this.fieldTag == null) ? "" : this.fieldTag.trim();
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<FieldCache> findByCR(FieldCacheCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from FIELD_CACHE AS A";
String s_Sql_Order = " order by A.fieldTag, A.descrizione";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.descrizione like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
if (!CR.getFieldTagS().isEmpty())
wc.addWc("A.fieldTag='" + CR.getFieldTagS() + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return (Vectumerator)findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
public void findByTagValore(String l_tag, String l_valore) {
String s_Sql_Find = "select A.* from FIELD_CACHE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.descrizione='" + l_valore + "'");
wc.addWc("A.fieldTag='" + l_tag + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
findFirstRecord(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
}
}
public Vectumerator<FieldCache> findTags() {
String s_Sql_Find = "select distinct A.fieldTag from FIELD_CACHE AS A";
String s_Sql_OrderBy = " order by A.fieldTag";
WcString wc = new WcString();
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return (Vectumerator)findRows(stmt);
} catch (Exception e) {
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
}

View file

@ -0,0 +1,42 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class FieldCacheCR extends CRAdapter {
private long id_fieldCacheS;
private String fieldTagS;
private String descrizioneS;
public FieldCacheCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public FieldCacheCR() {}
public void setId_fieldCacheS(long newId_fieldCache) {
this.id_fieldCacheS = newId_fieldCache;
}
public void setFieldTagS(String newFieldTag) {
this.fieldTagS = newFieldTag;
}
public void setDescrizioneS(String newDescrizione) {
this.descrizioneS = newDescrizione;
}
public long getId_fieldCacheS() {
return this.id_fieldCacheS;
}
public String getFieldTagS() {
return (this.fieldTagS == null) ? "" : this.fieldTagS.trim();
}
public String getDescrizioneS() {
return (this.descrizioneS == null) ? "" : this.descrizioneS.trim();
}
}

View file

@ -0,0 +1,52 @@
package it.acxent.common;
public class JsonUploadFileResponse {
private String fileName;
private String fileNameLink;
private String message;
private boolean result;
public JsonUploadFileResponse() {}
public JsonUploadFileResponse(boolean result, String message, String fileName, String fileNameLink) {
this.result = result;
this.message = message;
this.fileName = fileName;
this.fileNameLink = fileNameLink;
}
public String getFileName() {
return this.fileName;
}
public String getMessage() {
return this.message;
}
public void setFileName(String imgPath) {
this.fileName = imgPath;
}
public void setMessage(String message) {
this.message = message;
}
public boolean isResult() {
return this.result;
}
public void setResult(boolean result) {
this.result = result;
}
public String getFileNameLink() {
return this.fileNameLink;
}
public void setFileNameLink(String fileNameLink) {
this.fileNameLink = fileNameLink;
}
}

View file

@ -0,0 +1,41 @@
package it.acxent.common;
public class JsonUploadImageResponse {
private String imgPath;
private String message;
private boolean result;
public JsonUploadImageResponse() {}
public JsonUploadImageResponse(boolean result, String message, String imgpath) {
this.result = result;
this.message = message;
this.imgPath = imgpath;
}
public String getImgPath() {
return this.imgPath;
}
public String getMessage() {
return this.message;
}
public void setImgPath(String imgPath) {
this.imgPath = imgPath;
}
public void setMessage(String message) {
this.message = message;
}
public boolean isResult() {
return this.result;
}
public void setResult(boolean result) {
this.result = result;
}
}

View file

@ -0,0 +1,42 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.DBAdapterException;
import it.acxent.db.ResParm;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.SQLException;
public class Lang extends DBAdapter implements Serializable {
private static final long serialVersionUID = 4734855776441745596L;
private String lang;
protected void deleteCascade() {}
public static Vectumerator<Lang> findAllLangAvailable(ApplParmFull ap) {
Vectumerator<Lang> vec = new Vectumerator<>();
String lingue = ap.getParm("LANG_AVAILABLE").getTesto();
StringTokenizer st = new StringTokenizer(lingue, ",");
while (st.hasMoreTokens()) {
Lang lg = new Lang();
lg.setLang(st.nextToken());
vec.add(lg);
}
return vec;
}
protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException {
return null;
}
public String getLang() {
return (this.lang == null) ? "" : this.lang;
}
public void setLang(String lang) {
this.lang = lang;
}
}

View file

@ -0,0 +1,33 @@
package it.acxent.common;
public class OrderedRowId {
private long id;
private long prevId;
private long nextId;
public long getId() {
return this.id;
}
public void setId(long id) {
this.id = id;
}
public long getPrevId() {
return this.prevId;
}
public void setPrevId(long prevId) {
this.prevId = prevId;
}
public long getNextId() {
return this.nextId;
}
public void setNextId(long nextId) {
this.nextId = nextId;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,73 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class ParmCR extends CRAdapter {
private String tipoParm;
private long id_userProfile;
private long id_user;
public ParmCR() {}
public ParmCR(ApplParmFull newAp) {
setApFull(newAp);
}
public String getTipoParm() {
return (this.tipoParm == null) ? "" :
this.tipoParm;
}
public void setTipoParm(String newTxtRicerca) {
this.tipoParm = newTxtRicerca;
}
private long flgAdmin = -1L;
private long flgTipo = -1L;
private long id_parm;
public long getId_user() {
return this.id_user;
}
public void setId_user(long id_user) {
this.id_user = id_user;
}
public long getId_userProfile() {
return this.id_userProfile;
}
public void setId_userProfile(long id_userProfile) {
this.id_userProfile = id_userProfile;
}
public long getFlgAdmin() {
return this.flgAdmin;
}
public void setFlgAdmin(long flgAdmin) {
this.flgAdmin = flgAdmin;
}
public long getFlgTipo() {
return this.flgTipo;
}
public void setFlgTipo(long flgTipo) {
this.flgTipo = flgTipo;
}
public long getId_parm() {
return this.id_parm;
}
public void setId_parm(long id_parm) {
this.id_parm = id_parm;
}
}

View file

@ -0,0 +1,113 @@
package it.acxent.common;
import com.lowagie.text.Document;
import com.lowagie.text.Image;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfPageEvent;
import com.lowagie.text.pdf.PdfWriter;
import java.awt.Color;
public class PdfWatermarkEvent implements PdfPageEvent {
private String wmFileName;
public PdfWatermarkEvent(String wmFileName, boolean printMiddleDash, Rectangle l_pageSize) {
this.wmFileName = wmFileName;
this.printMiddleDash = printMiddleDash;
setPageSize(this.pageSize);
}
public PdfWatermarkEvent(String wmFileName, boolean printMiddleDash) {
this.wmFileName = wmFileName;
this.printMiddleDash = printMiddleDash;
}
public void onChapter(PdfWriter arg0, Document arg1, float arg2, Paragraph arg3) {}
public void onChapterEnd(PdfWriter arg0, Document arg1, float arg2) {}
public void onCloseDocument(PdfWriter arg0, Document arg1) {}
public void onEndPage(PdfWriter arg0, Document arg1) {}
public void onGenericTag(PdfWriter arg0, Document arg1, Rectangle arg2, String arg3) {}
public void onOpenDocument(PdfWriter arg0, Document arg1) {}
public void onParagraph(PdfWriter arg0, Document arg1, float arg2) {}
public void onParagraphEnd(PdfWriter arg0, Document arg1, float arg2) {}
public void onSection(PdfWriter arg0, Document arg1, float arg2, int arg3, Paragraph arg4) {}
public void onSectionEnd(PdfWriter arg0, Document arg1, float arg2) {}
public void onStartPage(PdfWriter writer, Document arg1) {
if (isPrintMiddleDash()) {
float middleY = getPageSize().getHeight() / 2.0F;
PdfContentByte cb = writer.getDirectContent();
cb.moveTo(0.0F, middleY);
cb.setLineDash(5.0F, 5.0F, 10.0F);
cb.setLineWidth(0.5F);
cb.setColorStroke(Color.gray);
cb.lineTo(getPageSize().getWidth(), middleY);
cb.stroke();
}
if (!getWmFileName().isEmpty()) {
PdfContentByte cb = writer.getDirectContent();
try {
Image wmImage = Image.getInstance(getWmFileName());
wmImage.setRotationDegrees(45.0F);
wmImage.scaleToFit(
wmImage.getHeight() * 30.0F / wmImage.getHeight(), 30.0F);
float newH = 30.0F;
float newW = wmImage.getHeight() * newH / wmImage.getHeight();
int nCol = 3;
int nRow = 6;
float xStep = (getPageSize().getWidth() - 2.0F * newW) / (float)nCol;
float yStep = (getPageSize().getHeight() - 2.0F * newH) / (float)nRow;
for (int i = 0; i < nCol; i++) {
for (int j = 0; j < nRow; j++) {
float x = (float)((double)i + 0.5D) * xStep;
float y = (float)((double)j + 0.5D) * yStep;
wmImage.setAbsolutePosition(x, y);
cb.addImage(wmImage);
}
}
cb.stroke();
} catch (Exception e) {
e.printStackTrace();
}
}
}
private boolean printMiddleDash = false;
private Rectangle pageSize;
public String getWmFileName() {
return (this.wmFileName == null) ? "" : this.wmFileName;
}
public void setWmFileName(String wmFileName) {
this.wmFileName = wmFileName;
}
public boolean isPrintMiddleDash() {
return this.printMiddleDash;
}
public void setPrintMiddleDash(boolean printMiddleDash) {
this.printMiddleDash = printMiddleDash;
}
public Rectangle getPageSize() {
return (this.pageSize == null) ? PageSize.A4 : this.pageSize;
}
public void setPageSize(Rectangle pageSize) {
this.pageSize = pageSize;
}
}

View file

@ -0,0 +1,202 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class Postazione extends DBAdapter implements PostazioneI, Serializable {
private static final long serialVersionUID = -8782732844262606524L;
private long id_postazione;
private String descrizione;
private String ipAddress;
private String stampanteA4;
private String stampanteEtichette;
private String endpointFirma;
private String hostname;
private long id_tipoPostazione;
private TipoPostazione tipoPostazione;
public Postazione(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public Postazione() {}
public void setId_postazione(long newId_postazione) {
this.id_postazione = newId_postazione;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setIpAddress(String newIpAddress) {
this.ipAddress = newIpAddress;
}
public void setStampanteA4(String newStampanteLaser) {
this.stampanteA4 = newStampanteLaser;
}
public void setStampanteEtichette(String newStampanteEtichette) {
this.stampanteEtichette = newStampanteEtichette;
}
public long getId_postazione() {
return this.id_postazione;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public String getIpAddress() {
return (this.ipAddress == null) ? "" : this.ipAddress.trim();
}
public String getStampanteA4() {
return (this.stampanteA4 == null) ? "" : this.stampanteA4.trim();
}
public String getStampanteEtichette() {
return (this.stampanteEtichette == null) ? "" : this.stampanteEtichette.trim();
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<Postazione> findByCR(PostazioneCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from POSTAZIONE AS A";
String s_Sql_Order = " order By A.descrizione";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return (Vectumerator)findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
public void findByIp(String l_ip) {
String s_Sql_Find = "select A.* from POSTAZIONE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.ipAddress='" + l_ip + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public void findByHostname(String l_hostname) {
String s_Sql_Find = "select A.* from POSTAZIONE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.hostname='" + l_hostname + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public String getStampanteA4Script() {
return getStampanteA4().replaceAll("\\\\", "\\\\\\\\");
}
public String getStampanteEtichetteScript() {
return getStampanteEtichette().replaceAll("\\\\", "\\\\\\\\");
}
public String getHostname() {
return (this.hostname == null) ? "" : this.hostname.trim();
}
public void setHostname(String hostname) {
this.hostname = hostname;
}
public String getEndpointFirma() {
return (this.endpointFirma == null) ? "" : this.endpointFirma.trim();
}
public void setEndpointFirma(String endpointFirma) {
this.endpointFirma = endpointFirma;
}
public long getId_tipoPostazione() {
return this.id_tipoPostazione;
}
public void setId_tipoPostazione(long id_tipoPostazione) {
this.id_tipoPostazione = id_tipoPostazione;
setTipoPostazione(null);
}
public TipoPostazione getTipoPostazione() {
this.tipoPostazione = (TipoPostazione)getSecondaryObject((DBAdapter)this.tipoPostazione, TipoPostazione.class, getId_tipoPostazione());
return this.tipoPostazione;
}
public void setTipoPostazione(TipoPostazione tipoPostazione) {
this.tipoPostazione = tipoPostazione;
}
public String getDescrizioneLogon() {
StringBuilder sb = new StringBuilder("Descrizione: ");
sb.append(getDescrizione());
sb.append("<br>Indirizzo IP: ");
sb.append(getIpAddress());
if (!getHostname().isEmpty()) {
sb.append("<br>Hostname: ");
sb.append(getHostname());
}
if (!getStampanteA4().isEmpty()) {
sb.append("<br>Stampante A4: ");
sb.append(getStampanteA4());
}
if (!getStampanteEtichette().isEmpty()) {
sb.append("<br>Stampante Etichetyte: ");
sb.append(getStampanteEtichette());
}
if (!getEndpointFirma().isEmpty()) {
sb.append("<br>Endpoint Firma: ");
sb.append(getEndpointFirma());
}
return sb.toString();
}
}

View file

@ -0,0 +1,100 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
import it.acxent.db.DBAdapter;
public class PostazioneCR extends CRAdapter {
private static final long serialVersionUID = -4627724827847959132L;
private long id_postazione;
private String descrizione;
private String ipAddress;
private String stampanteLaser;
private String stampanteEtichette;
private TipoPostazione tipoPostazione;
private long id_tipoPostazione;
private String hostname;
public PostazioneCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public PostazioneCR() {}
public void setId_postazione(long newId_postazione) {
this.id_postazione = newId_postazione;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setIpAddress(String newIpAddress) {
this.ipAddress = newIpAddress;
}
public void setStampanteLaser(String newStampanteLaser) {
this.stampanteLaser = newStampanteLaser;
}
public void setStampanteEtichette(String newStampanteEtichette) {
this.stampanteEtichette = newStampanteEtichette;
}
public long getId_postazione() {
return this.id_postazione;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" :
this.descrizione.trim();
}
public String getIpAddress() {
return (this.ipAddress == null) ? "" : this.ipAddress.trim();
}
public String getStampanteLaser() {
return (this.stampanteLaser == null) ? "" :
this.stampanteLaser.trim();
}
public String getStampanteEtichette() {
return (this.stampanteEtichette == null) ? "" :
this.stampanteEtichette.trim();
}
public TipoPostazione getTipoPostazione() {
this.tipoPostazione = (TipoPostazione)getSecondaryObject((DBAdapter)this.tipoPostazione, TipoPostazione.class, getId_tipoPostazione());
return this.tipoPostazione;
}
public void setTipoPostazione(TipoPostazione tipoPostazione) {
this.tipoPostazione = tipoPostazione;
}
public long getId_tipoPostazione() {
return this.id_tipoPostazione;
}
public void setId_tipoPostazione(long id_tipoPostazione) {
this.id_tipoPostazione = id_tipoPostazione;
setTipoPostazione(null);
}
public String getHostname() {
return (this.hostname == null) ? AB_EMPTY_STRING : this.hostname.trim();
}
public void setHostname(String hostname) {
this.hostname = hostname;
}
}

View file

@ -0,0 +1,43 @@
package it.acxent.common;
import it.acxent.util.Vectumerator;
public interface PostazioneI {
void setId_postazione(long paramLong);
void setDescrizione(String paramString);
void setIpAddress(String paramString);
void setStampanteA4(String paramString);
void setStampanteEtichette(String paramString);
long getId_postazione();
long getId_tipoPostazione();
TipoPostazione getTipoPostazione();
String getDescrizione();
String getIpAddress();
String getStampanteA4();
String getStampanteEtichette();
Vectumerator<Postazione> findByCR(PostazioneCR paramPostazioneCR, int paramInt1, int paramInt2);
void findByIp(String paramString);
void findByHostname(String paramString);
String getStampanteA4Script();
String getStampanteEtichetteScript();
String getEndpointFirma();
String getDescrizioneLogon();
}

View file

@ -0,0 +1,279 @@
package it.acxent.common;
import it.acxent.util.Vectumerator;
import java.util.Enumeration;
import java.util.Hashtable;
public class SimboliLavaggio {
private long lavaggio;
private long candeggio;
private long stiratura;
private long pulituraSecco;
private long asciugatura;
private long asciugaturaNaturale;
private static Hashtable<Long, SimboloLavaggio> dbSimboli;
public static final int NESSUN_SIMBOLO = 0;
public static final int LAVAGGIO_NO = 101;
public static final int LAVAGGIO_A_MANO = 102;
public static final int LAVAGGIO_DELICATO_MAX_30_1 = 103;
public static final int LAVAGGIO_DELICATO_MAX_30_2 = 104;
public static final int LAVAGGIO_DELICATO_MAX_30_3 = 105;
public static final int LAVAGGIO_DELICATO_MAX_40_1 = 106;
public static final int LAVAGGIO_DELICATO_MAX_40_2 = 107;
public static final int LAVAGGIO_DELICATO_MAX_40_3 = 108;
public static final int LAVAGGIO_DELICATO_MAX_50_1 = 109;
public static final int LAVAGGIO_DELICATO_MAX_50_2 = 110;
public static final int LAVAGGIO_DELICATO_MAX_60_1 = 111;
public static final int LAVAGGIO_DELICATO_MAX_60_2 = 112;
public static final int LAVAGGIO_DELICATO_MAX_70_1 = 113;
public static final int LAVAGGIO_DELICATO_MAX_95_1 = 114;
public static final int LAVAGGIO_DELICATO_MAX_95_2 = 115;
public static final int LAVAGGIO_ACQUA_PROFESSIONALE_1 = 601;
public static final int LAVAGGIO_ACQUA_PROFESSIONALE_2 = 602;
public static final int LAVAGGIO_ACQUA_PROFESSIONALE_3 = 603;
public static final int CANDEGGIO_NO = 201;
public static final int CANDEGGIO_CLORO_E_PERBORATO = 202;
public static final int CANDEGGIO_SOLO_PERBORATO = 203;
public static final int CANDEGGIO_CON_CLORO = 204;
public static final int ASCIUGARE_NO = 301;
public static final int ASCIUGARE_TEMP_INF_60 = 302;
public static final int ASCIUGARE_ALTA_TEMP = 303;
public static final int ASCIUGARE_SI = 304;
public static final int ASCIUGARE_NATURALE_1 = 701;
public static final int ASCIUGARE_NATURALE_2 = 702;
public static final int ASCIUGARE_NATURALE_3 = 703;
public static final int ASCIUGARE_NATURALE_4 = 704;
public static final int ASCIUGARE_NATURALE_5 = 705;
public static final int ASCIUGARE_NATURALE_6 = 706;
public static final int STIRO_NO = 401;
public static final int STIRO_BASSA_TEMP = 402;
public static final int STIRO_MEDIA_TEMP = 403;
public static final int STIRO_ALTA_TEMP = 404;
public static final int PULITURA_NO = 501;
public static final int PULITURA_TUTTI_I_SOLVENTI_1 = 502;
public static final int PULITURA_TUTTI_I_SOLVENTI_IN_USO_A = 503;
public static final int PULITURA_BENZIA_AVIO_E_R113 = 504;
public static final int PULITURA_BENZIA_AVIO_E_R113_CON_LIMITI_TEMP_UMIDITA = 505;
public static final int PULITURA_IDROC_E_TRIFLUORO_TRICLOROETANO = 506;
public static final int PULITURA_IDROC_E_TRIFLUORO_TRICLOROETANO_CON_LIMITI = 507;
private long lavaggioProfessionale;
public SimboliLavaggio() {
getDbSimboli();
}
public SimboloLavaggio getAsciugatura() {
if (getDbSimboli().containsKey(new Long(this.asciugatura)))
return getDbSimboli().get(new Long(this.asciugatura));
return new SimboloLavaggio();
}
public Vectumerator<SimboloLavaggio> getAsciugature() {
return getSimboli(1, 3);
}
public Vectumerator<SimboloLavaggio> getCandeggi() {
return getSimboli(11, 12);
}
public SimboloLavaggio getCandeggio() {
if (getDbSimboli().containsKey(new Long(this.candeggio)))
return getDbSimboli().get(new Long(this.candeggio));
return new SimboloLavaggio();
}
private Hashtable<Long, SimboloLavaggio> getDbSimboli() {
if (dbSimboli == null) {
dbSimboli = new Hashtable<>(40);
dbSimboli.put(new Long(0L), new SimboloLavaggio(0, "Nessun Simbolo"));
dbSimboli.put(new Long(101L), new SimboloLavaggio(101, "Non Lavare"));
dbSimboli.put(new Long(102L), new SimboloLavaggio(102, "Lavare a mano"));
dbSimboli.put(new Long(103L), new SimboloLavaggio(103, "Lavaggio delicato max 30°"));
dbSimboli.put(new Long(104L), new SimboloLavaggio(104, "Lavaggio delicato max 30°"));
dbSimboli.put(new Long(105L), new SimboloLavaggio(105, "Lavaggio delicato max 30°"));
dbSimboli.put(new Long(106L), new SimboloLavaggio(106, "Lavaggio delicato max 40°"));
dbSimboli.put(new Long(107L), new SimboloLavaggio(107, "Lavaggio delicato max 40°"));
dbSimboli.put(new Long(108L), new SimboloLavaggio(108, "Lavaggio delicato max 40°"));
dbSimboli.put(new Long(109L), new SimboloLavaggio(109, "Lavaggio delicato max 50°"));
dbSimboli.put(new Long(110L), new SimboloLavaggio(110, "Lavaggio delicato max 50°"));
dbSimboli.put(new Long(111L), new SimboloLavaggio(111, "Lavaggio delicato max 60°"));
dbSimboli.put(new Long(112L), new SimboloLavaggio(112, "Lavaggio delicato max 60°"));
dbSimboli.put(new Long(113L), new SimboloLavaggio(113, "Lavaggio delicato max 70°"));
dbSimboli.put(new Long(114L), new SimboloLavaggio(114, "Lavaggio delicato max 95°"));
dbSimboli.put(new Long(115L), new SimboloLavaggio(115, "Lavaggio delicato max 95°"));
dbSimboli.put(new Long(201L), new SimboloLavaggio(201, "Non Candeggiabile"));
dbSimboli.put(new Long(202L), new SimboloLavaggio(202, "Ammesso candeggio cloro e perborato"));
dbSimboli.put(new Long(203L), new SimboloLavaggio(203, "Ammesso candeggio solo perborato"));
dbSimboli.put(new Long(204L), new SimboloLavaggio(204, "Ammesso candeggio con cloro"));
dbSimboli.put(new Long(301L), new SimboloLavaggio(301, "Non Asciugare"));
dbSimboli.put(new Long(302L), new SimboloLavaggio(302, "Temperatura inferiore a 60°"));
dbSimboli.put(new Long(303L), new SimboloLavaggio(303, "Alta Temperatura"));
dbSimboli.put(new Long(304L), new SimboloLavaggio(304, "Asciugare"));
dbSimboli.put(new Long(401L), new SimboloLavaggio(401, "Non stirare"));
dbSimboli.put(new Long(402L), new SimboloLavaggio(402, "Bassa Temperatura"));
dbSimboli.put(new Long(403L), new SimboloLavaggio(403, "Media Temperatura"));
dbSimboli.put(new Long(404L), new SimboloLavaggio(404, "Alta temperatura"));
dbSimboli.put(new Long(501L), new SimboloLavaggio(501, "Non pulire a secco"));
dbSimboli.put(new Long(502L), new SimboloLavaggio(502, "Tutti i solventi"));
dbSimboli.put(new Long(503L), new SimboloLavaggio(503, "Tutti i solventi in uso"));
dbSimboli.put(new Long(504L), new SimboloLavaggio(504, "Benzina Avio e R113"));
dbSimboli.put(new Long(505L), new SimboloLavaggio(505, "Benzina Avio e R113 nel rispetto dei limiti di temperatura e umidita'"));
dbSimboli.put(new Long(506L), new SimboloLavaggio(506, "Lavaggio con idrocarburi e trifluoro-tricloroetano"));
dbSimboli.put(new Long(507L), new SimboloLavaggio(507, "Lavaggio con idrocarburi e trifluoro-tricloroetano nel rispetto dei limiti di temperatura e umidita'"));
dbSimboli.put(new Long(601L), new SimboloLavaggio(601, "Lavaggio ad acqua professionale"));
dbSimboli.put(new Long(602L), new SimboloLavaggio(602, "Lavaggio ad acqua professionale"));
dbSimboli.put(new Long(603L), new SimboloLavaggio(603, "Lavaggio ad acqua professionale"));
dbSimboli.put(new Long(701L), new SimboloLavaggio(701, "Asciugatura Naturale"));
dbSimboli.put(new Long(702L), new SimboloLavaggio(702, "Asciugatura Naturale"));
dbSimboli.put(new Long(703L), new SimboloLavaggio(703, "Asciugatura Naturale"));
dbSimboli.put(new Long(704L), new SimboloLavaggio(704, "Asciugatura Naturale"));
dbSimboli.put(new Long(705L), new SimboloLavaggio(705, "Asciugatura Naturale"));
dbSimboli.put(new Long(706L), new SimboloLavaggio(706, "Asciugatura Naturale"));
}
return dbSimboli;
}
public Vectumerator<SimboloLavaggio> getLavaggi() {
return getSimboli(41, 49);
}
public SimboloLavaggio getLavaggio() {
if (getDbSimboli().containsKey(new Long(this.lavaggio)))
return getDbSimboli().get(new Long(this.lavaggio));
return new SimboloLavaggio();
}
public SimboloLavaggio getPulituraSecco() {
if (getDbSimboli().containsKey(new Long(this.pulituraSecco)))
return getDbSimboli().get(new Long(this.pulituraSecco));
return new SimboloLavaggio();
}
public Vectumerator<SimboloLavaggio> getPulitureSecco() {
return getSimboli(31, 34);
}
private Vectumerator<SimboloLavaggio> getSimboli(int start, int end) {
Vectumerator<SimboloLavaggio> vec = new Vectumerator<>();
for (int i = start; i <= end; i++)
vec.addElement(getDbSimboli().get(new Long((long)i)));
return vec;
}
public SimboloLavaggio getStiratura() {
if (getDbSimboli().containsKey(new Long(this.stiratura)))
return getDbSimboli().get(new Long(this.stiratura));
return new SimboloLavaggio();
}
public Vectumerator<SimboloLavaggio> getStirature() {
return getSimboli(21, 24);
}
public Vectumerator<SimboloLavaggio> getTuttiSimboli() {
Vectumerator<SimboloLavaggio> vec = new Vectumerator<>();
Enumeration<SimboloLavaggio> enu = getDbSimboli().elements();
while (enu.hasMoreElements())
vec.addElement(enu.nextElement());
return vec;
}
public void setAsciugatura(long newAsciugatura) {
this.asciugatura = newAsciugatura;
}
public void setCandeggio(long newCandeggio) {
this.candeggio = newCandeggio;
}
public void setLavaggio(long newLavaggio) {
this.lavaggio = newLavaggio;
}
public void setPulituraSecco(long newPulituraSecco) {
this.pulituraSecco = newPulituraSecco;
}
public void setStiratura(long newStiratura) {
this.stiratura = newStiratura;
}
public long getAsciugaturaNaturale() {
return this.asciugaturaNaturale;
}
public void setAsciugaturaNaturale(long asciugaturaNaturale) {
this.asciugaturaNaturale = asciugaturaNaturale;
}
public long getLavaggioProfessionale() {
return this.lavaggioProfessionale;
}
public void setLavaggioProfessionale(long lavaggioProfessionale) {
this.lavaggioProfessionale = lavaggioProfessionale;
}
public boolean hasTuttiISimboli() {
if (this.candeggio == 0L || this.asciugatura == 0L || this.lavaggio == 0L || this.pulituraSecco == 0L || this.stiratura == 0L)
return false;
return true;
}
public boolean hasAlmenoUnSimbolo() {
if (this.candeggio != 0L || this.asciugatura != 0L || this.lavaggio != 0L || this.pulituraSecco != 0L || this.stiratura != 0L)
return true;
return false;
}
}

View file

@ -0,0 +1,30 @@
package it.acxent.common;
public class SimboloLavaggio {
private int codiceSimbolo;
private String descrizione;
public SimboloLavaggio() {}
public SimboloLavaggio(int codiceSimbolo, String descrizione) {
this.codiceSimbolo = codiceSimbolo;
this.descrizione = descrizione;
}
public int getCodiceSimbolo() {
return this.codiceSimbolo;
}
public String getDescrizione() {
return this.descrizione;
}
public void setCodiceSimbolo(int newCodiceSimbolo) {
this.codiceSimbolo = newCodiceSimbolo;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
}

View file

@ -0,0 +1,188 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import java.util.Hashtable;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
public class StatusMsg extends DBAdapter {
private static final long serialVersionUID = -8904636781719831584L;
private static final Map<String, StatusMsg> instancesByApCode = new ConcurrentHashMap<>();
private Hashtable<Key, String> tagMessageTable;
private static final String DIV_CLOSE = "</div>";
private static final String DIV_OPEN = "<div>";
private static class Key {
private String tag;
private String hostname;
public Key(String tag, String hostname) {
this.tag = tag;
this.hostname = hostname;
}
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Key key = (Key)o;
return (Objects.equals(this.tag, key.tag) && Objects.equals(this.hostname, key.hostname));
}
public int hashCode() {
return Objects.hash(this.tag, this.hostname);
}
public String toString() {
return this.tag.trim() + " (" + this.tag.trim() + ")";
}
}
private StatusMsg() {
this.tagMessageTable = new Hashtable<>();
}
private StatusMsg(ApplParmFull newApplParmFull) {
setApFull(newApplParmFull);
this.tagMessageTable = new Hashtable<>();
}
public ResParm delete() {
return null;
}
public void findByPrimaryKey(Object obj) {}
public int getDBState() {
return 1;
}
public ResParm save() {
return null;
}
public void setNuovaIstanzaOggettoRemoto(boolean flag) {}
public Object[] getFieldSetArg(String parmValue, Class type) {
return null;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
private void removeTag(String tag) {
Key key = new Key(tag, DBAdapter.getLocalHostname());
if (this.tagMessageTable.containsKey(key)) {
this.tagMessageTable.remove(key);
} else {
DBAdapter.printDebug("Errore: Il tag '" + tag + "' non esiste. hostname " + DBAdapter.getLocalHostname());
for (Map.Entry<Key, String> entry : this.tagMessageTable.entrySet())
DBAdapter.printDebug("Chiave: '" + ((Key)entry.getKey()).tag + " " + ((Key)entry.getKey()).hostname + "', Valore: " + (String)entry.getValue());
}
}
protected boolean isDatabaseBean() {
return false;
}
public static StatusMsg getInstance(ApplParmFull ap) {
String apCode = (ap != null) ? ap.getApCode() : "default";
return instancesByApCode.computeIfAbsent(apCode, k -> new StatusMsg(ap));
}
private synchronized void reset() {
this.tagMessageTable = new Hashtable<>();
}
private void updateTagMessage(String tag, String message) {
Key key = new Key(tag, DBAdapter.getLocalHostname());
this.tagMessageTable.put(key, message);
}
public String getMessage(String tag) {
Key key = new Key(tag, DBAdapter.getLocalHostname());
return this.tagMessageTable.get(key);
}
private String getStatusMsgHtmlReal() {
StringBuilder sb = new StringBuilder();
for (Key key : this.tagMessageTable.keySet()) {
String message = this.tagMessageTable.get(key);
sb.append("<div>");
sb.append("#");
sb.append(key.toString());
sb.append(": ");
sb.append(DBAdapter.convertStringToHtml(message));
sb.append("</div>");
}
return sb.toString();
}
public void printAllTagsAndMessagesForEach() {
for (Key key : this.tagMessageTable.keySet())
String str = this.tagMessageTable.get(key);
}
@Deprecated
public static final synchronized void xappendMsgByTag(String l_tag, String l_msg) {
appendMsgByTag(null, l_tag, l_msg);
}
public static final synchronized void appendMsgByTag(ApplParmFull l_apFull, String l_tag, String l_msg) {
StatusMsg store = getInstance(l_apFull);
String currentMsg = store.getMessage(l_tag);
store.updateTagMessage(l_tag, currentMsg + "\n" + currentMsg);
}
@Deprecated
public static final synchronized void xdeleteAllMsg() {
deleteAllMsg(null);
}
public static final synchronized void deleteAllMsg(ApplParmFull l_apFull) {
StatusMsg store = getInstance(l_apFull);
store.reset();
}
@Deprecated
public static final synchronized void xdeleteMsgByTag(String l_tag) {
deleteMsgByTag(null, l_tag);
}
public static final synchronized void deleteMsgByTag(ApplParmFull l_apFull, String l_tag) {
StatusMsg store = getInstance(l_apFull);
store.removeTag(l_tag);
}
@Deprecated
public static final synchronized String xgetStatusMsgHtml() {
return getStatusMsgHtml(null);
}
public static final synchronized String getStatusMsgHtml(ApplParmFull l_apFull) {
StatusMsg store = getInstance(l_apFull);
return store.getStatusMsgHtmlReal();
}
@Deprecated
public static final synchronized void xupdateMsgByTag(String l_tag, String l_msg) {
updateMsgByTag(null, l_tag, l_msg);
}
public static final synchronized void updateMsgByTag(ApplParmFull l_apFull, String l_tag, String l_msg) {
StatusMsg store = getInstance(l_apFull);
store.updateTagMessage(l_tag, l_msg);
}
}

View file

@ -0,0 +1,43 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
@Deprecated
public class StatusMsgCR extends CRAdapter {
private long id_statusMsg;
private String tag;
private String msg;
public StatusMsgCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public StatusMsgCR() {}
public void setId_statusMsg(long newId_statusMsg) {
this.id_statusMsg = newId_statusMsg;
}
public void setTag(String newTag) {
this.tag = newTag;
}
public void setMsg(String newMsg) {
this.msg = newMsg;
}
public long getId_statusMsg() {
return this.id_statusMsg;
}
public String getTag() {
return (this.tag == null) ? "" : this.tag.trim();
}
public String getMsg() {
return (this.msg == null) ? "" : this.msg.trim();
}
}

View file

@ -0,0 +1,736 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class TableDesc extends DBAdapter implements Serializable {
private static final long serialVersionUID = 1501275837045L;
public static final long FORM_FIELD_INPUT = 0L;
public static final long FORM_FIELD_COMBO = 1L;
public static final long FORM_FIELD_COMBO_FLG = 2L;
public static final long FORM_FIELD_CHECKBOX = 3L;
public static final long FORM_FIELD_RADIOBUTON = 4L;
public static final long FORM_FIELD_TEXT_AREA = 5L;
public static final long FORM_FIELD_AJAX = 6L;
private long id_tableDesc;
private long flgAjaxUseSubmit;
private String ajaxNextAction;
private String label;
private long flgTipo;
private long flgReadOnly;
private long ordine;
private long rowNumbCR;
private long colLg;
private long colXsCR;
private String ajaxSearchString;
private String valoreDefaultCR;
private boolean firstField;
private Access access;
private long maxLenght;
private long flgHidden;
private long colLgCR;
private long colXs;
private long ordineCR;
private long rowNumb;
private long flgPk;
private long numColSearch;
private long flgFormField;
private long flgCR;
private long tabOrder;
private String tabName;
private String comboFlgValuelist;
private String toolTip;
private long flgHtml;
private long ajaxNChar;
private String nomeColonna;
private long flgAjaxUseMono;
private String id_access;
private String ajaxJavascriptmodify;
private String ajaxJavascriptnew;
private String ajaxFieldsMapping;
private long flgMandatory;
private String ajaxTable;
public TableDesc(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TableDesc() {}
public void setId_tableDesc(long newId_tableDesc) {
this.id_tableDesc = newId_tableDesc;
}
public void setId_access(String newId_access) {
this.id_access = newId_access;
setAccess(null);
}
public void setNomeColonna(String newNomeColonna) {
this.nomeColonna = newNomeColonna;
}
public void setLabel(String newLabel) {
this.label = newLabel;
}
public void setFlgTipo(long newFlgTipo) {
this.flgTipo = newFlgTipo;
}
public void setFlgCR(long newFlgCR) {
this.flgCR = newFlgCR;
}
public void setOrdine(long newOrdine) {
this.ordine = newOrdine;
}
public void setRowNumb(long newRowNumb) {
this.rowNumb = newRowNumb;
}
public void setColLg(long newColLg) {
this.colLg = newColLg;
}
public void setColXs(long newColXs) {
this.colXs = newColXs;
}
public void setAjaxSearchString(String newAjaxSearchString) {
this.ajaxSearchString = newAjaxSearchString;
}
public void setAjaxFieldsMapping(String newAjaxReturnValues) {
this.ajaxFieldsMapping = newAjaxReturnValues;
}
public long getId_tableDesc() {
return this.id_tableDesc;
}
public String getId_access() {
return (this.id_access == null) ? "" : this.id_access.trim();
}
public String getNomeColonna() {
return (this.nomeColonna == null) ? "" : this.nomeColonna.trim();
}
public String getLabel() {
return (this.label == null) ? "" : this.label.trim();
}
public long getFlgTipo() {
return this.flgTipo;
}
public long getFlgCR() {
return this.flgCR;
}
public long getOrdine() {
return this.ordine;
}
public long getRowNumb() {
return this.rowNumb;
}
public long getColLg() {
return this.colLg;
}
public long getColXs() {
return this.colXs;
}
public String getAjaxSearchString() {
return (this.ajaxSearchString == null) ? "" : this.ajaxSearchString.trim();
}
public String getAjaxFieldsMapping() {
return (this.ajaxFieldsMapping == null) ? "" : this.ajaxFieldsMapping.trim();
}
public void setAccess(Access newAccess) {
this.access = newAccess;
}
public Access getAccess() {
this.access = (Access)getSecondaryObject(this.access, Access.class, getId_access());
return this.access;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<TableDesc> findHiddenByTable(String l_id_access) {
String s_Sql_Find = "select A.* from TABLE_DESC AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_access='" + l_id_access + "'");
wc.addWc("A.flgHidden=1");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return (Vectumerator)findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator<TableDesc> findPrimaryDetailFieldsByTable(String l_id_access) {
String s_Sql_Find = "select A.* from TABLE_DESC AS A";
String s_Sql_Order = " order by A.rowNumb, A.ordine";
WcString wc = new WcString();
wc.addWc("A.id_access='" + l_id_access + "'");
wc.addWc("(A.flgHidden is null or A.flgHidden=0)");
wc.addWc("A.rowNumb>0");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return (Vectumerator)findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
public void findByTabellaColonna(String nomeTabella, String nomeColonna) {
String s_Sql_Find = "select A.* from TABLE_DESC AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_access='" + nomeTabella + "'");
wc.addWc("A.nomeColonna='" + nomeColonna + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
findFirstRecord(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
}
}
public Vectumerator<TableDesc> findByTabella(String nomeTabella, long l_flgSearchType) {
String s_Sql_Find;
String s_Sql_Find_mysql = "select A.*, if(A.numColSearch is null,9999999999,A.numColSearch) as numColSearchOrder from TABLE_DESC AS A";
String s_Sql_Find_sqlserver = "select A.*, case when A.numColSearch is null then 9999999999 else A.numColSearch end as numColSearchOrder from TABLE_DESC AS A";
if (getApFull().getAp().getDbType() == 13 ||
getApFull().getAp().getDbType() == 14) {
s_Sql_Find = s_Sql_Find_sqlserver;
} else {
s_Sql_Find = s_Sql_Find_mysql;
}
String s_Sql_Order = " order by A.flgPk desc,A.nomeColonna";
if (l_flgSearchType == 1L) {
s_Sql_Order = " order by A.flgPk desc,A.rowNumbCR,A.ordineCR, A.nomeColonna";
} else if (l_flgSearchType == 2L) {
s_Sql_Order = " order by numColSearchOrder, A.nomeColonna";
} else if (l_flgSearchType == 3L) {
s_Sql_Order = " order by A.flgPk desc,A.rowNumb,A.ordine, A.nomeColonna";
}
WcString wc = new WcString();
wc.addWc("A.id_access='" + nomeTabella + "'");
if (l_flgSearchType == 1L)
wc.addWc("A.flgCR=1");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return (Vectumerator)findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
public long getMaxLenght() {
return this.maxLenght;
}
public void setMaxLenght(long maxLenght) {
this.maxLenght = maxLenght;
}
public long getFlgHidden() {
return this.flgHidden;
}
public void setFlgHidden(long flgHidden) {
this.flgHidden = flgHidden;
}
public long getRowNumbCR() {
return this.rowNumbCR;
}
public void setRowNumbCR(long rowNumbCR) {
this.rowNumbCR = rowNumbCR;
}
public long getColXsCR() {
return this.colXsCR;
}
public void setColXsCR(long colXsCR) {
this.colXsCR = colXsCR;
}
public long getColLgCR() {
return this.colLgCR;
}
public void setColLgCR(long colLgCR) {
this.colLgCR = colLgCR;
}
public long getOrdineCR() {
return this.ordineCR;
}
public void setOrdineCR(long ordineCR) {
this.ordineCR = ordineCR;
}
public long getFlgPk() {
return this.flgPk;
}
public void setFlgPk(long flgPk) {
this.flgPk = flgPk;
}
public long getNumColSearch() {
return this.numColSearch;
}
public void setNumColSearch(long numColSearch) {
this.numColSearch = numColSearch;
}
public Vectumerator<TableDesc> findByCR(TableDescCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from TABLE_DESC AS A";
String s_Sql_Order = " order by nomeColonna";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.id_access like '%" + token + "%' )");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return (Vectumerator)findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
public String getComboDescColumnMethod() {
if (getNomeColonna().indexOf("id_") != 0 || getFlgPk() == 1L)
return "";
Access fkAccess = getFkAccess();
String comboDescColumn = fkAccess.getComboDescColumn(getNomeColonna());
if (comboDescColumn != null) {
String theFkBean = getNomeColonna().substring(3, 4).toUpperCase() + getNomeColonna().substring(3, 4).toUpperCase();
String getMethodName = "get" + theFkBean + "()";
if (comboDescColumn.isEmpty())
return getMethodName + ".getDescrizione()";
return getMethodName + ".get" + getMethodName + comboDescColumn.substring(0, 1).toUpperCase() + "()";
}
return "";
}
public String getComboDescColumnFk() {
if (getNomeColonna().indexOf("id_") != 0 || getFlgPk() == 1L)
return "";
Access fkAccess = getFkAccess();
String comboDescColumn = fkAccess.getComboDescColumn(getNomeColonna());
if (comboDescColumn != null)
return comboDescColumn;
return "descrizione";
}
public static final String getFormField(long l_flgFormField) {
switch ((int)l_flgFormField) {
case 6:
return "Ajax search";
case 3:
return "CheckBox";
case 1:
return "ComboBox";
case 2:
return "ComboBox con flg";
case 0:
return "Text";
case 4:
return "Radio Button";
case 5:
return "Text Area";
}
return "??";
}
public final String getFormField() {
return getFormField(getFlgFormField());
}
public void setFlgFormField(long flgFormField) {
this.flgFormField = flgFormField;
}
public static final String getTipo(long l_flgTipo) {
switch ((int)l_flgTipo) {
case 12:
return "Varchar";
case 1:
return "Char";
case -16:
return "Long N Varchar";
case -1:
return "Long Varchar";
case 4:
return "Integer";
case -5:
return "Bigint";
case 5:
return "Smallint";
case 8:
return "Double";
case 3:
return "Decimal";
case 6:
return "Float";
case 91:
return "Data";
case 92:
return "Time";
case 2013:
return "Time with timezone";
case 93:
return "Timestamp";
case 16:
return "Boolean";
}
return "Non Gestito: " + l_flgTipo;
}
public final String getTipo() {
return getTipo(getFlgTipo());
}
public long getFlgReadOnly() {
return this.flgReadOnly;
}
public void setFlgReadOnly(long flgReadOnly) {
this.flgReadOnly = flgReadOnly;
}
public long getTabOrder() {
return this.tabOrder;
}
public void setTabOrder(long tabOrder) {
this.tabOrder = tabOrder;
}
public String getTabName() {
return (this.tabName == null) ? "" : this.tabName.trim();
}
public void setTabName(String tabName) {
this.tabName = tabName;
}
public Vectumerator<TableDesc> findCRFieldsByTable(String l_id_access) {
String s_Sql_Find = "select A.* from TABLE_DESC AS A";
String s_Sql_Order = " order by A.rowNumbCR, A.ordineCR";
WcString wc = new WcString();
wc.addWc("A.id_access='" + l_id_access + "'");
wc.addWc("(A.flgHidden is null or A.flgHidden=0)");
wc.addWc("A.flgCR=1");
wc.addWc("A.rowNumbCR>0");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return (Vectumerator)findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator<TableDesc> findCRListFieldsByTable(String l_id_access) {
String s_Sql_Find = "select A.* from TABLE_DESC AS A";
String s_Sql_Order = " order by A.numColSearch";
WcString wc = new WcString();
wc.addWc("A.id_access='" + l_id_access + "'");
wc.addWc("A.numColSearch>0");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return (Vectumerator)findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
public boolean isFirstField() {
return this.firstField;
}
public void setFirstField(boolean firstField) {
this.firstField = firstField;
}
public String getComboFlgValuelist() {
return (this.comboFlgValuelist == null) ? "" : this.comboFlgValuelist.trim();
}
public void setComboFlgValuelist(String newOptionValues) {
this.comboFlgValuelist = newOptionValues;
}
public String getToolTip() {
return (this.toolTip == null) ? "" : this.toolTip.trim();
}
public void setToolTip(String toolTip) {
this.toolTip = toolTip;
}
public long getFlgHtml() {
return this.flgHtml;
}
public void setFlgHtml(long flgHtml) {
this.flgHtml = flgHtml;
}
public ResParm updateFields(String fieldName, String value) {
if (getId_tableDesc() == 0L)
return new ResParm(false, "Errore! Impossibile aggiornare un bean nuovo.");
long valueL = 0L;
try {
valueL = Long.parseLong(value);
} catch (Exception e) {}
if (fieldName.equals("label")) {
setLabel(value);
} else if (fieldName.equals("ajaxTable")) {
setAjaxTable(value);
} else if (fieldName.equals("flgMandatory")) {
setFlgMandatory(valueL);
} else if (fieldName.equals("flgFormField")) {
setFlgFormField(valueL);
} else if (fieldName.equals("flgHidden")) {
setFlgHidden(valueL);
} else if (fieldName.equals("flgReadOnly")) {
setFlgReadOnly(valueL);
} else if (fieldName.equals("valoreDefaultCR")) {
setValoreDefaultCR(value);
} else if (fieldName.equals("flgHtml")) {
setFlgHtml(valueL);
} else if (fieldName.equals("maxLenght")) {
setMaxLenght(valueL);
} else if (fieldName.equals("comboFlgValuelist")) {
setComboFlgValuelist(value);
} else if (fieldName.equals("ajaxFieldsMapping")) {
setAjaxFieldsMapping(value);
} else if (fieldName.equals("toolTip")) {
setToolTip(value);
} else if (fieldName.equals("ajaxSearchString")) {
setAjaxSearchString(value);
} else if (fieldName.equals("ajaxReturnValues")) {
setAjaxFieldsMapping(value);
} else if (fieldName.equals("flgCR")) {
setFlgCR(valueL);
} else if (fieldName.equals("rowNumb")) {
setRowNumb(valueL);
} else if (fieldName.equals("ordine")) {
setOrdine(valueL);
} else if (fieldName.equals("colLg")) {
setColLg(valueL);
} else if (fieldName.equals("colXs")) {
setColXs(valueL);
} else if (fieldName.equals("rowNumbCR")) {
setRowNumbCR(valueL);
} else if (fieldName.equals("ordineCR")) {
setOrdineCR(valueL);
} else if (fieldName.equals("colLgCR")) {
setColLgCR(valueL);
} else if (fieldName.equals("colXsCR")) {
setColXsCR(valueL);
} else if (fieldName.equals("numColSearch")) {
setNumColSearch(valueL);
}
return save();
}
public long getFlgFormField() {
return this.flgFormField;
}
public long getAjaxNChar() {
return this.ajaxNChar;
}
public void setAjaxNChar(long nChar) {
this.ajaxNChar = nChar;
}
public String getAjaxNextAction() {
return (this.ajaxNextAction == null) ? "" : this.ajaxNextAction.trim();
}
public void setAjaxNextAction(String ajaxNextAction) {
this.ajaxNextAction = ajaxNextAction;
}
public long getFlgAjaxUseSubmit() {
return this.flgAjaxUseSubmit;
}
public void setFlgAjaxUseSubmit(long flgAjaxUseSubmit) {
this.flgAjaxUseSubmit = flgAjaxUseSubmit;
}
public long getFlgAjaxUseMono() {
return this.flgAjaxUseMono;
}
public void setFlgAjaxUseMono(long flgAjaxUseMono) {
this.flgAjaxUseMono = flgAjaxUseMono;
}
public String getAjaxJavascriptmodify() {
return (this.ajaxJavascriptmodify == null) ? "" : this.ajaxJavascriptmodify.trim();
}
public void setAjaxJavascriptmodify(String ajaxJavascriptmodify) {
this.ajaxJavascriptmodify = ajaxJavascriptmodify;
}
public String getAjaxJavascriptnew() {
return (this.ajaxJavascriptnew == null) ? "" : this.ajaxJavascriptnew.trim();
}
public void setAjaxJavascriptnew(String ajaxJavascriptnew) {
this.ajaxJavascriptnew = ajaxJavascriptnew;
}
public Access getFkAccess() {
if (getNomeColonna().indexOf("id_") != 0 || getFlgPk() == 1L)
return new Access(getApFull());
String id_access = Access.convertFieldToTableName(getNomeColonna().substring(3));
Access access = new Access(getApFull());
access.findByPrimaryKey(id_access);
return access;
}
public String getValoreDefaultCR() {
return (this.valoreDefaultCR == null) ? "" : this.valoreDefaultCR.trim();
}
public void setValoreDefaultCR(String valoreDefaultCR) {
this.valoreDefaultCR = valoreDefaultCR;
}
public Vectumerator<TableDesc> findByTabellaDefaultValue(String nomeTabella) {
String s_Sql_Find = "select A.*, if(A.numColSearch is null,9999999999,A.numColSearch) as numColSearchOrder from TABLE_DESC AS A";
String s_Sql_Order = " order by A.flgPk desc,A.nomeColonna";
WcString wc = new WcString();
wc.addWc("A.id_access='" + nomeTabella + "'");
wc.addWc("A.defaultValueCR is not null");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return (Vectumerator)findRows(stmt);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
public long getFlgMandatory() {
return this.flgMandatory;
}
public void setFlgMandatory(long flgMandatory) {
this.flgMandatory = flgMandatory;
}
public String getAjaxTable() {
return (this.ajaxTable == null) ? "" : this.ajaxTable.trim();
}
public void setAjaxTable(String ajaxTable) {
this.ajaxTable = ajaxTable;
}
}

View file

@ -0,0 +1,180 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class TableDescCR extends CRAdapter {
private long id_tableDesc;
private String id_access;
private String nomeColonna;
private String lebel;
private long flgTipo;
private long flgCR;
private long ordine;
private long rowNumb;
private long colLg;
private long colXs;
private String optionValues;
private String comboDescColumn;
private String ajaxSearchString;
private String ajaxReturnValues;
public static final long SEARCH_TYPE_ELENCO_COLONNE = 0L;
public static final long SEARCH_TYPE_VISTA_CR = 1L;
public static final long SEARCH_TYPE_VISTA_CR_LISTA = 2L;
public static final long SEARCH_TYPE_VISTA_DETTAGLIO = 3L;
private Access access;
public TableDescCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TableDescCR() {}
public void setId_tableDesc(long newId_tableDesc) {
this.id_tableDesc = newId_tableDesc;
}
public void setId_access(String newId_access) {
this.id_access = newId_access;
setAccess(null);
}
public void setNomeColonna(String newNomeColonna) {
this.nomeColonna = newNomeColonna;
}
public void setLebel(String newLebel) {
this.lebel = newLebel;
}
public void setFlgTipo(long newFlgTipo) {
this.flgTipo = newFlgTipo;
}
public void setFlgCR(long newFlgCR) {
this.flgCR = newFlgCR;
}
public void setOrdine(long newOrdine) {
this.ordine = newOrdine;
}
public void setRowNumb(long newRowNumb) {
this.rowNumb = newRowNumb;
}
public void setColLg(long newColLg) {
this.colLg = newColLg;
}
public void setColXs(long newColXs) {
this.colXs = newColXs;
}
public void setOptionValues(String newOptionValues) {
this.optionValues = newOptionValues;
}
public void setComboDescColumn(String newComboDescColumn) {
this.comboDescColumn = newComboDescColumn;
}
public void setAjaxSearchString(String newAjaxSearchString) {
this.ajaxSearchString = newAjaxSearchString;
}
public void setAjaxReturnValues(String newAjaxReturnValues) {
this.ajaxReturnValues = newAjaxReturnValues;
}
public long getId_tableDesc() {
return this.id_tableDesc;
}
public String getId_access() {
return (this.id_access == null) ? "" : this.id_access.trim();
}
public String getNomeColonna() {
return (this.nomeColonna == null) ? "" : this.nomeColonna.trim();
}
public String getLebel() {
return (this.lebel == null) ? "" : this.lebel.trim();
}
public long getFlgTipo() {
return this.flgTipo;
}
public long getFlgCR() {
return this.flgCR;
}
public long getOrdine() {
return this.ordine;
}
public long getRowNumb() {
return this.rowNumb;
}
public long getColLg() {
return this.colLg;
}
public long getColXs() {
return this.colXs;
}
public String getOptionValues() {
return (this.optionValues == null) ? "" : this.optionValues.trim();
}
public String getComboDescColumn() {
return (this.comboDescColumn == null) ? "" : this.comboDescColumn.trim();
}
public String getAjaxSearchString() {
return (this.ajaxSearchString == null) ? "" : this.ajaxSearchString.trim();
}
public String getAjaxReturnValues() {
return (this.ajaxReturnValues == null) ? "" : this.ajaxReturnValues.trim();
}
public void setAccess(Access newAccess) {
this.access = newAccess;
}
public Access getAccess() {
this.access = (Access)getSecondaryObject(this.access, Access.class, getId_access());
return this.access;
}
public final String getTipo() {
return TableDesc.getTipo(getFlgTipo());
}
public static final String getTipo(long l_flgTipo) {
return TableDesc.getTipo(l_flgTipo);
}
}

View file

@ -0,0 +1,35 @@
package it.acxent.common;
import it.acxent.util.Vectumerator;
public interface TipoInterface {
Vectumerator findFigli(int paramInt1, int paramInt2);
long getNumeroFigli(long paramLong);
long getId_tipoPadre();
String getDescrizione();
String getDescrizioneCompleta();
String getDescrizione4Script();
long getFlgUsaVarianti();
long getId_tipo();
String getDescrizione(String paramString);
String getDescrizione4Script(String paramString);
String getDescrizioneCompleta(String paramString);
String getDescrizione(String paramString, int paramInt);
String getDescrizione(String paramString1, String paramString2);
String getDescrizione(String paramString1, String paramString2, int paramInt);
String getDescrizione(int paramInt);
}

View file

@ -0,0 +1,70 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class TipoPostazione extends DBAdapter implements Serializable {
private long id_tipoPostazione;
private String descrizione;
public TipoPostazione(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TipoPostazione() {}
public void setId_tipoPostazione(long newId_tipoAzienda) {
this.id_tipoPostazione = newId_tipoAzienda;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public long getId_tipoPostazione() {
return this.id_tipoPostazione;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator<TipoPostazione> findByCR(TipoPostazioneCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from TIPO_POSTAZIONE AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return (Vectumerator)findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return (Vectumerator)AB_EMPTY_VECTUMERATOR;
}
}
}

View file

@ -0,0 +1,32 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class TipoPostazioneCR extends CRAdapter {
private long id_tipoPostazione;
private String descrizione;
public TipoPostazioneCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public TipoPostazioneCR() {}
public void setId_tipoPostazione(long newId_tipoAzienda) {
this.id_tipoPostazione = newId_tipoAzienda;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public long getId_tipoPostazione() {
return this.id_tipoPostazione;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione;
}
}

View file

@ -0,0 +1,176 @@
package it.acxent.common;
import com.lowagie.text.Font;
import com.lowagie.text.pdf.BaseFont;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.util.Vectumerator;
import java.awt.Color;
import java.io.File;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Hashtable;
public class TtFont extends DBAdapter {
private String ttfName;
private String ttfPath;
private Parm parm;
private static Hashtable fonts;
private static final Font PDF_f_Default = new Font(2, 10.0F, 0);
private static final int PDF_fsize_Default = 10;
private static TtFont ttFontInstance;
static final String WIN_DEFAULT_TTF_PATH = "C:/windows/fonts/";
private TtFont() {}
private TtFont(ApplParmFull newApplParmFull) {
setApFull(newApplParmFull);
}
public ResParm delete() {
return null;
}
public Vectumerator findAll() {
int numRec = 0;
File dir = new File(getTtfPath());
File[] fonts = dir.listFiles();
if (fonts != null) {
Arrays.sort(fonts);
File theFont = null;
Vectumerator<TtFont> vec = new Vectumerator();
try {
for (File font : fonts) {
theFont = font;
if (theFont.getName().toLowerCase().endsWith("ttf")) {
numRec++;
TtFont myBean = new TtFont(getApFull());
myBean.setTtfName(theFont.getName());
vec.addElement(myBean);
}
}
vec.setTotNumberOfRecords(numRec);
return vec;
} catch (Exception e) {
e.printStackTrace();
return DBAdapter.AB_EMPTY_VECTUMERATOR;
}
}
return DBAdapter.AB_EMPTY_VECTUMERATOR;
}
public void findByPrimaryKey(Object obj) {}
public int getDBState() {
return 1;
}
public String getTtfPath() {
return getDocBase() + "admin/_V4/_font/";
}
public ResParm save() {
return null;
}
public void setNuovaIstanzaOggettoRemoto(boolean flag) {}
public Object[] getFieldSetArg(String parmValue, Class type) {
return null;
}
public void setTtfPath(String ttfPath) {
this.ttfPath = ttfPath;
}
public String getTtfName() {
return this.ttfName;
}
public void setTtfName(String ttfName) {
this.ttfName = ttfName;
}
public String getTtf() {
return getTtfPath() + getTtfPath();
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Parm getParm(String theKey) {
if (this.parm == null)
this.parm = new Parm(getApFull());
try {
this.parm.findByCodice(theKey);
return this.parm;
} catch (Exception e) {
handleDebug(e);
return this.parm;
}
}
public Font getFont(String baseFont, int size, int type, Color theColor) {
Long fontKey = new Long((long)(baseFont.hashCode() + size + type + ((theColor == null) ? 0 : theColor.hashCode())));
if (!getFonts().containsKey(fontKey))
try {
Font ft;
if (baseFont.isEmpty()) {
ft = PDF_f_Default;
} else {
BaseFont bf = BaseFont.createFont(baseFont, "Identity-H", true);
int fontSize = size;
if (fontSize <= 0)
fontSize = 10;
if (theColor == null) {
ft = new Font(bf, (float)fontSize, type, Color.black);
} else {
ft = new Font(bf, (float)fontSize, type, theColor);
}
}
getFonts().put(fontKey, ft);
return ft;
} catch (Exception e) {
e.printStackTrace();
return PDF_f_Default;
}
return (Font)getFonts().get(fontKey);
}
protected boolean isDatabaseBean() {
return false;
}
public static synchronized TtFont getInstance(ApplParmFull ap) {
if (ttFontInstance == null)
ttFontInstance = new TtFont(ap);
return ttFontInstance;
}
public static synchronized void reset() {
Enumeration<Font> enu = getFonts().elements();
while (enu.hasMoreElements()) {
Font row = enu.nextElement();
getFonts().remove(row);
row = null;
}
fonts = null;
}
private static Hashtable getFonts() {
if (fonts == null)
fonts = new Hashtable();
return fonts;
}
}

View file

@ -0,0 +1,119 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
public class UserAccess extends DBAdapter implements Serializable {
private long flgRW;
private String id_access;
private long id_userAccess;
private Access access;
private Users users;
private long id_users;
public Vectumerator findAccesssByUser(long l_id_user, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from USER_ACCESS AS A, ACCESS AS B";
String s_Sql_Order = " order by B.descrizione";
WcString wc = new WcString();
wc.addWc("A.id_access =B.id_access");
wc.addWc("A.id_users =" + l_id_user);
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (Exception e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public UserAccess() {}
public UserAccess(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public long getFlgRW() {
return this.flgRW;
}
public String getRW() {
return DBAdapter.getRW(getFlgRW());
}
public String getId_access() {
return (this.id_access == null) ? "" : this.id_access;
}
public long getId_users() {
return this.id_users;
}
public Access getAccess() {
this.access = (Access)getSecondaryObject(this.access, Access.class, getId_access());
return this.access;
}
public Users getUsers() {
this.users = (Users)getSecondaryObject(this.users, Users.class, new Long(getId_users()));
return this.users;
}
public void setFlgRW(long newFlgRW) {
this.flgRW = newFlgRW;
}
public void setId_access(String newId_access) {
this.id_access = newId_access;
setAccess(null);
}
public void setId_users(long newId_user) {
this.id_users = newId_user;
setUsers(null);
}
public void setAccess(Access newAccess) {
this.access = newAccess;
}
public void setUsers(Users newUser) {
this.users = newUser;
}
public long getId_userAccess() {
return this.id_userAccess;
}
public void setId_userAccess(long id_userAccess) {
this.id_userAccess = id_userAccess;
}
public void findByUserAccess(long l_id_user, String l_id_access) {
String s_Sql_Find = "select A.* from USER_ACCESS AS A";
WcString wc = new WcString();
wc.addWc("A.id_users =" + l_id_user);
wc.addWc("A.id_access ='" + l_id_access + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
findFirstRecord(stmt);
} catch (Exception e) {
handleDebug(e);
}
}
}

View file

@ -0,0 +1,167 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class UserAccessGroup extends DBAdapter implements Serializable {
private long id_userAccessGroup;
private long id_accessGroup;
private long id_users;
private AccessGroup accessGroup;
private Users users;
public UserAccessGroup(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public UserAccessGroup() {}
public void setId_userAccessGroup(long newId_userAccessGroup) {
this.id_userAccessGroup = newId_userAccessGroup;
}
public void setId_accessGroup(long newId_accessGroup) {
this.id_accessGroup = newId_accessGroup;
setAccessGroup(null);
}
public void setId_users(long newId_users) {
this.id_users = newId_users;
setUsers(null);
}
public long getId_userAccessGroup() {
return this.id_userAccessGroup;
}
public long getId_accessGroup() {
return this.id_accessGroup;
}
public long getId_users() {
return this.id_users;
}
public void setAccessGroup(AccessGroup newAccessGroup) {
this.accessGroup = newAccessGroup;
}
public AccessGroup getAccessGroup() {
this.accessGroup = (AccessGroup)getSecondaryObject((DBAdapter)this.accessGroup, AccessGroup.class,
getId_accessGroup());
return this.accessGroup;
}
public void setUsers(Users newUsers) {
this.users = newUsers;
}
public Users getUsers() {
this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users());
return this.users;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator findByCR(UserAccessGroupCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from USER_ACCESS_GROUP AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.descrizione like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find +
wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator findByUser(long l_id_user, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from USER_ACCESS_GROUP AS A, USERS as B, ACCESS_GROUP AS C";
String s_Sql_Order = " order by C.descrizione, B.cognome, B.nome";
WcString wc = new WcString();
wc.addWc("A.id_users =B.id_users");
wc.addWc("A.id_accessGroup =C.id_accessGroup");
wc.addWc("A.id_users =" + l_id_user);
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc));
return findRows(stmt, pageNumber, pageRows);
} catch (Exception e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator findByAccessGroup(long l_id_accessGroup, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from USER_ACCESS_GROUP AS A, USERS AS B, ACCESS_GROUP AS C";
String s_Sql_Order = " order by C.descrizione, B.cognome, B.nome";
WcString wc = new WcString();
wc.addWc("A.id_users =B.id_users");
wc.addWc("A.id_accessGroup=C.id_accessGroup");
wc.addWc("A.id_accessGroup =" + l_id_accessGroup);
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc));
return findRows(stmt, pageNumber, pageRows);
} catch (Exception e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findByAccessGroupUser(long l_id_accessGroup, long l_id_user) {
String s_Sql_Find = "select A.* from USER_ACCESS_GROUP AS A";
String wc = "";
wc = buildWc(wc, "A.id_users =" + l_id_user);
wc = buildWc(wc, "A.id_accessGroup =" + l_id_accessGroup);
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
findFirstRecord(stmt);
} catch (Exception e) {
handleDebug(e);
}
}
public void findByAccessUser(String l_id_access, long l_id_user) {
String s_Sql_Find = "select A.* from USER_ACCESS_GROUP AS A, ACCESS_GROUP_ACCESS AS B, ACCESS AS C";
String s_Sql_Order = " order by C.descrizione";
WcString wc = new WcString();
wc.addWc("A.id_accessGroup =B.id_accessGroup");
wc.addWc("B.id_access=C.id_access");
wc.addWc("A.id_users =" + l_id_user);
wc.addWc("B.id_access ='" + l_id_access + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc));
findFirstRecord(stmt);
} catch (Exception e) {
handleDebug(e);
}
}
}

View file

@ -0,0 +1,71 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
import it.acxent.db.DBAdapter;
public class UserAccessGroupCR extends CRAdapter {
private long id_userAccessGroup;
private long id_accessGroup;
private long id_users;
private AccessGroup accessGroup;
private Users users;
public UserAccessGroupCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public UserAccessGroupCR() {}
public void setId_userAccessGroup(long newId_userAccessGroup) {
this.id_userAccessGroup = newId_userAccessGroup;
}
public void setId_accessGroup(long newId_accessGroup) {
this.id_accessGroup = newId_accessGroup;
setAccessGroup(null);
}
public void setId_users(long newId_users) {
this.id_users = newId_users;
setUsers(null);
}
public long getId_userAccessGroup() {
return this.id_userAccessGroup;
}
public long getId_accessGroup() {
return this.id_accessGroup;
}
public long getId_users() {
return this.id_users;
}
public void setAccessGroup(AccessGroup newAccessGroup) {
this.accessGroup = newAccessGroup;
}
public AccessGroup getAccessGroup() {
this.accessGroup = (AccessGroup)getSecondaryObject((DBAdapter)this.accessGroup, AccessGroup.class,
getId_accessGroup());
return this.accessGroup;
}
public void setUsers(Users newUsers) {
this.users = newUsers;
}
public Users getUsers() {
this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class,
getId_users());
return this.users;
}
}

View file

@ -0,0 +1,154 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.util.Hashtable;
import java.util.StringTokenizer;
public class UserProfile extends DBAdapter implements Serializable {
private static final long serialVersionUID = 7761376941380158250L;
public static final long TIPO_CLIENTE = 10L;
public static final long TIPO_FORNITORE = 20L;
private long id_userProfile;
private String descrizione;
private String policy;
public UserProfile() {}
public UserProfile(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
public boolean checkRights(long l_id_profiloUtente) {
if (getPolicy().equals("*"))
return true;
StringTokenizer st = new StringTokenizer(getPolicy(), ",");
while (st.hasMoreTokens()) {
if (l_id_profiloUtente == Long.parseLong(st.nextToken()))
return true;
}
return false;
}
protected void deleteCascade() {}
public void fillObject(Hashtable htable) {}
public Vectumerator findProfiles(String l_listaProfili) {
String s_Sql_Find = "select A.* from USER_PROFILE AS A";
String wc = "";
if (l_listaProfili.equals("#")) {
wc = " where id_userProfile is null";
} else if (!l_listaProfili.equals("*")) {
StringTokenizer st = new StringTokenizer(l_listaProfili, ",");
while (st.hasMoreTokens()) {
if (!wc.isEmpty()) {
wc = wc + " or id_userProfile=" + wc;
continue;
}
wc = " where id_userProfile=" + st.nextToken();
}
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
return findRows(stmt);
} catch (Exception e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator findUserProfiles() {
String s_Sql_Find = "select A.* from USER_PROFILE AS A";
String wc = " where id_userProfile !=1";
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
return findRows(stmt);
} catch (Exception e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator findUserProfiles(String policy) {
String s_Sql_Find = "select A.* from USER_PROFILE AS A";
String wc = "";
wc = managePolicyFind(policy, wc);
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find);
return findRows(stmt);
} catch (Exception e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione;
}
public long getId_userProfile() {
return this.id_userProfile;
}
public String getPolicy() {
if (getId_userProfile() == 1L)
return "*";
return (this.policy == null) ? "#" : this.policy;
}
protected String managePolicyFind(String policy, String l_wc) {
if (policy.equals("#") || policy.isEmpty()) {
l_wc = buildWc(l_wc, "A.id_userProfile is null");
} else if (!policy.equals("*")) {
StringTokenizer st = new StringTokenizer(policy, ",");
String l_wcOr = "";
while (st.hasMoreTokens()) {
if (!l_wcOr.isEmpty()) {
l_wcOr = l_wcOr + " or id_userProfile=" + l_wcOr;
continue;
}
l_wcOr = " id_userProfile=" + st.nextToken();
}
l_wc = buildWc(l_wc, "(" + l_wcOr + ")");
}
return l_wc;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setId_userProfile(long newId_profiloUtente) {
this.id_userProfile = newId_profiloUtente;
}
public void setPolicy(String newPolicy) {
this.policy = newPolicy;
}
protected void setPrimaryKey(long newPrimaryKey) {
setId_userProfile(newPrimaryKey);
}
protected boolean isUseSafeUpdate() {
return true;
}
public Vectumerator findByCR(UserProfileCR CR, int pageNumber, int pageRows) {
return findAll();
}
}

View file

@ -0,0 +1,22 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class UserProfileCR extends CRAdapter {
private String descrizioneS;
public UserProfileCR() {}
public UserProfileCR(ApplParmFull newAp) {
super(newAp);
}
public String getDescrizioneS() {
return (this.descrizioneS == null) ? AB_EMPTY_STRING : this.descrizioneS.trim();
}
public void setDescrizioneS(String descrizioneS) {
this.descrizioneS = descrizioneS;
}
}

View file

@ -0,0 +1,109 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class UserWhitelist extends DBAdapter implements Serializable {
private long id_userWhitelist;
private long id_whitelist;
private long id_users;
private Whitelist whitelist;
private Users users;
public UserWhitelist(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public UserWhitelist() {}
public void setId_userWhitelist(long newId_usersWhitelist) {
this.id_userWhitelist = newId_usersWhitelist;
}
public void setId_whitelist(long newId_whitelist) {
this.id_whitelist = newId_whitelist;
setWhitelist(null);
}
public void setId_users(long newId_users) {
this.id_users = newId_users;
setUsers(null);
}
public long getId_userWhitelist() {
return this.id_userWhitelist;
}
public long getId_whitelist() {
return this.id_whitelist;
}
public long getId_users() {
return this.id_users;
}
public void setWhitelist(Whitelist newWhitelist) {
this.whitelist = newWhitelist;
}
public Whitelist getWhitelist() {
this.whitelist = (Whitelist)getSecondaryObject((DBAdapter)this.whitelist, Whitelist.class,
getId_whitelist());
return this.whitelist;
}
public void setUsers(Users newUsers) {
this.users = newUsers;
}
public Users getUsers() {
this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class,
getId_users());
return this.users;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator findByCR(UserWhitelistCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from USERS_WHITELIST AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
}

View file

@ -0,0 +1,71 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
import it.acxent.db.DBAdapter;
public class UserWhitelistCR extends CRAdapter {
private long id_userWhitelist;
private long id_whitelist;
private long id_users;
private Whitelist whitelist;
private Users users;
public UserWhitelistCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public UserWhitelistCR() {}
public void setId_userWhitelist(long newId_usersWhitelist) {
this.id_userWhitelist = newId_usersWhitelist;
}
public void setId_whitelist(long newId_whitelist) {
this.id_whitelist = newId_whitelist;
setWhitelist(null);
}
public void setId_users(long newId_users) {
this.id_users = newId_users;
setUsers(null);
}
public long getId_userWhitelist() {
return this.id_userWhitelist;
}
public long getId_whitelist() {
return this.id_whitelist;
}
public long getId_users() {
return this.id_users;
}
public void setWhitelist(Whitelist newWhitelist) {
this.whitelist = newWhitelist;
}
public Whitelist getWhitelist() {
this.whitelist = (Whitelist)getSecondaryObject((DBAdapter)this.whitelist, Whitelist.class,
getId_whitelist());
return this.whitelist;
}
public void setUsers(Users newUsers) {
this.users = newUsers;
}
public Users getUsers() {
this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class,
getId_users());
return this.users;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,176 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class UsersCR extends CRAdapter {
private String flgValido;
private boolean code1 = false;
private long id_userProfile;
private String policy;
private UserProfile userProfile;
private String txtRicerca;
private String cognome;
private String eMail;
private String login;
private String nome;
private long flgPresenza = -1L;
private String codFisc;
private long flgMl = -1L;
private long flgControlCode = -1L;
private long id_usersS;
public UsersCR() {}
public UsersCR(Users theUser) {
setPolicy(theUser.getUserProfile().getPolicy());
}
public UsersCR(ApplParmFull newAp) {
setApFull(newAp);
}
public UsersCR(ApplParmFull newAp, Users theUser) {
setApFull(newAp);
setPolicy(theUser.getUserProfile().getPolicy());
}
public String getFlgValido() {
return (this.flgValido == null) ? "" : this.flgValido;
}
public long getId_userProfile() {
return this.id_userProfile;
}
public String getPolicy() {
return (this.policy == null) ? AB_EMPTY_STRING : this.policy;
}
public UserProfile getUserProfile() {
if (this.userProfile == null && getId_userProfile() != 0L)
try {
this.userProfile = new UserProfile(getApFull());
this.userProfile.findByPrimaryKey(new Long(getId_userProfile()));
} catch (Exception e) {}
return (this.userProfile == null) ? new UserProfile() : this.userProfile;
}
public String getTxtRicerca() {
return (this.txtRicerca == null) ? "" : this.txtRicerca;
}
public void setFlgValido(String newFlgValido) {
this.flgValido = newFlgValido;
}
public void setId_userProfile(long newId_profiloUtente) {
this.id_userProfile = newId_profiloUtente;
}
public void setPolicy(String newPolicy) {
this.policy = newPolicy;
}
public void setUserProfile(UserProfile newProfiloUtente) {
this.userProfile = newProfiloUtente;
}
public void setTxtRicerca(String newTxtRicerca) {
this.txtRicerca = newTxtRicerca;
}
public boolean isCode1() {
return this.code1;
}
public void setCode1(boolean code1) {
this.code1 = code1;
}
public String getCognome() {
return (this.cognome == null) ? AB_EMPTY_STRING : this.cognome;
}
public void setCognome(String cognome) {
this.cognome = cognome;
}
public String getEMail() {
return (this.eMail == null) ? AB_EMPTY_STRING : this.eMail;
}
public void setEMail(String mail) {
this.eMail = mail;
}
public String getLogin() {
return (this.login == null) ? AB_EMPTY_STRING : this.login;
}
public void setLogin(String login) {
this.login = login;
}
public String getNome() {
return (this.nome == null) ? AB_EMPTY_STRING : this.nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public long getFlgPresenza() {
return this.flgPresenza;
}
public void setFlgPresenza(long flgPresenza) {
this.flgPresenza = flgPresenza;
}
public String getCodFisc() {
return (this.codFisc == null) ? AB_EMPTY_STRING : this.codFisc.trim();
}
public void setCodFisc(String codFisc) {
this.codFisc = codFisc;
}
public long getFlgMl() {
return this.flgMl;
}
public void setFlgMl(long flgMl) {
this.flgMl = flgMl;
}
public long getFlgControlCode() {
return this.flgControlCode;
}
public void setFlgControlCode(long flgControlCode) {
this.flgControlCode = flgControlCode;
}
public long getId_usersS() {
return this.id_usersS;
}
public void setId_usersS(long id_usersS) {
this.id_usersS = id_usersS;
}
}

View file

@ -0,0 +1,72 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DbInterface;
import it.acxent.pre.Presenza;
import java.util.Hashtable;
public interface UsersI extends DbInterface {
String getChangeLog();
long getId_userProfile();
long getFlgPresenza();
Presenza getUltimoMovimento();
long getNextMovValido();
String getCognomeNome();
String getCognomeNomeSigla();
String getDescrizione();
String getCognome();
String getCognomeSigla();
String getNome();
String getNomeSigla();
UserProfile getUserProfile();
void initApplicationParms(ApplParmFull paramApplParmFull);
long getGrantType(String paramString);
long getGrantType(String paramString, boolean paramBoolean);
String translate(String paramString1, String paramString2);
long getId_users();
long getFlgChangeLog();
void resetChangeLog();
PostazioneI getPostazione();
String getScadenzaPasswordMessage();
long getGiorniAScadenzaPassword();
long getFlgSuper();
Hashtable<String, Long> getHtAccess();
String getImgFileName(int paramInt);
String getLogin();
String getLang();
boolean isSocialAccount();
String getSocialIdType();
boolean hasStatusMsg();
String getCurrentHost();
}

View file

@ -0,0 +1,81 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class Whitelist extends DBAdapter implements Serializable {
private long id_whitelist;
private String descrizione;
private String ipAddress;
public Whitelist(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public Whitelist() {}
public void setId_whitelist(long newId_whitelist) {
this.id_whitelist = newId_whitelist;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setIpAddress(String newIpAddress) {
this.ipAddress = newIpAddress;
}
public long getId_whitelist() {
return this.id_whitelist;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public String getIpAddress() {
return (this.ipAddress == null) ? "" : this.ipAddress.trim();
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator findByCR(WhitelistCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from WHITELIST AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
}

View file

@ -0,0 +1,42 @@
package it.acxent.common;
import it.acxent.db.ApplParmFull;
import it.acxent.db.CRAdapter;
public class WhitelistCR extends CRAdapter {
private long id_whitelist;
private String descrizione;
private String ipAddress;
public WhitelistCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public WhitelistCR() {}
public void setId_whitelist(long newId_whitelist) {
this.id_whitelist = newId_whitelist;
}
public void setDescrizione(String newDescrizione) {
this.descrizione = newDescrizione;
}
public void setIpAddress(String newIpAddress) {
this.ipAddress = newIpAddress;
}
public long getId_whitelist() {
return this.id_whitelist;
}
public String getDescrizione() {
return (this.descrizione == null) ? "" : this.descrizione.trim();
}
public String getIpAddress() {
return (this.ipAddress == null) ? "" : this.ipAddress.trim();
}
}

View file

@ -0,0 +1,17 @@
package it.acxent.db;
public interface AddImgInterface {
String getPathImg();
String getImgFileName(int paramInt);
String getImgFileName(int paramInt, String paramString);
String getImgTmst();
void setImgTmst(String paramString);
ResParm save();
void findByPrimaryKey(long paramLong);
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,497 @@
package it.acxent.db;
import it.acxent.common.Parm;
import it.acxent.common.Users;
import it.acxent.reg.EcDc;
import it.acxent.util.SimpleDateFormat;
import java.io.Serializable;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.Time;
import java.sql.Timestamp;
import java.text.NumberFormat;
import java.util.Locale;
import java.util.Properties;
import javax.servlet.ServletContext;
public class ApplParmFull implements Serializable {
private static final long serialVersionUID = 5716730193350553875L;
private ApplParm ap;
private long lastUpdId_user;
private String reqIpAddress;
private Users lastUpdUser;
private String reqUrl;
private String msg;
public ApplParmFull(ApplParm applParm, long lastUpdId_user, String reqIpAddress, String reqUrl) {
this.ap = applParm;
this.lastUpdId_user = lastUpdId_user;
this.reqIpAddress = reqIpAddress;
this.reqUrl = reqUrl;
}
public long getLastUpdId_user() {
return this.lastUpdId_user;
}
public void setLastUpdId_user(long lastUpdId_user) {
this.lastUpdId_user = lastUpdId_user;
setLastUpdUser(null);
}
public String getReqIpAddress() {
return (this.reqIpAddress == null) ? "" : this.reqIpAddress.trim();
}
public void setReqIpAddress(String reqIpAddress) {
this.reqIpAddress = reqIpAddress;
}
public ApplParmFull() {}
public ApplParmFull(ApplParm applParm) {
this.ap = applParm;
}
public ApplParm getAp() {
return this.ap;
}
public void setAp(ApplParm applParm) {
this.ap = applParm;
}
public Parm getParm(String theKey) {
return getAp().getParm(theKey);
}
public int getParmValue(String theKey, int defaultValue) {
Parm parm = getParm(theKey);
if (parm == null || parm.getId_parm() == 0L)
return defaultValue;
return parm.getNumeroInt();
}
public long getParmValue(String theKey, long defaultValue) {
Parm parm = getParm(theKey);
if (parm == null || parm.getId_parm() == 0L)
return defaultValue;
return parm.getNumeroLong();
}
public double getParmValue(String theKey, double defaultValue) {
Parm parm = getParm(theKey);
if (parm == null || parm.getId_parm() == 0L)
return defaultValue;
return parm.getNumeroDouble();
}
public String getParmValue(String theKey, String defaultValue) {
Parm parm = getParm(theKey);
if (parm == null || parm.getId_parm() == 0L)
return defaultValue;
return parm.getTesto();
}
public boolean getParmValue(String theKey, boolean defaultValue) {
Parm parm = getParm(theKey);
if (parm == null || parm.getId_parm() == 0L)
return defaultValue;
return (parm.getNumeroLong() != 0L);
}
public Date getParmValue(String theKey, Date defaultValue) {
Parm parm = getParm(theKey);
if (parm == null || parm.getId_parm() == 0L)
return defaultValue;
return parm.getDataParm();
}
public Time getParmValue(String theKey, Time defaultValue) {
Parm parm = getParm(theKey);
if (parm == null || parm.getId_parm() == 0L)
return defaultValue;
return parm.getOra();
}
public Timestamp getParmValue(String theKey, Timestamp defaultValue) {
Parm parm = getParm(theKey);
if (parm == null || parm.getId_parm() == 0L)
return defaultValue;
return parm.getTimeStamp();
}
public String getApCode() {
return getAp().getApCode();
}
public int hashCode() {
return this.ap.hashCode();
}
public void handleDebug(Exception exception) {
this.ap.handleDebug(exception);
}
public void handleDebug(Exception exception, int logLevel) {
this.ap.handleDebug(exception, logLevel);
}
public void handleDebug(PreparedStatement ps) {
this.ap.handleDebug(ps);
}
public void handleDebug(PreparedStatement ps, int logLevel) {
this.ap.handleDebug(ps, logLevel);
}
public void handleDebug(String s) {
this.ap.handleDebug(s);
}
public void handleDebug(String s, int logLevel) {
this.ap.handleDebug(s, logLevel);
}
public String getApCode(DBAdapter obj) {
return this.ap.getApCode(obj);
}
public void setDebug(boolean flag) {
this.ap.setDebug(flag);
}
public void setDebugLevel(int i) {
this.ap.setDebugLevel(i);
}
public void writeLog(String msg) {
this.ap.writeLog(msg);
}
public String getApDescription() {
return this.ap.getApDescription();
}
public int getConnectionLifeTime() {
return this.ap.getConnectionLifeTime();
}
public String getConnectionString() {
return this.ap.getConnectionString();
}
public String getDatabase() {
return this.ap.getDatabase();
}
public String getCatalog() {
return this.ap.getCatalog();
}
public SimpleDateFormat getDataFormat() {
return this.ap.getDataFormat();
}
public String toString() {
return this.ap.toString();
}
public Properties getDbEnvironProperty() {
return this.ap.getDbEnvironProperty();
}
public String getDbAtinavpasswd() {
return this.ap.getDbAtinavpasswd();
}
public int getDbType() {
return this.ap.getDbType();
}
public boolean getDebug() {
return this.ap.getDebug();
}
public String getDebugFile() {
return this.ap.getDebugFile();
}
public int getDebugLevel() {
return this.ap.getDebugLevel();
}
public String getDefaultLangCode() {
return this.ap.getDefaultLangCode();
}
public String getDriverManager() {
return this.ap.getDriverManager();
}
public int getInitialCons() {
return this.ap.getInitialCons();
}
public String getLangCode() {
return this.ap.getLangCode();
}
public Locale getLocale() {
return this.ap.getLocale();
}
public int getMaxConnectionHits() {
return this.ap.getMaxConnectionHits();
}
public int getMaxCons() {
return this.ap.getMaxCons();
}
public String getMdwpath() {
return this.ap.getMdwpath();
}
public NumberFormat getNf() {
return this.ap.getNf();
}
public String getPassword() {
return this.ap.getPassword();
}
public String getPropertyFileName() {
return this.ap.getPropertyFileName();
}
public String getResource(String key) {
return this.ap.getResource(key);
}
public String getPropertyFile() {
return this.ap.getPropertyFile();
}
public void setPropertyFile(String propertyFile) {
this.ap.setPropertyFile(propertyFile);
}
public final String getSoftwareVersion() {
return this.ap.getSoftwareVersion();
}
public String getResourceFromPropertyFile(String key) {
return this.ap.getResourceFromPropertyFile(key);
}
public final String getSoftwareVersionLog() {
return this.ap.getSoftwareVersionLog();
}
public SimpleDateFormat getTimeFormat() {
return this.ap.getTimeFormat();
}
public int getTimeout() {
return this.ap.getTimeout();
}
public String getUrl() {
return this.ap.getUrl();
}
public String getUser() {
return this.ap.getUser();
}
public boolean isBlock() {
return this.ap.isBlock();
}
public boolean isReuseCons() {
return this.ap.isReuseCons();
}
public void setApCode(String newApCode) {
this.ap.setApCode(newApCode);
}
public void setBlock(boolean block) {
this.ap.setBlock(block);
}
public void setConnectionLifeTime(int l_connectionLifeTime) {
this.ap.setConnectionLifeTime(l_connectionLifeTime);
}
public void setDatabase(String s) {
this.ap.setDatabase(s);
}
public void setDbEnvironProperty(Properties newDbEnvironProperty) {
this.ap.setDbEnvironProperty(newDbEnvironProperty);
}
public void setDbAtinavpasswd(String dbpasswd) {
this.ap.setDbAtinavpasswd(dbpasswd);
}
public void setDbType(int newDbType) {
this.ap.setDbType(newDbType);
}
public void setDebugFile(String string) {
this.ap.setDebugFile(string);
}
public void setInitialCons(int i) {
this.ap.setInitialCons(i);
}
public void setLangCode(String newLangCode) {
this.ap.setLangCode(newLangCode);
}
public void setMaxConnectionHits(int maxConnectionHits) {
this.ap.setMaxConnectionHits(maxConnectionHits);
}
public void setMaxCons(int i) {
this.ap.setMaxCons(i);
}
public void setMdwpath(String mdwpath) {
this.ap.setMdwpath(mdwpath);
}
public void setPassword(String s) {
this.ap.setPassword(s);
}
public void setPropertyFileName(String newPropertyFileName) {
this.ap.setPropertyFileName(newPropertyFileName);
}
public void setReuseCons(boolean reuseCons) {
this.ap.setReuseCons(reuseCons);
}
public void setTimeout(int i) {
this.ap.setTimeout(i);
}
public void setUser(String s) {
this.ap.setUser(s);
}
public RewriteRule getRewriteRule(String theCode) {
return this.ap.getRewriteRule(theCode);
}
public void resetCurrentApParms() {
this.ap.resetCurrentApParms();
}
public String translate(String sentence, String l_lang) {
return this.ap.translate(sentence, l_lang);
}
public String translate(String sentenceKeyH, String sentence, String l_lang) {
return this.ap.translate(sentenceKeyH, sentence, l_lang);
}
public NumberFormat getNf0() {
return this.ap.getNf0();
}
public NumberFormat getNf2() {
return this.ap.getNf2();
}
public NumberFormat getNf3() {
return this.ap.getNf3();
}
public String getConnectionsCreateTs() {
return this.ap.getConnectionsCreateTs();
}
public NumberFormat getNf4() {
return this.ap.getNf4();
}
public NumberFormat getNf1() {
return this.ap.getNf1();
}
public SimpleDateFormat getTimestampFormat() {
return this.ap.getTimestampFormat();
}
public Parm getParmNoHt(String theKey) {
return this.ap.getParmNoHt(theKey);
}
public Users getLastUpdUser() {
if (this.lastUpdUser == null && getLastUpdId_user() > 0L) {
this.lastUpdUser = new Users(this);
this.lastUpdUser.findByPrimaryKey(getLastUpdId_user());
}
return (this.lastUpdUser == null) ? new Users(this) : this.lastUpdUser;
}
public void setLastUpdUser(Users lastUpdUser) {
this.lastUpdUser = lastUpdUser;
}
public String getReqUrl() {
return (this.reqUrl == null) ? "" : this.reqUrl.trim();
}
public void setReqUrl(String reqUrl) {
this.reqUrl = reqUrl;
}
public String getEncryptedPassword(String plainPassword) {
long flgCrypt = getParm("PWD_CRYPT").getNumeroLong();
String cryptedPwd = plainPassword;
if (flgCrypt == 1L) {
cryptedPwd = EcDc.encodeDizionario(plainPassword, "Xg3Z5sFQ");
} else if (flgCrypt == 2L) {
cryptedPwd = EcDc.cryptMD5(plainPassword);
} else if (flgCrypt == 3L) {
cryptedPwd = EcDc.cryptSHA(plainPassword, "SHA-256");
}
return cryptedPwd;
}
public String getMsg() {
return (this.msg == null) ? "" : this.msg.trim();
}
public void setMsg(String msg) {
this.msg = msg;
}
public boolean isCrontabEnable(ServletContext servletContext) {
if ((long)getParm("DAILY_CRONTAB_ENABLE").getNumeroInt() == 1L) {
String webappInstance = servletContext.getInitParameter("instance");
String dbInstance = getParm("DAILY_CRONTAB_INSTANCE").getTesto();
if (dbInstance.isEmpty() || dbInstance.equals(webappInstance)) {
if (getParm("IS_LOCALHOST").isFalse() || (
getParm("IS_LOCALHOST").isTrue() && getParm("CRONTAB_LOCALHOST").isTrue()))
return true;
return false;
}
return false;
}
return false;
}
}

View file

@ -0,0 +1,48 @@
package it.acxent.db;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validation;
import jakarta.validation.Validator;
import jakarta.validation.ValidatorFactory;
import java.util.Set;
public class BeanValidator {
private static final ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
private static final Validator validator = factory.getValidator();
public static ResParm validate(Object bean) {
Set<ConstraintViolation<Object>> violations = validator.validate(bean, new Class<?>[0]);
ResParm result = new ResParm();
if (violations.isEmpty()) {
result.setStatus(true);
result.setMsg("Validation passed");
JsonObject jsonOk = new JsonObject();
jsonOk.addProperty("status", Boolean.valueOf(true));
jsonOk.addProperty("message", "Validation passed");
result.setJsonResult(jsonOk);
return result;
}
result.setStatus(false);
StringBuilder sb = new StringBuilder();
JsonObject json = new JsonObject();
json.addProperty("status", Boolean.valueOf(false));
JsonArray errors = new JsonArray();
for (ConstraintViolation<Object> v : violations) {
String field = v.getPropertyPath().toString();
String message = v.getMessage();
sb.append("- ").append(field).append(": ").append(message).append("\n");
JsonObject error = new JsonObject();
error.addProperty("field", field);
error.addProperty("message", message);
errors.add((JsonElement)error);
}
json.add("errors", (JsonElement)errors);
result.setMsg(sb.toString().trim());
result.setJsonResult(json);
return result;
}
}

View file

@ -0,0 +1,296 @@
package it.acxent.db;
import it.acxent.util.Debug;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Calendar;
public class CPConnection extends Debug {
private static final long serialVersionUID = -616911378329804676L;
private volatile boolean released;
private ApplParm ap;
private Connection conn;
private Timestamp createTs;
private int hits;
private String lastCallingStackTrace;
private Timestamp callTs;
private String reqUrl;
private long lastUpdId_user;
private String reqIpAddress;
private ResParm rp;
private boolean txFailed = false;
private int txOwnerDepth = 0;
private boolean txStarted = false;
public static CPConnection getInstance(ApplParm ap) {
CPConnection cpC = null;
synchronized (ap) {
cpC = new CPConnection(ap);
cpC.setRp(cpC.initConn());
}
return cpC;
}
private CPConnection(ApplParm newAp) {
this.ap = newAp;
}
public boolean isReleased() {
return this.released;
}
public void markReleased() {
this.released = true;
}
public boolean isTxStarted() {
return this.txStarted;
}
public void setTxStarted(boolean txStarted) {
this.txStarted = txStarted;
}
public synchronized void acquire() {
this.txOwnerDepth++;
}
public boolean isTxActive() {
return (this.txOwnerDepth > 0);
}
public synchronized void startTX() throws SQLException {
if (this.txOwnerDepth == 0) {
DBAdapter.printDebug(false, "startTX: Avvio TX (Depth 0 -> 1), setAutoCommit(false)");
getConn().setAutoCommit(true);
} else {
DBAdapter.printDebug(false, "startTX: Incremento Depth TX (" + this.txOwnerDepth + " -> " + this.txOwnerDepth + 1 + ")");
}
this.txOwnerDepth++;
}
public void addHit() {
this.hits++;
}
public void close() {
try {
if (this.conn != null && !this.conn.isClosed())
this.conn.close();
} catch (SQLException e) {
handleDebug(e, 0);
}
if (this == DBAdapter.getThreadLocal(getApFull().getApCode()).get())
DBAdapter.getThreadLocal(getApFull().getApCode()).remove();
}
protected void finalize() throws Throwable {
close();
this.conn = null;
}
public ApplParm getApFull() {
return this.ap;
}
public Connection getConn() {
return this.conn;
}
public void setConnNul() {
this.conn = null;
}
public Timestamp getCreateTs() {
return this.createTs;
}
public boolean getDebug() {
if (getApFull() != null)
return getApFull().getDebug();
return super.getDebug();
}
public String getDebugFile() {
if (getApFull() != null)
return getApFull().getDebugFile();
return getDebugFile();
}
public int getDebugLevel() {
if (getApFull() != null)
return getApFull().getDebugLevel();
return getDebugLevel();
}
public int getHits() {
return this.hits;
}
public String getLastCallingStackTrace() {
return (this.lastCallingStackTrace == null) ? "" : this.lastCallingStackTrace.trim();
}
public Timestamp getCallTs() {
return this.callTs;
}
private ResParm initConn() {
ResParm rp = new ResParm(true);
if (this.conn == null) {
try {
if (this.ap.getDbEnvironProperty() != null) {
this.conn = DriverManager.getConnection(this.ap.getConnectionString() + ":" + this.ap.getConnectionString(), this.ap.getDbEnvironProperty());
} else {
this.conn = DriverManager.getConnection(this.ap.getConnectionString() + ":" + this.ap.getConnectionString(), this.ap.getUser(), this.ap.getPassword());
}
this.createTs = new Timestamp(Calendar.getInstance().getTime().getTime());
this.hits = 0;
rp.setStatus(true);
} catch (Exception e) {
rp.setStatus(false);
rp.setMsg("CPConnection.initConn: Error during connection.....: " + e.getMessage() + "\nDatabase resource: " +
this.ap.getDatabase() + "\nDatabase catalog: " + this.ap.getCatalog() + "\nDatabase type: " + this.ap.getDbType() + "\nDatabase url: " +
this.ap.getUrl() + "\nUser: " + this.ap.getUser() + "\nPassword: " + this.ap.getPassword() + "\nDbpasswd: " +
this.ap.getDbAtinavpasswd() + "\n" + e.getMessage());
}
} else {
rp.setStatus(false);
rp.setMsg("CPConnection.initConn: connessione nulla!!");
}
return rp;
}
public boolean isValid() {
try {
Connection c = getConn();
if (c == null || c.isClosed())
return false;
if (getApFull().getDbType() == 17)
return c.isValid(0);
return true;
} catch (Exception e) {
handleDebug(e, 0);
return false;
}
}
public void setLastCallingStackTrace(String lastCallingStackTrace) {
this.lastCallingStackTrace = lastCallingStackTrace;
}
public void setCallTs(Timestamp lastFreeTs) {
this.callTs = lastFreeTs;
}
public long getLifeTimeSeconds() {
long mt1 = getCreateTs().getTime();
long mt2 = Calendar.getInstance().getTimeInMillis();
return (mt2 - mt1) / 1000L;
}
public String getLifeTime() {
return DBAdapter.secToHourMinSec(getLifeTimeSeconds());
}
public String getCallTime() {
long ctm = getCallTimeMilliSeconds();
if (ctm < 10000L) {
int sec = (int)ctm / 1000;
int ms = (int)(ctm - (long)(sec * 1000));
return "" + sec + "," + sec + " ms";
}
return DBAdapter.secToHourMinSec(ctm / 1000L);
}
public long getCallTimeMilliSeconds() {
if (getCallTs() != null) {
long mt1 = getCallTs().getTime();
long mt2 = Calendar.getInstance().getTimeInMillis();
return mt2 - mt1;
}
return 0L;
}
public String getReqIpAddress() {
return (this.reqIpAddress == null) ? "" : this.reqIpAddress;
}
public void setReqIpAddress(String reqIpAddress) {
this.reqIpAddress = reqIpAddress;
}
public String getReqUrl() {
return (this.reqUrl == null) ? "" : this.reqUrl;
}
public void setReqUrl(String reqUrl) {
this.reqUrl = reqUrl;
}
public long getLastUpdId_user() {
return this.lastUpdId_user;
}
public void setLastUpdId_user(long lastUpdId_user) {
this.lastUpdId_user = lastUpdId_user;
}
public ResParm getRp() {
return this.rp;
}
public void setRp(ResParm rp) {
this.rp = rp;
}
public void setTxFailed(boolean v) {
this.txFailed = v;
}
public boolean isTxFailed() {
return this.txFailed;
}
public void incrementTxOwnerDepth() {
this.txOwnerDepth++;
}
public void setTxOwnerDepth(int l_depth) {
this.txOwnerDepth = l_depth;
}
public void forceReleaseTransaction() {
this.txOwnerDepth = 1;
}
public void decrementTxOwnerDepth() {
if (this.txOwnerDepth > 0)
this.txOwnerDepth--;
}
public int getTxOwnerDepth() {
return this.txOwnerDepth;
}
public void resetTxFlags() {
this.txFailed = false;
this.txOwnerDepth = 0;
}
}

View file

@ -0,0 +1,503 @@
package it.acxent.db;
import it.acxent.annotation.CRDescriptor;
import it.acxent.common.Parm;
import it.acxent.util.Debug;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
public class CRAdapter extends Debug implements Serializable {
private static final long serialVersionUID = -693587215327844433L;
public static String AB_EMPTY_STRING = "";
protected HashMap<String, FieldsDescriptor> crFieldDescriptor;
private ApplParmFull apFull;
private Timestamp createTmst;
private String searchTxt;
protected DBAdapter getSecondaryObject(DBAdapter obj, Class<?> objClass, long pkLongValue) {
return getSecondaryObject(obj, objClass, Long.valueOf(pkLongValue));
}
protected DBAdapter getSecondaryObject(DBAdapter obj, Class<?> objClass, Object pkValue) {
try {
return DBAdapter.getSecondaryObject(getApFull(), obj, objClass, pkValue);
} catch (Exception e) {
handleDebug(e);
return obj;
}
}
private boolean searchRequest = false;
private long flgOrderBy;
private long flgTipoReport;
private int pageRow;
private int pageNumber;
private int searchPageNumber;
private String currentTab;
private String cmd;
private String flgReport;
private long id_users;
private String act;
private String lang;
private long flgShowDeleteLogic = 0L;
private String currentFocus;
private String _id;
private String filePdf;
private String fileName;
private Timestamp lastUpdTmst;
private String searchRighe;
private String searchRighe2;
private long flgMobileView = 1L;
private String TAG_THREAD_MSG;
public CRAdapter() {}
public CRAdapter(ApplParmFull newAp) {
setApFull(newAp);
}
public ApplParmFull getApFull() {
return this.apFull;
}
public String getFlgReport() {
return (this.flgReport == null) ? "" : this.flgReport.trim();
}
public String getLang() {
return (this.lang == null) ? "it" : this.lang.trim().toLowerCase();
}
public int getSearchPageNumber() {
return (this.searchPageNumber == 0) ? 1 : this.searchPageNumber;
}
public boolean isSearchRequest() {
return this.searchRequest;
}
public void setApFull(ApplParmFull newAp) {
this.apFull = newAp;
}
public void setFlgReport(String newFlgReport) {
this.flgReport = newFlgReport;
}
public void setLang(String newLang) {
this.lang = newLang;
}
public void setSearchPageNumber(int newSearchPageNumber) {
this.searchPageNumber = newSearchPageNumber;
}
public void setSearchRequest(boolean newSearchRequest) {
this.searchRequest = newSearchRequest;
}
public long getFlgTipoReport() {
return this.flgTipoReport;
}
public void setFlgTipoReport(long flgTipoReport) {
this.flgTipoReport = flgTipoReport;
}
public int getPageNumber() {
return this.pageNumber;
}
public void setPageNumber(int pageNumber) {
this.pageNumber = pageNumber;
}
public int getPageRow() {
return this.pageRow;
}
public void setPageRow(int pageRow) {
this.pageRow = pageRow;
}
public String getSearchTxt() {
return (this.searchTxt == null) ? AB_EMPTY_STRING : this.searchTxt.trim();
}
public void setSearchTxt(String searchTxt) {
this.searchTxt = searchTxt;
}
public String getCurrentTab() {
return (this.currentTab == null) ? AB_EMPTY_STRING : this.currentTab.trim();
}
public void setCurrentTab(String currentTab) {
this.currentTab = currentTab;
}
public long getFlgOrderBy() {
return this.flgOrderBy;
}
public void setFlgOrderBy(long flgOrderBy) {
this.flgOrderBy = flgOrderBy;
}
public long getId_users() {
return this.id_users;
}
public void setId_users(long newId_users) {
this.id_users = newId_users;
}
public String getCmd() {
return (this.cmd == null) ? AB_EMPTY_STRING : this.cmd.trim();
}
public void setCmd(String cmd) {
this.cmd = cmd;
}
public String getAct() {
return (this.act == null) ? AB_EMPTY_STRING : this.act.trim();
}
public void setAct(String act) {
this.act = act;
}
public long getFlgShowDeleteLogic() {
return this.flgShowDeleteLogic;
}
public void setFlgShowDeleteLogic(long flgShowDeleteLogic) {
this.flgShowDeleteLogic = flgShowDeleteLogic;
}
public String getCurrentFocus() {
return (this.currentFocus == null) ? AB_EMPTY_STRING : this.currentFocus.trim();
}
public void setCurrentFocus(String currentFocus) {
this.currentFocus = currentFocus;
}
public String get_id() {
return (this._id == null) ? AB_EMPTY_STRING : this._id.trim();
}
public void set_id(String anchor) {
this._id = anchor;
}
public String getFilePdf() {
return this.filePdf;
}
public void setFilePdf(String filePdf) {
this.filePdf = filePdf;
}
private void buildDescrizioneCRMap() {
boolean debug = false;
initCrFieldDescriptor();
Class<?> currentclClass = getClass();
while (!currentclClass.getName().equals("it.acxent.db.CRAdapter")) {
Field[] ff1 = currentclClass.getDeclaredFields();
int order = 1000;
for (Field element : ff1) {
String name = element.getName();
String desc = name;
CRDescriptor annotation = element.<CRDescriptor>getAnnotation(CRDescriptor.class);
if (annotation == null || annotation.abilita()) {
if (annotation != null)
desc = annotation.descrizione();
Object valueUpd = getCRValueByFieldname(name, element.getType(), this);
String valueS = convertCRValueToString(valueUpd, element.getType());
DBAdapter.logDebug(debug, "buildDescrizioneCRMap: " + desc + " (" + name + "): " + valueS);
DBAdapter.logDebug(debug, name + ": " + name);
if (!valueS.isEmpty())
if (getCrFieldDescriptor().containsKey(desc)) {
FieldsDescriptor currentCRFD = getCrFieldDescriptor().get(desc);
currentCRFD.setVal(valueS);
getCrFieldDescriptor().put(desc, currentCRFD);
} else {
getCrFieldDescriptor().put(desc, new FieldsDescriptor(desc, (long)order, desc,
convertCRValueToString(valueUpd, element.getType())));
order++;
}
}
}
currentclClass = currentclClass.getSuperclass();
}
}
private static Object getCRValueByFieldname(String filedName, Class<?> tipo, CRAdapter thiss) {
String functionName = "get" + filedName.substring(0, 1).toUpperCase() + filedName.substring(1);
Object value = null;
try {
Method method = thiss.getClass().getMethod(functionName);
value = method.invoke(thiss);
if (filedName.startsWith("flg") && value instanceof Long) {
String descColumn = filedName.substring(3);
functionName = "get" + descColumn.substring(0, 1).toUpperCase() + descColumn.substring(1);
Class<?>[] parm = new Class<?>[1];
parm[0] = long.class;
Long[] parmValue = { (Long)value };
method = thiss.getClass().getMethod(functionName);
value = method.invoke(thiss);
} else if (filedName.startsWith("id_")) {
functionName = "get" + filedName.substring(3, 4).toUpperCase() + filedName.substring(4);
method = thiss.getClass().getMethod(functionName);
Object currentObj = method.invoke(thiss);
Method descMethod = currentObj.getClass().getMethod("getDescrizione");
value = descMethod.invoke(currentObj);
}
} catch (SecurityException e) {
} catch (NoSuchMethodException e) {
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
} catch (InvocationTargetException e) {}
return value;
}
private static boolean isNotEmpty(Object valueUpd, Class<?> tipo) {
boolean ret = false;
if (valueUpd != null) {
String sclass = valueUpd.getClass().getName();
if (sclass.indexOf("Long") > 0 || sclass.indexOf("Double") > 0 || sclass.indexOf("String") > 0 || sclass.indexOf("Date") > 0 ||
sclass.indexOf("Time") > 0)
if (tipo.getName() == "long") {
if ((Long)valueUpd == 0L || (Long)valueUpd == -1L) {
ret = false;
} else {
ret = true;
}
} else if (tipo.getName() == "double") {
if ((Double)valueUpd == 0.0D) {
ret = false;
} else {
ret = true;
}
} else if (tipo.getName().indexOf("String") > 0) {
if (((String)valueUpd).equals("") || ((String)valueUpd).isEmpty()) {
ret = false;
} else {
ret = true;
}
} else if (tipo.getName().indexOf("Date") > 0) {
Date data = (Date)valueUpd;
if (data == null) {
ret = false;
} else {
ret = true;
}
} else if (tipo.getName().indexOf("Time") > 0) {
if ((Time)valueUpd == null) {
ret = false;
} else {
ret = true;
}
}
}
return ret;
}
private final String convertCRValueToString(Object valueUpd, Class<?> tipo) {
String ret = AB_EMPTY_STRING;
if (valueUpd != null) {
String sclass = valueUpd.getClass().getName();
if (sclass.indexOf("String") > 0) {
ret = (String)valueUpd;
} else if (sclass.indexOf("Long") > 0 || sclass.indexOf("Double") > 0 || sclass.indexOf("String") > 0 || sclass.indexOf("Date") > 0 ||
sclass.indexOf("Time") > 0) {
if (tipo.getName() == "long") {
if ((Long)valueUpd > 0L)
ret = valueUpd.toString();
} else if (tipo.getName() == "double" || tipo.getName() == "float") {
if ((Double)valueUpd > 0.0D)
ret = getApFull().getNf().format(valueUpd);
} else if (tipo.getName().indexOf("String") > 0) {
ret = (String)valueUpd;
} else if (tipo.getName().indexOf("Date") > 0) {
Date data = (Date)valueUpd;
if (data != null)
if (getApFull() == null) {
ret = data.toString();
} else {
ret = getApFull().getDataFormat().format(data);
}
} else if (tipo.getName().indexOf("Time") > 0 &&
(Time)valueUpd != null) {
ret = getApFull().getTimeFormat().format((Time)valueUpd);
}
}
}
return ret.trim();
}
public String getFileName() {
return (this.fileName == null) ? AB_EMPTY_STRING : this.fileName.trim();
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Parm getParm(String theKey) {
if (getApFull() != null)
return getApFull().getAp().getParm(theKey);
return new Parm();
}
public final boolean checkVersion(String theKey) {
String temp = "," + getParm("VERSION").getTesto();
if (temp.indexOf("," + theKey) >= 0)
return true;
return false;
}
public Timestamp getCreateTmst() {
return this.createTmst;
}
public void setCreateTmst(Timestamp createTmst) {
this.createTmst = createTmst;
}
public final HashMap<String, FieldsDescriptor> getCrFieldDescriptor() {
if (this.crFieldDescriptor == null);
return this.crFieldDescriptor;
}
public void setCrFieldDescriptor(HashMap<String, FieldsDescriptor> crFieldDescriptor) {
this.crFieldDescriptor = crFieldDescriptor;
}
protected void initCrFieldDescriptor() {
if (this.crFieldDescriptor == null)
this.crFieldDescriptor = new HashMap<>();
}
public String getDescrizioneCR() {
StringBuilder sb = new StringBuilder();
buildDescrizioneCRMap();
FieldsComparator comparator = new FieldsComparator(getCrFieldDescriptor());
Map<String, FieldsDescriptor> orderMap = new TreeMap<>(comparator);
orderMap.putAll(getCrFieldDescriptor());
for (Map.Entry<String, FieldsDescriptor> entry : orderMap.entrySet()) {
if (!entry.getValue().getVal().isEmpty()) {
if (sb.length() > 0)
sb.append(" - ");
sb.append(entry.getValue().getDesc() + ": ");
sb.append(entry.getValue().getVal());
}
}
return sb.toString();
}
public String getDescrizioneHtmlCR() {
StringBuilder sb = new StringBuilder();
buildDescrizioneCRMap();
FieldsComparator comparator = new FieldsComparator(getCrFieldDescriptor());
Map<String, FieldsDescriptor> orderMap = new TreeMap<>(comparator);
orderMap.putAll(getCrFieldDescriptor());
for (Map.Entry<String, FieldsDescriptor> entry : orderMap.entrySet()) {
if (!entry.getValue().getVal().isEmpty()) {
if (sb.length() > 0)
sb.append("<br />");
sb.append(entry.getValue().getDesc() + ": ");
sb.append(entry.getValue().getVal());
}
}
return sb.toString();
}
public Timestamp getLastUpdTmst() {
return this.lastUpdTmst;
}
public void setLastUpdTmst(Timestamp lastUpdTmst) {
this.lastUpdTmst = lastUpdTmst;
}
public String getSearchRighe() {
return (this.searchRighe == null) ? AB_EMPTY_STRING : this.searchRighe.trim();
}
public void setSearchRighe(String searchRighe) {
this.searchRighe = searchRighe;
}
public String getSearchRighe2() {
return (this.searchRighe2 == null) ? AB_EMPTY_STRING : this.searchRighe2.trim();
}
public void setSearchRighe2(String searchRighe2) {
this.searchRighe2 = searchRighe2;
}
public boolean isGoogleTranslatorEnable() {
return getParm("USE_GOOGLE_TRANSLATOR").isTrue();
}
public long getFlgMobileView() {
return this.flgMobileView;
}
public void setFlgMobileView(long flgMobileView) {
this.flgMobileView = flgMobileView;
}
public String getTAG_THREAD_MSG() {
return (this.TAG_THREAD_MSG == null) ? AB_EMPTY_STRING : this.TAG_THREAD_MSG.trim();
}
public void setTAG_THREAD_MSG(String tAG_THREAD_MSG) {
this.TAG_THREAD_MSG = tAG_THREAD_MSG;
}
public static final String getYesNo(long l_flg) {
return DBAdapter.getYesNo(l_flg);
}
}

View file

@ -0,0 +1,169 @@
package it.acxent.db;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class ColumnDescriptor implements Serializable {
private static final long serialVersionUID = 359290152229948067L;
private boolean autoIncrement = false;
private String columnName;
private short dataType;
private int columnSize;
private Field field;
private int stringCaseValue = 0;
private EncodedField encodedField;
private boolean compressedText;
private short keySequence = -1;
private boolean fk;
public short getKeySequence() {
return this.keySequence;
}
public void setKeySequence(short keySequence) {
this.keySequence = keySequence;
}
public int getStringCaseValue() {
return this.stringCaseValue;
}
public void setStringCaseValue(int stringCaseValue) {
this.stringCaseValue = stringCaseValue;
}
public Field getField() {
return this.field;
}
public void setField(Field field) {
this.field = field;
}
public int getColumnSize() {
return this.columnSize;
}
public void setColumnSize(int columnSize) {
this.columnSize = columnSize;
}
private boolean fkNum = false;
private boolean pk;
private Method getMethod;
private Method setMethod;
public ColumnDescriptor(String theColumnName, short theDataType, int theColumnSize, boolean isPk) {
setColumnName(theColumnName);
setDataType(theDataType);
setPk(isPk);
setColumnSize(theColumnSize);
}
public ColumnDescriptor(String theColumnName, short theDataType, int theColumnSize, boolean isPk, Field theField, int l_strigCase, EncodedField l_econdedField, boolean isTextCompressed) {
setColumnName(theColumnName);
setDataType(theDataType);
setPk(isPk);
setColumnSize(theColumnSize);
setField(theField);
setStringCaseValue(l_strigCase);
setEncodedField(l_econdedField);
setCompressedText(isTextCompressed);
}
public String getColumnName() {
return this.columnName;
}
public short getDataType() {
return this.dataType;
}
public boolean isAutoIncrement() {
return this.autoIncrement;
}
public boolean isFk() {
return this.fk;
}
public boolean isFkNum() {
return this.fkNum;
}
public boolean isPk() {
return this.pk;
}
public void setAutoIncrement(boolean newAutoIncrement) {
this.autoIncrement = newAutoIncrement;
}
public void setColumnName(String newColumnName) {
this.columnName = newColumnName;
}
public void setDataType(short newDataType) {
this.dataType = newDataType;
}
public void setFk(boolean newFk) {
this.fk = newFk;
}
public void setFkNum(boolean newFkNum) {
this.fkNum = newFkNum;
}
public void setPk(boolean newPk) {
this.pk = newPk;
}
public Method getGetMethod() {
return this.getMethod;
}
public Method getSetMethod() {
return this.setMethod;
}
public void setGetMethod(Method method) {
this.getMethod = method;
}
public void setSetMethod(Method method) {
this.setMethod = method;
}
public EncodedField getEncodedField() {
if (this.encodedField == null)
this.encodedField = new EncodedField();
return this.encodedField;
}
public void setEncodedField(EncodedField encodedField) {
this.encodedField = encodedField;
}
public boolean isCompressedText() {
return this.compressedText;
}
public void setCompressedText(boolean compressedText) {
this.compressedText = compressedText;
}
}

View file

@ -0,0 +1,506 @@
package it.acxent.db;
import it.acxent.util.AsyncExecutor;
import it.acxent.util.Debug;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedDeque;
public class ConnectionPool extends Debug {
private static final long serialVersionUID = 4388984206513662169L;
private static Hashtable<String, ConnectionPool> ht_connectionPools;
private static final String NO_CALLING_STACK_TRACE_MSG = "<b>For full stack trace pls. set debug level to DEBUG (5) or INFO1 (1)</b>";
private ApplParm ap;
private static Hashtable<String, ConnectionPool> getHt_connectionPools() {
if (ht_connectionPools == null)
ht_connectionPools = new Hashtable<>();
return ht_connectionPools;
}
public static Enumeration<ConnectionPool> getCpools() {
return getHt_connectionPools().elements();
}
public static synchronized ConnectionPool getInstance(ApplParm ap) {
String cpKey = ap.getDatabase() + "_" + ap.getDatabase() + "_" + ap.getUser();
if (getHt_connectionPools().containsKey(cpKey))
return getHt_connectionPools().get(cpKey);
ConnectionPool cp = new ConnectionPool(ap);
cp.initCPConnection();
getHt_connectionPools().put(cpKey, cp);
return cp;
}
public static void resetAll() {
Enumeration<ConnectionPool> enu = getCpools();
while (enu.hasMoreElements()) {
ConnectionPool l_cp = enu.nextElement();
l_cp.resetAllConnection();
}
ht_connectionPools = null;
}
private ConcurrentLinkedDeque<CPConnection> free = new ConcurrentLinkedDeque<>();
private int freeCons;
private ConcurrentLinkedDeque<CPConnection> used = new ConcurrentLinkedDeque<>();
private int usedCons;
private ApplParmFull apFull;
private ConnectionPool(ApplParm newAp) {
this.ap = newAp;
try {
Class.forName(this.ap.getDriverManager()).newInstance();
} catch (ClassNotFoundException cnf) {
System.err.println("Connection Pool: " + cnf.getMessage());
} catch (Exception e) {
System.err.println("Connection Pool: " + e.getMessage());
}
}
private ConnectionPool(ApplParmFull newAp) {
this.apFull = newAp;
this.ap = this.apFull.getAp();
try {
Class.forName(this.ap.getDriverManager()).newInstance();
} catch (ClassNotFoundException cnf) {
System.err.println("Connection Pool: " + cnf.getMessage());
} catch (Exception e) {
System.err.println("Connection Pool: " + e.getMessage());
}
}
private ResParm addCPConnection() {
CPConnection cpConn = CPConnection.getInstance(getAp());
ResParm rp = new ResParm();
if (cpConn == null) {
rp.setStatus(false);
rp.setMsg("Errore! addCPConnection.getInstance() CPConnection null!");
} else if (cpConn.getConn() == null) {
rp.setStatus(false);
rp.setMsg("Errore! addCPConnection.getInstance() Connection null! " + cpConn.getRp().getMsg());
} else {
rp = cpConn.getRp();
}
if (rp.getStatus()) {
getFree().add(cpConn);
this.freeCons++;
printDebugMsg("Add new connection...");
}
return rp;
}
private synchronized boolean checkFreeConnection() {
boolean test = true;
List<CPConnection> snapshot = new ArrayList<>(getFree());
for (CPConnection con : snapshot) {
if (!con.isValid()) {
removeFreeConnection(con);
test = false;
}
}
this.freeCons = getFree().size();
return test;
}
private synchronized boolean checkUsedConnection() {
boolean test = true;
List<CPConnection> snapshot = new ArrayList<>(getUsed());
for (CPConnection con : snapshot) {
if (!con.isValid()) {
removeCPConnection(con);
test = false;
}
}
this.usedCons = getUsed().size();
return test;
}
private synchronized boolean resetAllConnection() {
boolean test = false;
for (CPConnection usedCon : new ArrayList<>(getUsed())) {
if (usedCon == DBAdapter.getThreadLocal(getAp().getApCode()).get())
DBAdapter.getThreadLocal(getAp().getApCode()).remove();
removeCPConnection(usedCon);
test = true;
}
this.usedCons = (getUsed() != null) ? getUsed().size() : 0;
this.used = null;
for (CPConnection freeCon : new ArrayList<>(getFree())) {
freeCon.close();
getFree().remove(freeCon);
freeCon = null;
test = true;
printDebugMsg("Removed connection RESET ALL CONNECTIONS ...");
}
this.freeCons = getFree().size();
this.free = null;
return test;
}
protected void finalize() throws Throwable {
resetAllConnection();
}
public final synchronized String garbageCollection(int l_logLevel) {
String msg = "\nConnection Pool Garbage Collection for:" + getAp().getUrl();
try {
int uc = getUsedCons();
int fc = getFreeCons();
checkUsedConnection();
checkFreeConnection();
msg = msg + "\nUsed connections before gc: " + msg;
msg = msg + "\nUsed connections after gc: " + msg;
msg = msg + "\nReleased connections: " + msg;
msg = msg + "\nFree connections before gc: " + msg;
msg = msg + "\nFree connections after gc: " + msg;
msg = msg + "\nDeleted connections: " + msg;
msg = msg + "\n--------------------------------------------\n";
handleDebug(msg, l_logLevel);
Class.forName(this.ap.getDriverManager()).newInstance();
} catch (Exception e) {
handleDebug(e, 0);
}
return msg;
}
public synchronized CPConnection getCPConnection() throws SQLException {
if (this.freeCons < 0)
this.freeCons = 0;
ResParm rp = new ResParm(true);
if (this.freeCons == 0)
if (this.ap.getMaxCons() == 0 || this.usedCons < this.ap.getMaxCons()) {
rp = addCPConnection();
if (!rp.getStatus())
throw new SQLException("cp.getCPConnection() addCPConnection(): cannot get a new connection ...db:" + getAp().getUrl() + "\nusername:" +
getAp().getUser() + "\npassword:" + getAp().getPassword() + "\nfree:" + this.freeCons + " used:" +
getUsedCons() + "\naddCPConnection Exception:\n" + rp.getMsg() + "\n***************************\n");
} else if (this.ap.isBlock()) {
try {
wait((long)this.ap.getTimeout());
} catch (InterruptedException ie) {
System.err.println("Interrupted Exception: " + ie.getMessage());
}
if (this.freeCons == 0)
if (this.ap.getMaxCons() == 0 || this.usedCons < this.ap.getMaxCons()) {
rp = addCPConnection();
} else if (checkUsedConnection()) {
if (resetAllConnection()) {
rp = addCPConnection();
handleDebug("WARNING! CONNECTION POOL RESET. CHANGE TIMEOUT OR MAXCON PARMS OR CHECK FOR ERRORS ON YOU CODE db:" +
getAp().getUrl(), 0);
} else {
throw new SQLException("After timeout error resetting all connection...db:" + getAp().getUrl() + " free:" + this.freeCons + " used:" +
getUsedCons() + "\n***************************\n");
}
} else if (this.ap.getMaxCons() == 0 || this.usedCons < this.ap.getMaxCons()) {
rp = addCPConnection();
} else {
throw new SQLException("After timeout still connection non available. IT SHOULD BE NEVER HAPPEN!!..db:" +
getAp().getUrl() + " free:" + this.freeCons + " used:" + getUsedCons() + "\n***************************\n");
}
} else {
throw new SQLException("Max number of connections reached!\n***************************\n");
}
if (!rp.getStatus())
throw new SQLException("cp.getCPConnection() after retries: cannot get a new connection ...db:" + getAp().getUrl() + "\nusername:" +
getAp().getUser() + "\npassword:" + getAp().getPassword() + "\nfree:" + this.freeCons + " used:" +
getUsedCons() + "\naddCPConnection Exception:\n" + rp.getMsg() + "\n***************************\n");
CPConnection cpCon = getFree().pollFirst();
getFree().remove(cpCon);
this.freeCons--;
if (!cpCon.isValid()) {
handleDebug("Invalid connection found, removing from pool", 5);
printDebugMsg("Invalid connection found, removing from pool ...");
cpCon.close();
getUsed().remove(cpCon);
this.usedCons--;
cpCon = CPConnection.getInstance(getAp());
rp = cpCon.getRp();
}
if (cpCon == null || cpCon.getConn() == null || !rp.getStatus())
throw new SQLException("cp.getCPConnection(): cannot get a new connection ...db:" + getAp().getUrl() + "\nusername:" +
getAp().getUser() + "\npassword:" + getAp().getPassword() + "\nfree:" + this.freeCons + " used:" + getUsedCons() + "\n\naddCPConnection new connection after invalid connection. Exception:\n" +
rp.getMsg() + "\n***************************\n");
getUsed().add(cpCon);
this.usedCons++;
cpCon.addHit();
cpCon.setCallTs(new Timestamp(System.currentTimeMillis()));
if (getDebugLevel() >= 1) {
StringBuffer msg = new StringBuffer("Connection Calling Stack Trace:\n");
StringBuffer msgAll = new StringBuffer("Connection Calling Stack Trace (NO DBAdapter class found!):\n");
StackTraceElement[] callingFrame = Thread.currentThread().getStackTrace();
boolean dbAdapterTrovato = false;
boolean dbAdapterSparito = false;
if (callingFrame.length > 0) {
int numRigheDBAdapter = 0;
for (int i = 1; i < callingFrame.length; i++) {
String temp = callingFrame[i].getClassName() + "." + callingFrame[i].getClassName();
msgAll.append(temp);
msgAll.append("\n");
if (temp.indexOf("DBAdapter") > 1)
dbAdapterTrovato = true;
if (dbAdapterTrovato && temp.indexOf("DBAdapter") < 0)
dbAdapterSparito = true;
if (dbAdapterSparito) {
msg.append(temp);
msg.append("\n");
numRigheDBAdapter++;
if (numRigheDBAdapter >= 4)
break;
}
}
}
if (dbAdapterSparito) {
cpCon.setLastCallingStackTrace(msg.toString());
} else {
cpCon.setLastCallingStackTrace(msgAll.toString());
}
}
handleDebug("getCPConnection: db:" + getAp().getUrl() + " free:" + this.freeCons + " used:" + getUsedCons(), 5);
return cpCon;
}
public String getCpParms() {
String temp = "Initial Connections: " + this.ap.getInitialCons() + "\nMax Connections: " + this.ap.getMaxCons() + "\nTimeout: " +
this.ap.getTimeout() + "\nFree Connections: " + this.freeCons + "\nUsed Connections: " + this.usedCons;
return temp;
}
public boolean getDebug() {
return super.getDebug();
}
public int getFreeCons() {
return this.freeCons;
}
public int getUsedCons() {
return this.usedCons;
}
public int getTotCons() {
return this.usedCons + this.freeCons;
}
private void initCPConnection() {
int i = 0;
while (this.freeCons < this.ap.getInitialCons() && i < this.ap.getMaxCons()) {
ResParm rp = addCPConnection();
if (rp.getStatus()) {
i++;
continue;
}
break;
}
this.usedCons = 0;
}
public void releaseCPConnection(CPConnection con) {
releaseCPConnection(con, this.ap.isReuseCons());
}
private synchronized void releaseCPConnection(CPConnection con, boolean reuseThisCon) {
if (con != null) {
con.setReqIpAddress("");
if (getUsed().contains(con)) {
getUsed().remove(con);
this.usedCons--;
if (!reuseThisCon) {
handleDebug("Removed connection — reason: NO REUSE — ID: " + String.valueOf(con.getCreateTs()) + ", hits: " + con.getHits(), 5);
con.close();
con = null;
} else {
boolean expiredByHits = (this.ap.getMaxConnectionHits() > 0 && con.getHits() > this.ap.getMaxConnectionHits());
boolean expiredByLifetime = false;
if (getAp().getConnectionLifeTime() > 0) {
Calendar cts = Calendar.getInstance();
cts.setTime(con.getCreateTs());
cts.add(12, getAp().getConnectionLifeTime());
expiredByLifetime = Calendar.getInstance().after(cts);
}
if (expiredByHits || expiredByLifetime) {
String reason = (expiredByHits ? "MAX HITS" : "") + (expiredByHits ? "MAX HITS" : "") + ((expiredByHits && expiredByLifetime) ? " + " : "");
DBAdapter.printDebug(true, "Connection expired - reason: " + reason + " - ID: " +
String.valueOf(con.getCreateTs()) + ", hits: " + con.getHits());
handleDebug("Removed connection — reason: " + reason + " — ID: " + String.valueOf(con.getCreateTs()) + ", hits: " + con.getHits(), 5);
con.close();
con = null;
} else {
getFree().add(con);
this.freeCons++;
}
}
notify();
} else {
handleDebug("releaseCPConnection: used Connection " + String.valueOf(con) + " not from this Connection Pool or connection already removed! Processing Garbage Collection...db:" +
getAp().getUrl() + " free:" + this.freeCons + " used:" + getUsedCons() + "\n" + con.getLastCallingStackTrace(), 0);
garbageCollection(0);
}
} else {
handleDebug("releaseCPConnection: trying to release a null connection!! Processing Garbage Collection db:" + getAp().getUrl() + " free:" + this.freeCons + " used:" +
getUsedCons(), 0);
garbageCollection(0);
}
handleDebug("releaseCPConnection: well done ...db:" + getAp().getUrl() + " free:" + this.freeCons + " used:" + getUsedCons(), 5);
}
private synchronized void removeFreeConnection(CPConnection con) {
if (con != null) {
con.setReqIpAddress("");
if (getFree().contains(con)) {
getFree().remove(con);
con.close();
con = null;
this.freeCons--;
} else {
handleDebug("removeFreeConnection: Free Connection " + String.valueOf(con) + " not from this Connection Pool or connection already removed!...db:" +
getAp().getUrl() + " free:" + this.freeCons + " used:" +
getUsedCons(), 0);
garbageCollection(0);
}
notify();
} else {
handleDebug("removeFreeConnection: trying to release a null connection!! Processing Garbage Collection db:" + getAp().getUrl() + " free:" + this.freeCons + " used:" +
getUsedCons(), 0);
garbageCollection(0);
}
handleDebug("removeFreeConnection: well done ...db:" + getAp().getUrl() + " free:" + this.freeCons + " used:" + getUsedCons(), 5);
}
public void removeCPConnection(CPConnection con) {
releaseCPConnection(con, false);
}
public void setFreeCons(int newFreeCons) {
this.freeCons = newFreeCons;
}
public void setUsedCons(int newUsedCons) {
this.usedCons = newUsedCons;
}
public String getDebugFile() {
if (getAp() != null)
return getAp().getDebugFile();
return getDebugFile();
}
public int getDebugLevel() {
if (getAp() != null)
return getAp().getDebugLevel();
return getDebugLevel();
}
public ConcurrentLinkedDeque<CPConnection> getFree() {
if (this.free == null)
this.free = new ConcurrentLinkedDeque<>();
return this.free;
}
public void setFree(ConcurrentLinkedDeque<CPConnection> free) {
this.free = free;
}
public ConcurrentLinkedDeque<CPConnection> getUsed() {
if (this.used == null)
this.used = new ConcurrentLinkedDeque<>();
return this.used;
}
public void setUsed(ConcurrentLinkedDeque<CPConnection> used) {
this.used = used;
}
private void resetOldUsedConnection(long min) {
List<CPConnection> snapshot = new ArrayList<>(getUsed());
int i = 0;
for (CPConnection con : snapshot) {
i++;
if (con.getCallTimeMilliSeconds() > min * 60000L) {
try {
DBAdapter.printDebug("FORCE CLOSING USED CONNECTION " + i + " after " + con.getCallTime() + "!!!!\n" +
getAp().getApDescription() + "\nCONNECTION URL: " + con.getReqUrl());
} catch (Exception e) {
DBAdapter.printDebug("FORCE CLOSING USED CONNECTION " + i + " after " + con.getCallTime() + "!!!!\n" +
getAp().getApDescription() + "\n======> exception on resetOldUsedConnection:\n" + e.getMessage());
}
con.close();
getUsed().remove(con);
}
}
this.usedCons = getUsed().size();
}
public ApplParm getAp() {
return this.ap;
}
private final void printDebugMsg(String msg) {
boolean debug = false;
if (debug) {
int stIdx = Math.min((Thread.currentThread().getStackTrace()).length, 11) - 1;
String methodName = Thread.currentThread().getStackTrace()[stIdx].getMethodName();
String className = Thread.currentThread().getStackTrace()[stIdx].getClassName();
if (methodName.indexOf("findRows") >= 0) {
methodName = Thread.currentThread().getStackTrace()[stIdx - 1].getMethodName();
className = Thread.currentThread().getStackTrace()[stIdx - 1].getClassName();
}
StringBuilder sb = new StringBuilder(">>>>>>>> Connection Pool:\n");
Date d = new Date(System.currentTimeMillis());
sb.append(d.toString());
sb.append("\n");
sb.append(msg);
sb.append("\n");
sb.append(className);
sb.append(".");
sb.append(methodName);
sb.append("\n");
if (this.apFull != null) {
sb.append(this.apFull.getReqUrl());
sb.append("\n");
}
sb.append(this.ap.getDatabase());
sb.append("\nTot connections= ");
sb.append(this.freeCons + this.usedCons);
sb.append("\nMax connections= ");
sb.append(this.ap.getMaxCons());
sb.append("\n<<<<<<<<<");
System.out.println(sb.toString());
}
}
public static synchronized ConnectionPool getInstance(ApplParmFull apFull) {
String cpKey = apFull.getAp().getDatabase() + "_" + apFull.getAp().getDatabase() + "_" + apFull.getAp().getUser();
if (getHt_connectionPools().containsKey(cpKey))
return getHt_connectionPools().get(cpKey);
ConnectionPool cp = new ConnectionPool(apFull.getAp());
cp.initCPConnection();
getHt_connectionPools().put(cpKey, cp);
return cp;
}
public static void resetOldUsed(long min) {
AsyncExecutor.ELABORAZIONE_EXECUTOR.execute(() -> {
for (ConnectionPool l_cp : Collections.<ConnectionPool>list(getCpools()))
l_cp.resetOldUsedConnection(min);
});
}
}

View file

@ -0,0 +1,102 @@
package it.acxent.db;
import it.acxent.common.CrontabInterface;
import it.acxent.common.Users;
import it.acxent.mail.MailProperties;
import it.acxent.util.Timer;
import java.sql.Timestamp;
import java.util.Hashtable;
public class CrontabJobThread extends Thread {
public boolean isRunning = false;
private ApplParmFull apFull;
private CrontabInterface crontabInterface;
private String jobName;
private String eMail;
private static Hashtable<String, CrontabJobThread> runningInstaces = new Hashtable<>();
private CrontabJobThread(CrontabInterface crontabInterface, ApplParmFull ap, String jobName, String eMail) {
this.crontabInterface = crontabInterface;
setApFull(ap);
this.eMail = eMail;
this.jobName = jobName;
start();
}
public synchronized void run() {
this.isRunning = true;
Timer timer = new Timer();
timer.start();
String corpoMessaggio = timer.getTStart().toString() + " on " + timer.getTStart().toString() + " " + DBAdapter.getLocalHostname() + " CrontabJobThread: " + getApFull().getDatabase() + " started!!";
System.out.println(corpoMessaggio);
CrontabThread.appendLog(this.apFull, corpoMessaggio);
ResParm rp = new ResParm();
try {
rp = this.crontabInterface.crontabJob(getApFull());
} catch (Exception e) {
e.printStackTrace();
rp.setException(e);
}
Timestamp tEnd = new Timestamp(System.currentTimeMillis());
timer.stop();
String endMsg = timer.getTStop().toString() + " " + timer.getTStop().toString() + " CrontabJobThread: " + getApFull().getDatabase() + " (" + this.jobName + ") FINISHED";
if (!rp.getStatus() || !rp.getMsg().isEmpty())
endMsg = endMsg + "\n---- start crontabjob message -----\n" + endMsg + rp.getMsg() + "\n----- end crontabjob message ------";
CrontabThread.appendLog(this.apFull, endMsg);
corpoMessaggio = corpoMessaggio + "\n" + corpoMessaggio;
this.isRunning = false;
if (this.eMail != null && !this.eMail.isEmpty()) {
Users bean = new Users(this.apFull);
MailProperties mp = new MailProperties();
mp.put("TO", this.eMail);
mp.setProperty("FROM", this.apFull.getParm("FROM").getTesto());
mp.put("SUBJECT", "Crontab Job " + this.jobName + " on " +
DBAdapter.getLocalHostname() + " " + this.apFull.getDatabase() + " del " + String.valueOf(tEnd));
mp.setProperty("BCC", "");
mp.setProperty("CC", "");
mp.put("MSG", corpoMessaggio);
try {
bean.sendMailMessage(mp);
} catch (Exception e) {
e.printStackTrace();
CrontabThread.appendLog(this.apFull, new Timestamp(
System.currentTimeMillis()).toString() + " " + new Timestamp(System.currentTimeMillis()).toString() + " CrontabJobThread: " + getApFull().getDatabase() + " on " + this.jobName + " SEND MAIL ERROR TO " +
DBAdapter.getLocalHostname() + "\n" + this.eMail);
}
}
runningInstaces.remove(this.jobName);
}
public ApplParmFull getApFull() {
return this.apFull;
}
private void setApFull(ApplParmFull ap) {
this.apFull = ap;
}
public static String minToTempoHourMin(long min) {
return String.valueOf((int)(min / 60L)) + " h " + String.valueOf((int)(min / 60L)) + " min";
}
public static String secToTempoHourMin(long sec) {
long h = sec / 3600L;
long min = (sec - h * 60L) / 60L;
long secF = sec - h * 3660L - min * 60L;
return "" + h + " h " + h + " min " + min + " sec";
}
public static CrontabJobThread getInstance(CrontabInterface crontabInterface, ApplParmFull ap, String jobName, String eMail) {
if (!runningInstaces.containsKey(jobName)) {
CrontabJobThread currentThread = new CrontabJobThread(crontabInterface, ap, jobName, eMail);
runningInstaces.put(jobName, currentThread);
return currentThread;
}
return runningInstaces.get(jobName);
}
}

View file

@ -0,0 +1,264 @@
package it.acxent.db;
import it.acxent.common.CrontabInterface;
import it.acxent.log.Log;
import it.acxent.util.FileLogger;
import it.acxent.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.Calendar;
import java.util.Date;
import java.util.Hashtable;
public class CrontabThread extends Thread {
private static Hashtable<String, CrontabThread> instance = new Hashtable<>();
public boolean isRunning = false;
private ApplParmFull apFull;
public static void getInstance(ApplParmFull theApplParmFull) {
boolean debug = false;
if (!isInstance(theApplParmFull)) {
DBAdapter.logDebug(debug, "\n****** Init Crontab Servlet started!! " + theApplParmFull.getApCode() + " ******");
CrontabThread currentThread = new CrontabThread(theApplParmFull);
instance.put(theApplParmFull.getApCode(), currentThread);
}
}
public static boolean isInstance(ApplParmFull theApplParmFull) {
return instance.containsKey(theApplParmFull.getApCode());
}
private CrontabThread(ApplParmFull l_ap) {
setApFull(l_ap);
start();
}
public synchronized void run() {
this.isRunning = true;
String dashLine = "******************************************************\n";
String endDashLine = "######################################################\n";
Date d = new Date(System.currentTimeMillis());
System.out.println("\n" + d.toString() + " " + getApFull().getDatabase() + " ****** CrontabThread started!! ******");
appendLog(this.apFull, dashLine + dashLine + " " + d.toString() + " CrontabThread started!!\n" + getApFull().getDatabase());
if ((long)getApFull().getParm("DAILY_CRONTAB_ENABLE").getNumeroInt() == 1L)
while (this.isRunning) {
if ((long)getApFull().getParm("DAILY_CRONTAB_ENABLE").getNumeroInt() == 1L) {
if (getApFull().getParm("IS_LOCALHOST").isFalse() || (getApFull().getParm("IS_LOCALHOST").isTrue() &&
getApFull().getParm("CRONTAB_LOCALHOST").isTrue()))
try {
String crontabs = getApFull().getParm("DAILY_CRONTAB").getTesto().trim();
String job = "NO JOB SELECTED!";
if (!crontabs.isEmpty())
try {
String crontabsOk = crontabs;
String delimeter = "\n";
if (crontabs.indexOf('\r') > 1) {
crontabsOk = crontabs.replaceAll("\n", "");
delimeter = "\r";
} else if (crontabs.indexOf('\n') > 1) {
crontabsOk = crontabs.replaceAll("\r", "");
delimeter = "\n";
}
StringTokenizer st = new StringTokenizer(crontabsOk, delimeter);
while (st.hasMoreTokens()) {
job = st.nextToken().trim();
String eMail = null;
if (eseguoJob(job)) {
StringTokenizer stJob = new StringTokenizer(job, " ");
if (stJob.countToken() == 7) {
eMail = stJob.getToken(6);
} else if (stJob.countToken() == 2) {
eMail = st.getToken(1);
}
String realJob = job.substring(0, job.indexOf(' '));
Class<?> jobClass = Class.forName(realJob);
Object jobInst = jobClass.newInstance();
this.apFull.setMsg(job);
CrontabJobThread.getInstance((CrontabInterface)jobInst, this.apFull, realJob, eMail);
}
}
} catch (Exception e) {
d = new Date(System.currentTimeMillis());
appendLog(this.apFull, d.toString() + " Exception CRONTAB JOB (155): " + d.toString() + "\n" + job);
e.printStackTrace();
}
if (getApFull().getParm("USE_LOG").getNumero() == 1.0D && (getApFull().getParm("LOG_GG").getNumero() > 0.0D ||
getApFull().getParm("LOG_MAIL_GG").getNumero() > 0.0D)) {
job = "it.acxent.common.Log 0 0 * * * ";
if (eseguoJob(job))
try {
CrontabJobThread.getInstance(new Log(), this.apFull, "Pulizia Log giornaliera",
getApFull().getParm("LOG_CRONTAB_MAIL").getTesto());
} catch (Exception e) {
d = new Date(System.currentTimeMillis());
appendLog(this.apFull, d.toString() + " Exception CRONTAB JOB (176): " + d.toString() + " Pulizia Log giornaliera \n" + job);
e.printStackTrace();
}
}
Calendar calNow = Calendar.getInstance();
long milsNow = calNow.getTimeInMillis();
calNow.set(14, 0);
calNow.set(13, 0);
sleep(60000L - milsNow + calNow.getTimeInMillis());
} catch (Exception e) {
e.printStackTrace();
}
continue;
}
this.isRunning = false;
}
instance.remove(getApFull().getApCode());
d = new Date(System.currentTimeMillis());
appendLog(this.apFull, endDashLine + endDashLine + " CrontabThread STOPPED!!\n" + d.toString());
System.out.println("\n" + d.toString() + " CrontabThread STOPPED!!");
setApFull(null);
}
public ApplParmFull getApFull() {
return this.apFull;
}
private void setApFull(ApplParmFull ap) {
this.apFull = ap;
}
private boolean eseguoJob(String currentJob) {
if (currentJob.trim().isEmpty() || currentJob.startsWith("#"))
return false;
java.util.StringTokenizer orari = new java.util.StringTokenizer(currentJob, " ");
if (orari.countTokens() >= 1 && orari.countTokens() <= 7) {
int minute = 0, hour = 0, mday = -1, month = -1, wday = -1;
int stepMinute = 0, stepHour = 0, stepMday = 0, stepMonth = 0, stepWday = 0;
boolean bMinute = false, bHour = false, bMday = false, bMonth = false, bWday = false;
Calendar cal = Calendar.getInstance();
int currentMese = cal.get(2);
int currentWday = cal.get(7);
int currentMday = cal.get(5);
int currentHour = cal.get(11);
int currentMin = cal.get(12);
if (orari.countTokens() >= 6) {
orari.nextToken();
String temp = orari.nextToken();
if (temp.startsWith("/")) {
stepMinute = Integer.parseInt(temp.substring(1));
if (currentMin % stepMinute == 0)
bMinute = true;
} else {
minute = temp.equals("*") ? -1 : Integer.parseInt(temp);
if (minute < 0 || currentMin == minute)
bMinute = true;
}
if (!bMinute)
return false;
temp = orari.nextToken();
if (temp.startsWith("/")) {
stepHour = Integer.parseInt(temp.substring(1));
if (currentHour % stepHour == 0)
bHour = true;
} else {
hour = temp.equals("*") ? -1 : Integer.parseInt(temp);
if (hour < 0 || currentHour == hour)
bHour = true;
}
if (!bHour)
return false;
temp = orari.nextToken();
if (temp.startsWith("/")) {
stepMday = Integer.parseInt(temp.substring(1));
if (currentMday % stepMday == 0)
bMday = true;
} else {
mday = temp.equals("*") ? -1 : Integer.parseInt(temp);
if (mday < 0 || currentMday == mday)
bMday = true;
}
if (!bMday)
return false;
temp = orari.nextToken();
if (temp.startsWith("/")) {
stepMonth = Integer.parseInt(temp.substring(1));
if (currentMese % stepMonth == 0)
bMonth = true;
} else {
month = temp.equals("*") ? -1 : Integer.parseInt(temp);
if (month < 0 || currentMese == month)
bMonth = true;
}
if (!bMonth)
return false;
temp = orari.nextToken();
if (temp.startsWith("/")) {
stepWday = Integer.parseInt(temp.substring(1));
if (currentWday % stepWday == 0)
bWday = true;
} else {
wday = temp.equals("*") ? -1 : Integer.parseInt(temp);
if (wday < 0 || currentWday == wday)
bWday = true;
}
if (!bMonth)
return false;
}
if (bHour && bMday && bMinute && bMonth && bWday)
return true;
return false;
}
String nomeJob = orari.nextToken();
Date d = new Date(System.currentTimeMillis());
appendLog(this.apFull, d.toString() + " CRONTAB JOB (379): " + d.toString() + "\nERRORE! riga crontab errata: " + nomeJob);
return false;
}
public static final ResParm appendLog(ApplParmFull ap, String msg) {
ResParm rp = new ResParm();
synchronized (ap) {
if (!ap.getParm("DAILY_CRONTAB_MAIN_LOG_FILE").getTesto().isEmpty())
FileLogger.getInstance(ap.getParm("DAILY_CRONTAB_MAIN_LOG_FILE").getTesto().trim()).writeMessage(msg);
Log.addAltro(ap, "localhost", 1L, msg);
}
return rp;
}
public static final ResParm clearLog(ApplParmFull ap) {
ResParm rp = new ResParm(true);
synchronized (ap) {
try {
File clog = new File(ap.getParm("DAILY_CRONTAB_MAIN_LOG_FILE").getTesto().trim());
if (clog.exists())
clog.delete();
clog.createNewFile();
} catch (Exception e) {
e.printStackTrace();
rp.setStatus(false);
rp.setMsg(e.getMessage());
}
}
return rp;
}
public static final String getLog(ApplParmFull ap) {
String logMsg = "";
File clog = new File(ap.getParm("DAILY_CRONTAB_MAIN_LOG_FILE").getTesto().trim());
if (clog.exists()) {
String NL = "\n";
try {
StringBuilder sb = new StringBuilder();
BufferedReader bufferedreader = new BufferedReader(new FileReader(
ap.getParm("DAILY_CRONTAB_MAIN_LOG_FILE").getTesto().trim()));
String s1;
while ((s1 = bufferedreader.readLine()) != null) {
sb.append(s1);
sb.append("\n");
}
bufferedreader.close();
logMsg = sb.toString();
} catch (Exception exception) {
exception.printStackTrace(System.out);
}
}
return logMsg;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,66 @@
package it.acxent.db;
import java.sql.SQLException;
public class DBAdapterException extends SQLException {
private ResParm rp = null;
private boolean duplicateKeyError = false;
private String mySQLState;
public DBAdapterException() {}
public DBAdapterException(Exception e) {
super(e.toString());
}
public DBAdapterException(String s) {
super(s);
}
public DBAdapterException(String s, ResParm rp) {
super(s);
setRp(rp);
}
public DBAdapterException(SQLException sqle) {
super(sqle.getMessage());
setSQLState(sqle.getSQLState());
if (sqle.getSQLState() != null)
if (sqle.getSQLState().equals("S1000") ||
sqle.getSQLState().equals("S1009")) {
this.duplicateKeyError = true;
} else {
this.duplicateKeyError = false;
}
}
public String getMessage() {
if (isDuplicateKeyError())
return "Duplicated Key error!!!";
return super.getMessage();
}
public ResParm getRp() {
return this.rp;
}
public String getSQLState() {
if (this.mySQLState == null)
return super.getSQLState();
return this.mySQLState;
}
public boolean isDuplicateKeyError() {
return this.duplicateKeyError;
}
private void setRp(ResParm newRp) {
this.rp = newRp;
}
private void setSQLState(String newSQLState) {
this.mySQLState = newSQLState;
}
}

View file

@ -0,0 +1,35 @@
package it.acxent.db;
public class DBAdapterNoDb extends DBAdapter {
private static final long serialVersionUID = -6061346319271726745L;
public ResParm delete() {
return null;
}
public void findByPrimaryKey(Object obj) {}
public int getDBState() {
return 1;
}
public ResParm save() {
return null;
}
public void setNuovaIstanzaOggettoRemoto(boolean flag) {}
public Object[] getFieldSetArg(String parmValue, Class<?> type) {
return null;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
protected boolean isDatabaseBean() {
return false;
}
}

View file

@ -0,0 +1,61 @@
package it.acxent.db;
public class DBAdapterSaveResponse {
private String _id;
private String lastUpdTmst;
private String lastUpdInfo;
private String msg;
private boolean status;
public DBAdapterSaveResponse(String _id, String lastUpdTmst, String lastUpdInfo, String msg, boolean status) {
this._id = _id;
this.lastUpdInfo = lastUpdInfo;
this.lastUpdTmst = lastUpdTmst;
this.msg = msg;
this.status = status;
}
public String get_id() {
return this._id;
}
public void set_id(String _id) {
this._id = _id;
}
public String getMsg() {
return this.msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getLastUpdTmst() {
return this.lastUpdTmst;
}
public void setLastUpdTmst(String lastUpdTmst) {
this.lastUpdTmst = lastUpdTmst;
}
public String getLastUpdInfo() {
return this.lastUpdInfo;
}
public void setLastUpdInfo(String lastUpdInfo) {
this.lastUpdInfo = lastUpdInfo;
}
public boolean isStatus() {
return this.status;
}
public void setStatus(boolean dbStatus) {
this.status = dbStatus;
}
}

View file

@ -0,0 +1,46 @@
package it.acxent.db;
import it.acxent.util.Debug;
import it.acxent.util.SimpleDateFormat;
import java.sql.Date;
import java.text.ParseException;
public abstract class DBReflectAdapter extends Debug implements DBReflectInterface {
private ApplParm fieldAp;
public ApplParm getApFull() {
return this.fieldAp;
}
public Object[] getFieldSetArg(String parmValue, Class type) throws ParseException {
Object[] retParm = { null };
if (type.equals(String.class)) {
retParm[0] = parmValue;
} else if (type.equals(Long.class) ||
type.getName().equals("long")) {
retParm[0] = new Long(parmValue);
} else if (type.equals(Integer.class) ||
type.getName().equals("int")) {
retParm[0] = new Integer(parmValue);
} else if (type.equals(Double.class) ||
type.getName().equals("double")) {
retParm[0] = Double.valueOf(parmValue.replace(',', '.'));
} else if (type.equals(Float.class) ||
type.getName().equals("float")) {
retParm[0] = Float.valueOf(parmValue.replace(',', '.'));
} else if (type.equals(Date.class)) {
try {
retParm[0] = new Date(getApFull().getDataFormat().parse(parmValue)
.getTime());
} catch (ParseException e) {}
retParm[0] = new Date(new SimpleDateFormat("dd/MM/yy")
.parse(parmValue).getTime());
}
return retParm;
}
public void setAp(ApplParm newFieldAp) {
this.fieldAp = newFieldAp;
}
}

View file

@ -0,0 +1,7 @@
package it.acxent.db;
import java.text.ParseException;
public interface DBReflectInterface {
Object[] getFieldSetArg(String paramString, Class paramClass) throws ParseException;
}

View file

@ -0,0 +1,67 @@
package it.acxent.db;
import it.acxent.common.DescLangItem;
import it.acxent.util.Vectumerator;
import java.util.Vector;
public interface DbInterface {
ResParm delete();
Vectumerator<? extends DBAdapter> findAll();
Vectumerator<? extends DBAdapter> findAll(int paramInt1, int paramInt2);
void findByPrimaryKey(Object paramObject);
int getDBState();
ResParm save();
ResParm translateAllDbDesc(String paramString);
String getReqIpAddress();
void setReqIpAddress(String paramString);
boolean useDescLangTables();
boolean isGoogleTranslatorEnable();
void setDescTxtLangValues(Vector<DescLangItem> paramVector);
String getCurrentFocus();
String getCurrentLang();
String getCurrentTab();
String getLastUpdTmstString();
String getLastUpdTmstForFiles();
String get_Id();
long get_IdL();
String get_IdName();
String getReqUrl();
String getSqlQuery();
String getVersionDB();
String getVersionDBLte();
String getVersionDBLte4();
String getVersionLib();
String getVersionLibLte();
String getVersionLibLte4();
String getVersionLibLte4(String paramString);
String getVersionHtml();
}

View file

@ -0,0 +1,144 @@
package it.acxent.db;
import java.io.Serializable;
public class DriversJdbc implements Serializable {
private static final long serialVersionUID = -6271689236194338969L;
public static final String SLQSTATE_COMMUNICATION_ERROR = "08S01";
public static final String SLQSTATE_SQLSERVER_LOCK_REQUEST_TIME_EXEDEED = "S0003";
public static final String SLQSTATE_INTEGRITY_CONSTRAINT_VIOLATION = "23000";
public static final String MYSQL_UTF8_CONNECTION_STRING = "?useUnicode=true&characterEncoding=UTF-8";
private static final int TOT_NUMBER_OF_DRIVERS = 18;
public static final int JDBC_ODBC = 0;
public static final int ORACLE = 1;
public static final int HSQLDB = 2;
public static final int MYSQL_CONNECTORJ = 3;
public static final int POSTGRES = 4;
public static final int MARIA_DB = 5;
public static final int SYBASE = 6;
public static final int INTERBASE = 7;
public static final int DB2 = 8;
public static final int INFORMIX = 9;
public static final int ZYH_DBF = 10;
public static final int ATINAV_ACCESS = 11;
public static final int EASY_JDBC = 12;
public static final int MS_SQL_SERVER_2000 = 13;
public static final int MS_SQL_SERVER_2005_2008 = 14;
public static final int PERVASIVE_PSQL_JDBC = 15;
public static final int UCANACCESS = 16;
public static final int MYSQL8_CONNECTORJ = 17;
private static String[] driverDescription;
private static String[] driverManager;
private static String[] connectionString;
public static final String LAST_INSERT_ID_MYSQL = "Select LAST_INSERT_ID() as id ";
public static final String LAST_INSERT_ID_MS_SQL_SERVER = "SELECT @@IDENTITY AS id ";
public static final String LAST_INSERT_ID_INFORMIX = "Select dbinfo('sqlca.sqlerrd1') as id from ";
public static String getConnectionString(int i) {
if (connectionString == null) {
connectionString = new String[18];
connectionString[0] = "jdbc:odbc";
connectionString[1] = "jdbc:oracle";
connectionString[2] = "jdbc:hsqldb";
connectionString[3] = "jdbc:mysql";
connectionString[4] = "jdbc:postgresql";
connectionString[5] = "jdbc:mariadb";
connectionString[6] = "jdbc:sybase:Tds";
connectionString[7] = "jdbc:interbase";
connectionString[8] = "jdbc:db2";
connectionString[9] = "jdbc:informix-sqli";
connectionString[10] = "jdbc:DBF";
connectionString[11] = "jdbc:atinav";
connectionString[12] = "jdbc:easysoft";
connectionString[13] = "jdbc:microsoft:sqlserver";
connectionString[14] = "jdbc:sqlserver";
connectionString[15] = "jdbc:pervasive";
connectionString[16] = "jdbc:ucanaccess";
connectionString[17] = "jdbc:mysql";
}
return connectionString[i];
}
public static String getDriverDescription(int i) {
if (driverDescription == null) {
driverDescription = new String[18];
driverDescription[0] = "JDBC-ODBC:\t<data-source-name>[;<attribute-name>=<attribute-value>] (es:UID=me;PWD=secret)";
driverDescription[1] = "ORACLE THIN: ";
driverDescription[2] = "HSQLDB DRIVER:\thsql://[hostname] (Server Mode)\n\t\t[DatabasePath] (Stand alone)";
driverDescription[3] = "jdbc:mysql://[hostname][,failoverhost...][:port]/[dbname][?param1=value1][&param2=value2]";
driverDescription[4] = "POSTGRES:\t[//[hostname]/][dbname]:";
driverDescription[5] = "MARIA DB:\t//[hostname][:port]/[DB?user=[dbuser]&password=[dbpassword]]: ";
driverDescription[6] = "SYBASE: ";
driverDescription[7] = "INTERBASE: ";
driverDescription[8] = "DB2: ";
driverDescription[9] = "INFORMIX IFX:\t[//][host]:[port]/[dbname]:INFORMIXSERVER=[dbservername]: ";
driverDescription[10] = "ZYH DBF-FOXPRO:\t/[path to dbf files] or [//][host][:port]/[DatabasePath]: ";
driverDescription[11] = "ATINAV-ACCESS:\t[hostname]:[serverportno]:[databasepath] (port usually is 7227): ";
driverDescription[12] = "EasySoft JDBC-ODBC:\t//[hostname]/[DSN]: ";
driverDescription[13] = "MS Sql Server 2000 JDBC driver:\t//[hostname]:1433;databaseName=[dbname];user=[dbuser];password=[dbpassword];: ";
driverDescription[14] = "MS Sql Server 2005/2008 JDBC driver:\t//[hostname]:1433;databaseName=[dbname];user=[dbuser];password=[dbpassword];: ";
driverDescription[15] = "Pervasive PSQL 10 JDBC driver:\t//[hostname]:1583/[DATABASE][;encoding=;encrypt=;encryption=] ";
driverDescription[16] = "UCanAccess JDBC driver:\t//db_or_accdb_file_path";
driverDescription[17] = "MYSQL8 - jdbc:mysql://[hostname][,failoverhost...][:port]/[dbname][?param1=value1][&param2=value2]";
}
return driverDescription[i];
}
public static String getDriverManager(int i) {
if (driverManager == null) {
driverManager = new String[18];
driverManager[0] = "sun.jdbc.odbc.JdbcOdbcDriver";
driverManager[1] = "oracle.jdbc.ddndlthin";
driverManager[2] = "org.hsqldb.jdbcDriver";
driverManager[3] = "com.mysql.jdbc.Driver";
driverManager[4] = "org.postgresql.Driver";
driverManager[5] = "org.mariadb.jdbc.Driver";
driverManager[6] = "com.sybase.jdbc.SybDriver";
driverManager[7] = "interbase.interclient.Driver";
driverManager[8] = "COM.ibm.db2.jdbc.app.DB2Driver";
driverManager[9] = "com.informix.jdbc.IfxDriver";
driverManager[10] = "zyh.sql.dbf.DBFDriver";
driverManager[11] = "acs.jdbc.Driver";
driverManager[12] = "easysoft.sql.jobDriver";
driverManager[13] = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
driverManager[14] = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
driverManager[15] = "com.pervasive.jdbc.v2.Driver";
driverManager[16] = "net.ucanaccess.jdbc.UcanaccessDriver";
driverManager[17] = "com.mysql.cj.jdbc.Driver";
}
return driverManager[i];
}
public static int getTotNumberOfDrivers() {
return 18;
}
}

View file

@ -0,0 +1,61 @@
package it.acxent.db;
import java.io.Serializable;
public class EncodedField implements Serializable {
private static final long serialVersionUID = 5011020454180333811L;
public static final long MODALITA_MASTER = 0L;
public static final long MODALITA_USER = 1L;
public EncodedField(boolean codifica, long flgAlgoritmo, long modalita) {
this.flgAlgoritmo = flgAlgoritmo;
this.codifica = codifica;
this.flgModalita = modalita;
}
private long flgAlgoritmo = 1L;
private boolean codifica = false;
private long flgModalita;
public EncodedField() {}
public long getFlgAlgoritmo() {
return this.flgAlgoritmo;
}
public void setFlgAlgoritmo(long flgAlgoritmo) {
this.flgAlgoritmo = flgAlgoritmo;
}
public boolean isCodifica() {
return this.codifica;
}
public void setCodifica(boolean codifica) {
this.codifica = codifica;
}
public long getFlgModalita() {
return this.flgModalita;
}
public void setFlgModalita(long modalita) {
this.flgModalita = modalita;
}
public String getEncodedFieldsPrefix() {
return "" + getFlgModalita() + "," + getFlgModalita() + ",0";
}
public static final String getModalita(long l_flgModalita) {
if (l_flgModalita == 0L)
return "Master Key";
if (l_flgModalita == 1L)
return "User";
return "";
}
}

View file

@ -0,0 +1,18 @@
package it.acxent.db;
import java.util.Comparator;
import java.util.Map;
public class FieldsComparator implements Comparator<Object> {
Map<String, FieldsDescriptor> map;
public FieldsComparator(Map<String, FieldsDescriptor> map) {
this.map = map;
}
public int compare(Object o1, Object o2) {
if (this.map.get(o1).getOrder() == this.map.get(o2).getOrder())
return 1;
return Long.valueOf(this.map.get(o1).getOrder()).compareTo(Long.valueOf(this.map.get(o2).getOrder()));
}
}

View file

@ -0,0 +1,54 @@
package it.acxent.db;
import java.io.Serializable;
public class FieldsDescriptor implements Serializable {
private static final long serialVersionUID = 556854217105509091L;
private String fieldName;
private long order;
private String desc;
private String val;
public FieldsDescriptor(String fieldName, long order, String desc, String val) {
this.fieldName = fieldName;
this.order = order;
this.desc = desc;
this.val = val;
}
public String getFieldName() {
return (this.fieldName == null) ? "" : this.fieldName.trim();
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
public long getOrder() {
return this.order;
}
public void setOrder(long order) {
this.order = order;
}
public String getDesc() {
return (this.desc == null) ? "" : this.desc.trim();
}
public void setDesc(String desc) {
this.desc = (desc == null) ? "" : desc.trim();
}
public String getVal() {
return (this.val == null) ? "" : this.val.trim();
}
public void setVal(String val) {
this.val = val;
}
}

View file

@ -0,0 +1,88 @@
package it.acxent.db;
import it.acxent.util.Debug;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class JdbcStub extends Debug {
private boolean isRegistered;
private Statement stmt;
private ResultSet rst;
private Connection conn;
private ApplParm ap;
public JdbcStub(ApplParm applparm) throws SQLException {
this.isRegistered = false;
this.ap = applparm;
if (!this.isRegistered)
synchronized (this) {
try {
Class.forName(this.ap.getDriverManager()).newInstance();
} catch (Exception exception) {
System.err.println("Errore: " + exception.getMessage());
}
this.isRegistered = true;
}
String s = this.ap.getConnectionString() + ":" + this.ap.getConnectionString();
handleDebug("Connecting... with " + s + " user:" + this.ap.getUser() + " Pwd:" + this.ap.getPassword());
if (this.ap.getUser().isEmpty()) {
setConn(DriverManager.getConnection(s));
} else {
setConn(DriverManager.getConnection(s, this.ap.getUser(), this.ap.getPassword()));
}
handleDebug("Connessione ok");
}
public JdbcStub(Connection connection) {
this.isRegistered = false;
this.conn = connection;
}
public void Close() throws SQLException {
if (this.stmt != null)
this.stmt.close();
}
public ResultSet ExecuteQuery(String s) throws SQLException {
try {
this.stmt = this.conn.createStatement();
this.rst = this.stmt.executeQuery(s);
return this.rst;
} catch (SQLException _ex) {
throw _ex;
}
}
public int ExecuteUpdate(String s) throws SQLException {
Close();
try {
this.stmt = this.conn.createStatement();
int i = this.stmt.executeUpdate(s);
return i;
} catch (SQLException sqlexception) {
sqlexception.printStackTrace(System.out);
throw new SQLException();
} finally {
this.stmt.close();
}
}
protected void finalize() throws SQLException {
Close();
}
public Connection getConn() {
return this.conn;
}
public void setConn(Connection connection) {
this.conn = connection;
}
}

Some files were not shown because too many files have changed in this diff Show more