Fabio Dalle Ave 2 месяцев назад
Родитель
Сommit
ee56008d61

+ 0 - 51
src/main/java/commons/exception/WebValidateActionException.java

@@ -1,51 +0,0 @@
-package commons.exception;
-
-import commons.utility.exception.WebActionException;
-
-
-
-public class WebValidateActionException extends WebActionException
-{
-
-	/**
-     * Comment for <code>serialVersionUID</code>
-     */
-    private static final long serialVersionUID = 1L;
-
-    /**
-	 * @param action
-	 */
-	public WebValidateActionException(String action)
-	{
-		super(action);
-	}
-
-	/**
-	 * @param message
-	 * @param action
-	 */
-	public WebValidateActionException(String message, String action)
-	{
-		super(message, action);
-	}
-
-	/**
-	 * @param message
-	 * @param cause
-	 * @param action
-	 */
-	public WebValidateActionException(String message, Throwable cause, String action)
-	{
-		super(message, cause, action);
-	}
-
-	/**
-	 * @param cause
-	 * @param action
-	 */
-	public WebValidateActionException(Throwable cause, String action)
-	{
-		super(cause, action);
-	}
-
-}

+ 0 - 0
src/main/java/commons/type/ModifyException.java


+ 0 - 209
src/main/java/commons/utility/dao/GenericHibernateDaoSupport.java

@@ -1,209 +0,0 @@
-package commons.utility.dao;
-
-import java.io.Serializable;
-import java.lang.reflect.ParameterizedType;
-import java.util.List;
-
-import org.hibernate.HibernateException;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.dao.DataAccessException;
-
-import commons.exception.ZSystemException;
-
-public abstract class GenericHibernateDaoSupport<T, ID extends Serializable> implements IGenericHibernateDaoSupport<T, ID>
-{
-
-	@Autowired
-	private SessionFactory sessionFactory;
-
-	private Class<T> persistentClass;
-
-	@SuppressWarnings("unchecked")
-	public GenericHibernateDaoSupport()
-	{
-		this.persistentClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
-	}
-
-	public Session currentSession() {
-		return sessionFactory.getCurrentSession();
-	}
-
-	@SuppressWarnings("unchecked")
-	public T get(ID id) throws ZDAOException
-	{
-		try
-		{
-			return (T) currentSession().get(getPersistentClass(), id);
-		}
-		catch (HibernateException e)
-		{
-			throw new ZDAOException(e);
-		}
-	}
-
-	public T save(T entity) throws ZDAOException
-	{
-		try
-		{
-			currentSession().saveOrUpdate(entity);
-			return entity;
-		}
-		catch (HibernateException e)
-		{
-			throw new ZDAOException(e);
-		}
-	}
-
-	public void delete(T entity) throws ZDAOException
-	{
-		try
-		{
-			currentSession().delete(entity);
-		}
-		catch (HibernateException e)
-		{
-			throw new ZDAOException(e);
-		}
-	}
-
-	public void delete(ID id) throws ZDAOException
-	{
-		try
-		{
-			T entity = get(id);
-			if (entity != null) {
-				currentSession().delete(entity);
-			}
-		}
-		catch (HibernateException e)
-		{
-			throw new ZDAOException(e);
-		}
-	}
-
-	public List<T> getElenco() throws ZDAOException
-	{
-		try
-		{
-			String hql = "from " + getPersistentClass().getSimpleName();
-			return currentSession().createQuery(hql, getPersistentClass()).list();
-		}
-		catch (HibernateException e)
-		{
-			throw new ZDAOException(e);
-		}
-	}
-
-	protected Class<T> getPersistentClass()
-	{
-		return this.persistentClass;
-	}
-
-	static public interface InternalHibernateCallback
-	{
-		public Object doInHibernate(Session session) throws DataAccessException;
-	}
-
-	protected Object execute(final InternalHibernateCallback internalHibernateCallback) throws ZDAOException
-	{
-		try
-		{
-			return internalHibernateCallback.doInHibernate(currentSession());
-		}catch(DataAccessException e)
-		{
-			throw new ZDAOException(e);
-		}
-	}
-	protected Object execute(final InternalHibernateCallback internalHibernateCallback, boolean exposeNativeSession) throws ZDAOException
-	{
-		try
-		{
-			return internalHibernateCallback.doInHibernate(currentSession());
-		}catch(DataAccessException e)
-		{
-			throw new ZDAOException(e);
-		}
-	}
-
-    @SuppressWarnings("unchecked")
-	protected List executeFind(final InternalHibernateCallback internalHibernateCallback) throws ZDAOException
-    {
-    	try
-		{
-			return (List) internalHibernateCallback.doInHibernate(currentSession());
-		}catch(DataAccessException e)
-		{
-			throw new ZDAOException(e);
-		}
-	}
-
-	static public class ZDAOHibernateException extends RuntimeException
-	{
-		private static final long serialVersionUID = 1L;
-
-		public ZDAOHibernateException()
-		{
-			super("");
-		}
-
-		public ZDAOHibernateException(String message)
-		{
-			super(message);
-		}
-
-		public ZDAOHibernateException(Exception e)
-		{
-			super(e);
-		}
-
-		public ZDAOHibernateException(Throwable e)
-		{
-			super(e);
-		}
-
-	}
-
-	static public class ZDAOHibernateMaxRowLimitException extends ZDAOHibernateException
-	{
-		private static final long serialVersionUID = 1L;
-
-		private Object struct = null;
-
-		public ZDAOHibernateMaxRowLimitException(Object struct)
-		{
-			this.struct = struct;
-		}
-
-		public Object getObject()
-		{
-			return this.struct;
-		}
-	}
-
-	static public class ZDAOHibernateNonUniqueResultException extends ZDAOHibernateException
-	{
-		private static final long serialVersionUID = 1L;
-
-		public ZDAOHibernateNonUniqueResultException()
-		{
-			super("");
-		}
-
-		public ZDAOHibernateNonUniqueResultException(String message)
-		{
-			super(message);
-		}
-
-		public ZDAOHibernateNonUniqueResultException(Exception e)
-		{
-			super(e);
-		}
-
-		public ZDAOHibernateNonUniqueResultException(Throwable e)
-		{
-			super(e);
-		}
-	}
-}

+ 0 - 48
src/main/java/commons/utility/dao/IGenericHibernateDaoSupport.java

@@ -1,48 +0,0 @@
-package commons.utility.dao;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * Interface generica per i DAO. L'implementazione si basa su HibernateDaoSupport
- * Dichiara i metodi comuni a tutti i DAO
- *
- * @param <T>	classe persistente
- * @param <ID>	classe della chiave primaria
- */
-public interface IGenericHibernateDaoSupport<T,ID extends Serializable>
-{
-	/**
-	 * Get generico
-	 * @param id
-	 * @return la struttura o null se non esiste
-	 */
-	public abstract T get(ID id) throws ZDAOException;
-
-	/**
-	 * Lista senza filtro della struttura
-	 * @return
-	 */
-	public abstract List<T> getElenco() throws ZDAOException;
-
-	/**
-	 * Metodo generico per salvare/aggiornare la struttura
-	 * @param entity
-	 * @return
-	 */
-	public abstract T save(T entity) throws ZDAOException;
-
-	/**
-	 * Metodo generico per cancellare una struttura
-	 * @param entity
-	 * @param hd
-	 */
-	public abstract void delete(T entity) throws ZDAOException;
-
-	/**
-	 * Metodo generico per cancellare una struttura dato l'id
-	 * @param id
-	 * @param hd
-	 */
-	public abstract void delete(ID id) throws ZDAOException;
-}

+ 0 - 30
src/main/java/commons/utility/dao/ZDAOException.java

@@ -1,30 +0,0 @@
-package commons.utility.dao;
-
-public class ZDAOException extends Exception {
-	
-	private static final long serialVersionUID = 1L;
-
-	public ZDAOException()
-	{
-		super();
-	}
-	
-	public ZDAOException(String message)
-	{
-		super(message);
-	}
-	
-	public ZDAOException(Exception e)
-	{
-		super(e);
-	}
-	
-	public ZDAOException(Throwable e)
-	{
-		super(e);
-	}
-	public ZDAOException(String message, Throwable e)
-	{
-		super(message, e);
-	}
-}

+ 0 - 2
src/main/java/commons/utility/database/DatabaseFactory.java

@@ -9,7 +9,6 @@ import org.hibernate.jdbc.ReturningWork;
 
 import commons.utility.database.hibernate.HibernateDatabase;
 import commons.utility.database.hibernate.HibernateDatabaseAsGenericDatabase;
-import commons.utility.database.postgressql.PostgresSqlDatabase;
 import commons.exception.ZDataBaseException;
 
 public class DatabaseFactory {
@@ -33,7 +32,6 @@ public class DatabaseFactory {
 	{
 		IDatabase db = null;
 
-		db = new PostgresSqlDatabase(cn);
 
 		return db;
 	}

+ 0 - 110
src/main/java/commons/utility/database/DbQuery.java

@@ -1,110 +0,0 @@
-package commons.utility.database;
-
-import commons.exception.ZSystemException;
-import commons.exception.ZDataBaseException;
-
-abstract public class DbQuery
-{
-	private GenericDatabase db = null;
-	protected ISpStatement spStat = null;
-	protected IResultSet rs = null;
-	protected int counter;
-
-	private String spName = null;
-	private int numPar;
-
-	public DbQuery(final GenericDatabase database,String spName, int numPar) throws ZDataBaseException
-	{
-		this.db = database;
-		this.spName = spName;
-		this.numPar = numPar;
-	}
-
-	public void execute() throws ZDataBaseException, ZSystemException {
-		try {
-			spStat = db.getSpQueryStatment(spName, numPar);
-			initParam();
-			rs = spStat.executeQuery();
-			counter = 1;
-			while (rs.next()) {
-				readRecord();
-				counter++;
-			}
-			DatabaseFactory.closeAll(null, spStat, rs);
-			spStat = null;
-			rs = null;
-			db = null;
-		} catch (ZDataBaseException e) {
-			onError(e);
-			throw e;
-		} finally {
-			try
-			{
-				DatabaseFactory.closeAll(null, spStat, rs);
-			}
-			catch (ZDataBaseException e)
-			{
-				throw e;
-			}
-			db = null;
-			spStat = null;
-			rs = null;
-		}
-	}
-
-	public void executeNoRs() throws ZDataBaseException {
-		try {
-			spStat = db.getSpQueryStatment(spName, numPar);
-			initParam();
-			spStat.execute();
-			DatabaseFactory.closeAll(null, spStat, null);
-			spStat = null;
-			db = null;
-		} catch (ZDataBaseException e) {
-			onError(e);
-			throw e;
-		} finally {
-			try
-			{
-				DatabaseFactory.closeAll(null, spStat, null);
-			}
-			catch (ZDataBaseException e)
-			{
-				throw e;
-			}
-			db = null;
-			spStat = null;
-		}
-	}
-
-	public void executeUpdate() throws ZDataBaseException {
-		try {
-			spStat = db.getSpQueryStatment(spName, numPar);
-			initParam();
-			spStat.executeUpdate();
-			DatabaseFactory.closeAll(null, spStat, null);
-			db = null;
-			spStat = null;
-		} catch (ZDataBaseException e) {
-			onError(e);
-			throw e;
-		} finally {
-			try
-			{
-				DatabaseFactory.closeAll(null, spStat, null);
-			}
-			catch (ZDataBaseException e)
-			{
-				throw e;
-			}
-			db = null;
-			spStat = null;
-		}
-	}
-
-	abstract public void initParam() throws ZDataBaseException;
-
-	abstract public void readRecord() throws ZDataBaseException, ZSystemException;
-
-	abstract public void onError(Throwable ex);
-}

+ 0 - 49
src/main/java/commons/utility/database/DbQuerySQL.java

@@ -1,49 +0,0 @@
-package commons.utility.database;
-
-import commons.exception.ZDataBaseException;
-
-abstract public class DbQuerySQL {
-	private IDatabase db = null;
-	protected ISqlStatement spStat = null;
-	protected IResultSet rs = null;
-	protected int counter;
-
-	private String cmd = null;
-
-	public DbQuerySQL(final GenericDatabase database, String cmd) {
-		this.db = database;
-		this.cmd = cmd;
-	}
-
-	public void execute() throws ZDataBaseException {
-		try {
-			spStat = db.getSpUpdateStatment(cmd);
-			rs = spStat.executeQuery();
-			counter = 1;
-			while (rs.next()) {
-				readRecord();
-				counter++;
-			}
-
-			DatabaseFactory.closeAll(null, spStat, rs);
-			db = null;
-			spStat = null;
-			rs = null;
-		} catch (ZDataBaseException e) {
-			throw e;
-		} finally {
-			try {
-				DatabaseFactory.closeAll(null, spStat, rs);
-			} catch (ZDataBaseException e) {
-				throw e;
-			}
-			db = null;
-			spStat = null;
-			rs = null;
-		}
-	}
-
-	abstract public void onError(Throwable ex);
-
-	abstract public void readRecord() throws ZDataBaseException;
-}

+ 0 - 161
src/main/java/commons/utility/database/DbUpdate.java

@@ -1,161 +0,0 @@
-package commons.utility.database;
-
-import java.lang.reflect.Array;
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-import commons.exception.ZSystemException;
-import commons.exception.ZDataBaseException;
-import commons.exception.ZDbUpdateException;
-
-abstract public class DbUpdate {
-	private IDatabase db = null;
-	protected ISpStatement spStat = null;
-	protected int counter = 1;
-	protected ZDbUpdateException ex = new ZDbUpdateException();
-
-	private String spName = null;
-	private int numPar;
-
-	private Iterator iter = null;
-
-	public DbUpdate(final GenericDatabase database, String spName, int numPar, Object obj)
-	{
-		db = database;
-		this.spName = spName;
-		this.numPar = numPar;
-		this.iter = createIterator(obj);
-	}
-
-	public DbUpdate(final GenericDatabase database, String spName, int numPar) throws ZDataBaseException
-	{
-		this(database,spName,numPar,null);
-	}
-
-	public void execute() throws ZDbUpdateException, ZSystemException {
-		boolean error = false;
-		try {
-			spStat = db.getSpUpdateStatment(spName, numPar);
-			counter = 1;
-			while (iter.hasNext()) {
-				try {
-					initParam(iter.next());
-					spStat.executeUpdate();
-					getOutputParam();
-				} catch (ZDataBaseException e) {
-					onError(e);
-					ex.addStackTrace(e);
-					error = true;
-				} 
-				counter++;
-			}
-			DatabaseFactory.closeAll(null, spStat, null);
-			db = null;
-			spStat = null;
-		} catch (ZDataBaseException e) {
-			onError(e);
-			ex.addStackTrace(e);
-			error = true;
-		} finally {
-			try {
-				DatabaseFactory.closeAll(null, spStat, null);
-			} catch (ZDataBaseException e) {
-				onError(e);
-				ex.addStackTrace(e);
-				error = true;
-			}
-			db = null;
-			spStat = null;
-		}
-		if (error) {
-			throw ex;
-		}
-	}
-
-	public void executeNoRs() throws ZSystemException {
-		try {
-			spStat = db.getSpUpdateStatment(spName, numPar);
-			initParam(null);
-			spStat.execute();
-			getOutputParam();
-			DatabaseFactory.closeAll(null, spStat, null);
-			db = null;
-			spStat = null;
-		} catch (ZDataBaseException e) {
-			onError(e);
-			throw e;
-		} finally {
-			try {
-				DatabaseFactory.closeAll(null, spStat, null);
-			} catch (ZDataBaseException e) {
-				onError(e);
-				throw e;
-			}
-			db = null;
-			spStat = null;
-		}
-	}
-
-	private Iterator createIterator(final Object obj) {
-		if (null != obj) {
-			if (obj instanceof Iterator) {
-				return (Iterator)obj;
-			}
-
-			if (obj.getClass().isArray()) {
-				if (!obj.getClass().getComponentType().isPrimitive()) {
-					return new Iterator() {
-						int index = 0;
-						public void remove() {
-						}
-
-						public boolean hasNext() {
-							return index < ((Object[])obj).length;
-						}
-
-						public Object next() {
-							return ((Object[])obj)[index++];
-						}
-					};
-				}
-				return new Iterator() {
-					int index = 0;
-					public void remove() {
-					}
-
-					public boolean hasNext() {
-						return index < Array.getLength(obj);
-					}
-
-					public Object next() {
-						return Array.get(obj, index++);
-					}
-				};
-			}
-		}
-
-		return new Iterator() {
-			boolean letto = false;
-			public void remove() {
-			}
-
-			public boolean hasNext() {
-				return !letto;
-			}
-
-			public Object next() {
-				if (letto)
-					throw new NoSuchElementException();
-				letto = true;
-				return obj;
-			}
-		};
-	}
-
-	abstract public void initParam(Object obj) throws ZDataBaseException, ZSystemException;
-
-	abstract public void getOutputParam() throws ZDataBaseException, ZSystemException;
-
-	abstract public void onError(Throwable ex);
-
-}

+ 0 - 39
src/main/java/commons/utility/database/DbUpdateSQL.java

@@ -1,39 +0,0 @@
-package commons.utility.database;
-
-import commons.exception.ZDataBaseException;
-
-abstract public class DbUpdateSQL {
-	private IDatabase db = null;
-	protected ISqlStatement spStat = null;
-
-	private String cmd = null;
-
-	public DbUpdateSQL(final GenericDatabase database, String cmd) {
-		this.db = database;
-		this.cmd = cmd;
-	}
-
-	public void execute() throws ZDataBaseException {
-		try {
-			spStat = db.getSpUpdateStatment(cmd);
-			spStat.executeUpdate();
-
-			DatabaseFactory.closeAll(null, spStat, null);
-			db = null;
-			spStat = null;
-		} catch (ZDataBaseException e) {
-			throw e;
-		} finally {
-			try {
-				DatabaseFactory.closeAll(null, spStat, null);
-			} catch (ZDataBaseException e) {
-				throw e;
-			}
-			db = null;
-			spStat = null;
-		}
-	}
-
-	abstract public void onError(Throwable ex);
-
-}

+ 0 - 165
src/main/java/commons/utility/database/postgressql/PostgresSqResultSet.java

@@ -1,165 +0,0 @@
-package commons.utility.database.postgressql;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-import java.util.Date;
-
-
-import commons.utility.Compression;
-import commons.utility.database.DatabaseFactory;
-import commons.utility.database.IResultSet;
-import commons.utility.database.NullValue;
-import commons.exception.ZCompressException;
-import commons.exception.ZDataBaseException;
-
-public class PostgresSqResultSet implements IResultSet {
-	ResultSet m_rs = null;
-	public PostgresSqResultSet(ResultSet rs) {
-		m_rs = rs;
-	}
-	public boolean next() throws ZDataBaseException {
-		try
-		{
-			return m_rs.next();
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public byte[] getBlob(int pos, boolean decompress) throws ZDataBaseException, ZCompressException {
-		try
-		{
-			byte[] value = m_rs.getBytes(pos);
-			if (decompress == true && value != null)
-				value = Compression.Decompress(value);
-			return value;
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-		catch (ZCompressException e)
-		{
-			throw e;
-		}
-	}
-	public byte getByte(int pos) throws ZDataBaseException {
-		try
-		{
-			return m_rs.getByte(pos);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public Date getDate(int pos) throws ZDataBaseException {
-		try
-		{
-			Timestamp ts = m_rs.getTimestamp(pos);
-			if (ts != null)
-				return new Date(ts.getTime());
-			return null;
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public double getDouble(int pos) throws ZDataBaseException {
-		try
-		{
-			return m_rs.getDouble(pos);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public float getFloat(int pos) throws ZDataBaseException {
-		try
-		{
-			return m_rs.getFloat(pos);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public int getInt(int pos) throws ZDataBaseException {
-		try
-		{
-			return m_rs.getInt(pos);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public long getLong(int pos) throws ZDataBaseException {
-		try
-		{
-			return m_rs.getLong(pos);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public short getShort(int pos) throws ZDataBaseException {
-		try
-		{
-			return m_rs.getShort(pos);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public String getString(int pos) throws ZDataBaseException {
-		try
-		{
-			String value = m_rs.getString(pos);
-			if (value != null) {
-				value = value.trim();
-			} else {
-				value = NullValue.STRING;
-			}
-			return value;
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public boolean getBit(int pos) throws ZDataBaseException {
-		try
-		{
-			boolean rsl;
-			if (m_rs.getByte(pos) == 1)
-				rsl = true;
-			else
-				rsl = false;
-			return rsl;
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void close() throws ZDataBaseException {
-		try
-		{
-			if (m_rs != null)
-				m_rs.close();
-			m_rs = null;
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-
-}

+ 0 - 234
src/main/java/commons/utility/database/postgressql/PostgresSqSqlStatement.java

@@ -1,234 +0,0 @@
-package commons.utility.database.postgressql;
-
-import java.io.ByteArrayInputStream;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.GregorianCalendar;
-
-import commons.utility.Compression;
-import commons.utility.database.DatabaseFactory;
-import commons.utility.database.IResultSet;
-import commons.utility.database.ISqlStatement;
-import commons.utility.database.NullValue;
-import commons.exception.ZCompressException;
-import commons.exception.ZDataBaseException;
-
-class PostgresSqSqlStatement implements ISqlStatement {
-	PreparedStatement m_ps = null;
-
-	public PostgresSqSqlStatement(PreparedStatement ps) {
-		m_ps = ps;
-	}
-
-	//////////////////////////////////////////////////////////////////////////////
-	//Parametri di INPUT
-	public void setInBlob(int pos, byte[] value, boolean compression) throws ZDataBaseException, ZCompressException {
-		//gestione BLOB
-		try
-		{
-			if (value != null) {
-				if (compression == true)
-					value = Compression.Compress(value);
-				ByteArrayInputStream bais = new ByteArrayInputStream(value);
-				m_ps.setBinaryStream(pos, bais, value.length);
-			} else
-				m_ps.setNull(pos, Types.BINARY);
-		}
-		catch (ZCompressException e)
-		{
-			throw e;
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-
-	}
-	public void setInByte(int pos, byte value) throws ZDataBaseException {
-		try
-		{
-			m_ps.setByte(pos, value);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInDate(int pos, java.util.Date value) throws ZDataBaseException {
-		try
-		{
-			if (value != null) {
-			
-				long ad = value.getTime();
-				long ld = new GregorianCalendar(1850, 1, 1).getTimeInMillis();
-			
-				if (ad > ld)
-					m_ps.setTimestamp(pos, new Timestamp(value.getTime()));
-				else {
-					System.out.println("Data formalmente errata(" + value.toString() + "). Sostituita con 01/02/1850");
-					m_ps.setTimestamp(pos, new Timestamp(ld));
-				}
-			} else
-				m_ps.setNull(pos, Types.DATE);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInDouble(int pos, double value) throws ZDataBaseException {
-		try
-		{
-			m_ps.setDouble(pos, value);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInFloat(int pos, float value) throws ZDataBaseException {
-		try
-		{
-			m_ps.setFloat(pos, value);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInInt(int pos, int value) throws ZDataBaseException {
-		try
-		{
-			m_ps.setInt(pos, value);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInLong(int pos, long value) throws ZDataBaseException {
-		try
-		{
-			m_ps.setLong(pos, value);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInShort(int pos, short value) throws ZDataBaseException {
-		try
-		{
-			m_ps.setShort(pos, value);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInString(int pos, String value) throws ZDataBaseException {
-		try
-		{
-			if (value != null)
-				m_ps.setString(pos, value.trim().toUpperCase());
-			else
-				m_ps.setNull(pos, Types.VARCHAR);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	/**
-	 * Utilizzare questa funzione quando passo la mail e la password
-	 */
-	public void setInString(int pos, String value, boolean noUpper) throws ZDataBaseException {
-		try
-		{
-			if (value != null)
-				m_ps.setString(pos, value.trim());
-			else
-				m_ps.setString(pos, NullValue.STRING);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInBit(int pos, boolean value) throws ZDataBaseException {
-		try
-		{
-			byte valore;
-			if (value == true)
-				valore = 1;
-			else
-				valore = 0;
-			m_ps.setByte(pos, valore);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInBit(int pos, String nulla) throws ZDataBaseException {
-		try
-		{
-			if (nulla == null)
-				m_ps.setByte(pos, (byte) 0);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-
-	public IResultSet executeQuery() throws ZDataBaseException {
-		try
-		{
-			ResultSet rs = m_ps.executeQuery();
-			return new PostgresSqResultSet(rs);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public int executeUpdate() throws ZDataBaseException {
-		try
-		{
-			return m_ps.executeUpdate();
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-
-	public boolean execute() throws ZDataBaseException {
-		try
-		{
-			boolean b = m_ps.execute();
-			return b;
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void close() throws ZDataBaseException {
-		try
-		{
-			if (m_ps != null)
-				m_ps.close();
-			m_ps = null;
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-
-}

+ 0 - 584
src/main/java/commons/utility/database/postgressql/PostgresSqStatement.java

@@ -1,584 +0,0 @@
-/**
- * 	HISTORY
- * 	FIOALE - 27.07.2004
- * 	+	Aggiunta implementazione setInIntFk che permette di inserire NULL nel db 
- * 		per i valori numerici interi. Da usare solo per rispettare le relazioni
- * 	BASLUC - 13.07.2005
- * 	+	Aggiunta funzione come da modifica intf
- * 	BASLUC - 14.07.2005
- * 	~	Corretta l'impl della setInStringFk() per via del != e dell'equals...
- */
-
-package commons.utility.database.postgressql;
-
-import java.io.ByteArrayInputStream;
-import java.sql.Blob;
-import java.sql.CallableStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.GregorianCalendar;
-
-import commons.utility.Compression;
-import commons.utility.database.IResultSet;
-import commons.utility.database.ISpStatement;
-import commons.utility.database.NullValue;
-import commons.exception.ZCompressException;
-import commons.exception.ZDataBaseException;
-
-class PostgresSqStatement implements ISpStatement {
-	CallableStatement m_cs = null;
-
-	public PostgresSqStatement(CallableStatement cs) {
-		m_cs = cs;
-	}
-
-	//////////////////////////////////////////////////////////////////////////////
-	//Parametri di INPUT
-	public void setInBlob(int pos, byte[] value, boolean compression) throws ZDataBaseException, ZCompressException {
-		//gestione BLOB
-		try
-		{
-			if (value != null) {
-				if (compression == true)
-					value = Compression.Compress(value);
-				ByteArrayInputStream bais = new ByteArrayInputStream(value);
-				m_cs.setBinaryStream(pos, bais, value.length);
-			} else
-				m_cs.setNull(pos, Types.BINARY);
-		}
-		catch (ZCompressException e)
-		{
-			throw e;
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-
-	}
-	public void setInByte(int pos, byte value) throws ZDataBaseException {
-		try
-		{
-			m_cs.setByte(pos, value);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInDate(int pos, java.util.Date value) throws ZDataBaseException {
-		try
-		{
-			if (value != null) {
-			
-				long ad = value.getTime();
-				long ld = new GregorianCalendar(1850, 1, 1).getTimeInMillis();
-			
-				if (ad > ld)
-					m_cs.setTimestamp(pos, new Timestamp(value.getTime()));
-				else {
-					System.out.println("Data formalmente errata(" + value.toString() + "). Sostituita con 01/02/1850");
-					m_cs.setTimestamp(pos, new Timestamp(ld));
-				}
-			} else
-				m_cs.setNull(pos, Types.DATE);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInDouble(int pos, double value) throws ZDataBaseException {
-		try
-		{
-			m_cs.setDouble(pos, value);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInFloat(int pos, float value) throws ZDataBaseException {
-		try
-		{
-			m_cs.setFloat(pos, value);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInInt(int pos, int value) throws ZDataBaseException {
-		try
-		{
-			m_cs.setInt(pos, value);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInIntFk(int pos, int value) throws ZDataBaseException {
-		try
-		{
-			if (value != 0)
-				m_cs.setInt(pos, value);
-			else
-				m_cs.setNull(pos, Types.INTEGER);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInLong(int pos, long value) throws ZDataBaseException {
-		try
-		{
-			m_cs.setLong(pos, value);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInShort(int pos, short value) throws ZDataBaseException {
-		try
-		{
-			m_cs.setShort(pos, value);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInString(int pos, String value) throws ZDataBaseException {
-		try
-		{
-			if (value != null)
-				m_cs.setString(pos, value.trim().toUpperCase());
-			else
-				m_cs.setString(pos, NullValue.STRING);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-
-	public void setInStringFk(int pos, String value) throws ZDataBaseException
-	{
-		try
-		{
-			if (!NullValue.STRING.equals(value))
-				m_cs.setString(pos, value);
-			else
-				m_cs.setString(pos, null);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	
-	/**
-	 * Utilizzare questa funzione quando passo la mail e la password
-	 */
-	public void setInString(int pos, String value, boolean noUpper) throws ZDataBaseException {
-		try
-		{
-			if (value != null)
-				m_cs.setString(pos, value.trim());
-			else
-				m_cs.setString(pos, NullValue.STRING);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-    
-    public void setInStringCAP(int pos, String value) throws ZDataBaseException {
-        try
-        {
-            if (value != null)
-                value = value.trim();
-            else
-                value = NullValue.STRING;
-            
-            if (value.equals(NullValue.STRING))
-                value = " ";
-            
-            m_cs.setString(pos, value.toUpperCase());
-        }
-        catch (SQLException e)
-        {
-            throw new ZDataBaseException(e);
-        }
-    }
-    
-	public void setInBit(int pos, boolean value) throws ZDataBaseException {
-		byte valore;
-		if (value == true)
-			valore = 1;
-		else
-			valore = 0;
-		try
-		{
-			m_cs.setByte(pos, valore);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setInBit(int pos, String nulla) throws ZDataBaseException {
-		if (nulla == null){
-			try
-			{
-				m_cs.setByte(pos, (byte) 0);
-			}
-			catch (SQLException e)
-			{
-				throw new ZDataBaseException(e);
-			}
-		}
-	}
-	//////////////////////////////////////////////////////////////////////////////
-	//Parametri di OUTPUT
-	public void setOutBlob(int pos) throws ZDataBaseException {
-		try
-		{
-			m_cs.registerOutParameter(pos, Types.BLOB);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setOutByte(int pos) throws ZDataBaseException {
-		try
-		{
-			m_cs.registerOutParameter(pos, Types.TINYINT);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setOutDate(int pos) throws ZDataBaseException {
-		try
-		{
-			m_cs.registerOutParameter(pos, Types.TIMESTAMP);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setOutDouble(int pos) throws ZDataBaseException {
-		try
-		{
-			m_cs.registerOutParameter(pos, Types.DOUBLE);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setOutFloat(int pos) throws ZDataBaseException {
-		try
-		{
-			m_cs.registerOutParameter(pos, Types.FLOAT);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setOutInt(int pos) throws ZDataBaseException {
-		try
-		{
-			m_cs.registerOutParameter(pos, Types.INTEGER);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setOutLong(int pos) throws ZDataBaseException {
-		try
-		{
-			m_cs.registerOutParameter(pos, Types.BIGINT);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setOutShort(int pos) throws ZDataBaseException {
-		try
-		{
-			m_cs.registerOutParameter(pos, Types.SMALLINT);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setOutString(int pos) throws ZDataBaseException {
-		try
-		{
-			m_cs.registerOutParameter(pos, Types.VARCHAR);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public void setOutBit(int pos) throws ZDataBaseException {
-		try
-		{
-			m_cs.registerOutParameter(pos, Types.BIT);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	//////////////////////////////////////////////////////////////////////////////
-	//Lettura parametri di OUTPUT
-	public byte[] getOutBlob(int pos, boolean decompress) throws ZDataBaseException, ZCompressException {
-		byte[] value;
-		
-		try
-		{
-			Blob blob = m_cs.getBlob(pos);
-			value = blob.getBytes(1, (int) blob.length());
-			if (decompress == true && value != null)
-				value = Compression.Decompress(value);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-		catch (ZCompressException e)
-		{
-			throw e;
-		}
-		
-		return value;
-	}
-	public byte getOutByte(int pos) throws ZDataBaseException {
-		try
-		{
-			return m_cs.getByte(pos);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public java.util.Date getOutDate(int pos) throws ZDataBaseException {
-		try
-		{
-			return new java.util.Date(m_cs.getTimestamp(pos).getTime());
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public double getOutDouble(int pos) throws ZDataBaseException {
-		try
-		{
-			return m_cs.getDouble(pos);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public float getOutFloat(int pos) throws ZDataBaseException {
-		try
-		{
-			return m_cs.getFloat(pos);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public int getOutInt(int pos) throws ZDataBaseException {
-		try
-		{
-			return m_cs.getInt(pos);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public long getOutLong(int pos) throws ZDataBaseException {
-		try
-		{
-			return m_cs.getLong(pos);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public short getOutShort(int pos) throws ZDataBaseException {
-		try
-		{
-			return m_cs.getShort(pos);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-	public String getOutString(int pos) throws ZDataBaseException {
-		String value;
-		try
-		{
-			value = m_cs.getString(pos);
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-		if (value != null) {
-			value = value.trim();
-		} else {
-			value = NullValue.STRING;
-		}
-
-		return value;
-	}
-	public boolean getOutBit(int pos) throws ZDataBaseException {
-		boolean valore;
-		try
-		{
-			if (m_cs.getByte(pos) == 1)
-				valore = true;
-			else
-				valore = false;
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-		return valore;
-	}
-	public IResultSet executeQuery() throws ZDataBaseException {
-		ResultSet rs = null;
-		try
-		{
-
-//			m_cs.execute();
-//			while(true)
-//			{
-//				if (m_cs.getMoreResults() == false)
-//				{
-//					rs = m_cs.getResultSet();
-//					if (rs != null)
-//						break;
-//				}
-//				else
-//					break;
-//			}
-			
-//			boolean nextResultSet = true;
-//			
-//			try
-//			{
-//				boolean noMoreResults = false;
-//				boolean noMoreCount = false;
-//
-//				while (!(noMoreResults && noMoreCount))
-//				{
-//					if (nextResultSet)
-//					{
-//						nextResultSet = m_cs.getMoreResults();
-//						noMoreResults = (nextResultSet == false);
-//					}
-//					else
-//					{
-//						int updateCount = m_cs.getUpdateCount();
-//						noMoreCount = (updateCount == -1);
-//						if (!noMoreCount)
-//							nextResultSet = m_cs.getMoreResults();
-//					}
-//				}
-//
-//				rs = m_cs.getResultSet();
-//			}
-//			catch (SQLException sqle)
-//			{
-//				throw sqle;
-//			}
-			
-//			boolean results= m_cs.execute();
-//			int rsCount = 0;
-//			
-//		     do {
-//		         if(results) {
-//		            rs = m_cs.getResultSet();
-//		            rsCount++;
-//
-//		            //Show data from the result set.
-//		            System.out.println("RESULT SET #" + rsCount);
-//		         }
-//		         System.out.println();
-//		         results = m_cs.getMoreResults();
-//		         } while(results);
-			
-			rs = m_cs.executeQuery();
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-		return new PostgresSqResultSet(rs);
-	}
-	public int executeUpdate() throws ZDataBaseException {
-		try
-		{
-			return m_cs.executeUpdate();
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-	}
-
-	public boolean execute() throws ZDataBaseException {
-		boolean b;
-		try
-		{
-			b = m_cs.execute();
-		}
-		catch (SQLException e)
-		{
-			throw new ZDataBaseException(e);
-		}
-		return b;
-	}
-	public void close() throws ZDataBaseException {
-		if (m_cs != null){
-			try
-			{
-				m_cs.close();
-			}
-			catch (SQLException e)
-			{
-				throw new ZDataBaseException(e);
-			} 
-		}
-		m_cs = null;
-	}
-
-}

+ 0 - 50
src/main/java/commons/utility/database/postgressql/PostgresSqlDatabase.java

@@ -1,50 +0,0 @@
-package commons.utility.database.postgressql;
-
-import java.sql.CallableStatement;
-import java.sql.PreparedStatement;
-
-import commons.utility.database.GenericDatabase;
-import commons.utility.database.IConnection;
-import commons.utility.database.ISpStatement;
-import commons.utility.database.ISqlStatement;
-import commons.exception.ZDataBaseException;
-
-public class PostgresSqlDatabase extends GenericDatabase {
-	IConnection m_cn = null;
-	CallableStatement m_cs = null;
-	PreparedStatement m_ps = null;
-	String m_par = null;
-
-	public PostgresSqlDatabase(IConnection cn) {
-		super(cn);
-		m_cn = getConnection();
-	}
-
-	public ISpStatement getSpUpdateStatment(String StoredProcedure, int n_Parametri) throws ZDataBaseException {
-		m_par = "";
-		for (short i = 0; i < n_Parametri; ++i)
-			m_par += "?,";
-		if (!m_par.equals(""))
-			m_par = m_par.substring(0, m_par.length() - 1);
-		m_cs = m_cn.prepareCall("{call " + StoredProcedure + " (" + m_par + ")}");
-		
-		//System.out.println(StoredProcedure);
-		
-		return new PostgresSqStatement(m_cs);
-	}
-
-	public ISpStatement getSpQueryStatment(String StoredProcedure, int n_Parametri) throws ZDataBaseException {
-		return getSpUpdateStatment(StoredProcedure, n_Parametri);
-	}
-
-	public ISqlStatement getSpUpdateStatment(String query) throws ZDataBaseException {
-		m_ps = m_cn.prepareStatment(query);
-		return new PostgresSqSqlStatement(m_ps);
-	}
-
-	public ISqlStatement getSpQueryStatment(String query) throws ZDataBaseException {
-		return getSpUpdateStatment(query);
-	}
-
-
-}

+ 0 - 31
src/main/java/commons/utility/enviroment/HibernateFactory.java

@@ -1,31 +0,0 @@
-package commons.utility.enviroment;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.Properties;
-
-import org.springframework.beans.factory.FactoryBean;
-
-public class HibernateFactory implements FactoryBean {
-
-	String path = null;
-
-	public HibernateFactory(String path) {
-		this.path = path;
-	}
-
-	public Object getObject() throws Exception {
-		Properties p = new Properties();
-		p.load(new FileInputStream(new File(path)));
-		return p;
-	}
-
-	public Class getObjectType() {
-		return Properties.class;
-	}
-
-	public boolean isSingleton() {
-		return true;
-	}
-
-}

+ 0 - 13
src/main/java/commons/utility/formatter/IControllerValidator.java

@@ -1,13 +0,0 @@
-package commons.utility.formatter;
-
-import commons.exception.WebValidateActionException;
-
-
-public interface IControllerValidator {
-
-	/**
-	 * Verifica che il controllo del'autenticazione nel controller di spring 
-	 * sia stato superato con successo
-	 */
-	public abstract void validate() throws WebValidateActionException;
-}

+ 0 - 109
src/main/java/commons/utility/tabelle/TabellaCaptcha.java

@@ -1,109 +0,0 @@
-package commons.utility.tabelle;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Random;
-
-import commons.utility.database.NullValue;
-
-public class TabellaCaptcha {
-	
-	private Map<Integer, BeanCaptcha> map = new HashMap<Integer, BeanCaptcha>();
-	
-	private final static String[] valori = {"4P3X4", 
-											"G5RRP",
-											"CS6T5",
-											"KK3J6",
-											"SXGPT",
-											"F64FE",
-											"5GC6R",
-											"BSXJY",
-											"VHMB2",
-											"WZHWR",
-											"RJ28Q"};
-	
-	private final static int MAX = 10;
-	
-	private static TabellaCaptcha instance = null;
-	
-	protected TabellaCaptcha()
-	{
-		riempiMappa();
-	}
-	
-	public static synchronized TabellaCaptcha getTabella()
-	{
-		if(instance == null)
-			instance = new TabellaCaptcha();
-		return instance;
-	}
-	
-	private void riempiMappa()
-	{
-		for(int i = 0; i <= MAX; i++)
-		{
-			BeanCaptcha bean = new BeanCaptcha();
-			bean.setImg("SHARED/IMG/CAPTCHA/captcha" + i + ".png");
-			bean.setValore(valori[i]);
-			bean.setKey(i);
-			map.put(i, bean);
-		}
-	}
-
-	protected Map<Integer, BeanCaptcha> getMap() {
-		return map;
-	}
-	
-	public BeanCaptcha getCaptcha(int idCaptcha)
-	{
-		return map.get(idCaptcha);
-	}
-	
-	public BeanCaptcha generateCaptcha()
-	{
-		Random diceRoller = new Random();
-		int indiceCaptcha = diceRoller.nextInt(MAX);
-		return map.get(indiceCaptcha);
-	}
-	
-	public class BeanCaptcha implements Serializable
-	{
-
-		private static final long serialVersionUID = 1L;
-		
-		private int key = NullValue.NUMBER;
-		
-		private String img = NullValue.STRING;
-		
-		private String valore = NullValue.STRING;
-
-
-		public int getKey() {
-			return key;
-		}
-
-		public void setKey(int key) {
-			this.key = key;
-		}
-
-		public String getImg() {
-			return img;
-		}
-
-		public void setImg(String img) {
-			this.img = img;
-		}
-
-		public String getValore() {
-			return valore;
-		}
-
-		public void setValore(String valore) {
-			this.valore = valore;
-		}
-		
-	}
-
-
-}