JDBCTransazioneInfoServiceSearchImpl.java
- /*
- * GovWay - A customizable API Gateway
- * https://govway.org
- *
- * Copyright (c) 2005-2025 Link.it srl (https://link.it).
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3, as published by
- * the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
- package org.openspcoop2.core.transazioni.dao.jdbc;
- import java.util.List;
- import java.util.ArrayList;
- import java.util.Map;
- import java.sql.Connection;
- import org.slf4j.Logger;
- import org.openspcoop2.utils.sql.ISQLQueryObject;
- import org.openspcoop2.generic_project.expression.impl.sql.ISQLFieldConverter;
- import org.openspcoop2.generic_project.dao.jdbc.utils.IJDBCFetch;
- import org.openspcoop2.generic_project.dao.jdbc.utils.JDBCObject;
- import org.openspcoop2.generic_project.dao.jdbc.IJDBCServiceSearchWithoutId;
- import org.openspcoop2.generic_project.beans.InUse;
- import org.openspcoop2.generic_project.beans.IField;
- import org.openspcoop2.generic_project.beans.NonNegativeNumber;
- import org.openspcoop2.generic_project.beans.UnionExpression;
- import org.openspcoop2.generic_project.beans.Union;
- import org.openspcoop2.generic_project.beans.FunctionField;
- import org.openspcoop2.generic_project.exception.MultipleResultException;
- import org.openspcoop2.generic_project.exception.NotFoundException;
- import org.openspcoop2.generic_project.exception.NotImplementedException;
- import org.openspcoop2.generic_project.exception.ServiceException;
- import org.openspcoop2.generic_project.expression.IExpression;
- import org.openspcoop2.generic_project.dao.jdbc.JDBCExpression;
- import org.openspcoop2.generic_project.dao.jdbc.JDBCPaginatedExpression;
- import org.openspcoop2.generic_project.dao.jdbc.JDBCServiceManagerProperties;
- import org.openspcoop2.core.transazioni.dao.jdbc.converter.TransazioneInfoFieldConverter;
- import org.openspcoop2.core.transazioni.dao.jdbc.fetch.TransazioneInfoFetch;
- import org.openspcoop2.core.transazioni.TransazioneInfo;
- /**
- * JDBCTransazioneInfoServiceSearchImpl
- *
- * @author Poli Andrea (poli@link.it)
- * @author $Author$
- * @version $Rev$, $Date$
- */
- public class JDBCTransazioneInfoServiceSearchImpl implements IJDBCServiceSearchWithoutId<TransazioneInfo, JDBCServiceManager> {
- private TransazioneInfoFieldConverter _transazioneInfoFieldConverter = null;
- public TransazioneInfoFieldConverter getTransazioneInfoFieldConverter() {
- if(this._transazioneInfoFieldConverter==null){
- this._transazioneInfoFieldConverter = new TransazioneInfoFieldConverter(this.jdbcServiceManager.getJdbcProperties().getDatabaseType());
- }
- return this._transazioneInfoFieldConverter;
- }
- @Override
- public ISQLFieldConverter getFieldConverter() {
- return this.getTransazioneInfoFieldConverter();
- }
-
- private TransazioneInfoFetch transazioneInfoFetch = new TransazioneInfoFetch();
- public TransazioneInfoFetch getTransazioneInfoFetch() {
- return this.transazioneInfoFetch;
- }
- @Override
- public IJDBCFetch getFetch() {
- return getTransazioneInfoFetch();
- }
-
-
- private JDBCServiceManager jdbcServiceManager = null;
- @Override
- public void setServiceManager(JDBCServiceManager serviceManager) throws ServiceException{
- this.jdbcServiceManager = serviceManager;
- }
-
- @Override
- public JDBCServiceManager getServiceManager() throws ServiceException{
- return this.jdbcServiceManager;
- }
-
-
-
-
-
- @Override
- public List<TransazioneInfo> findAll(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject, JDBCPaginatedExpression expression, org.openspcoop2.generic_project.beans.IDMappingBehaviour idMappingResolutionBehaviour) throws NotImplementedException, ServiceException,Exception {
- List<TransazioneInfo> list = new ArrayList<TransazioneInfo>();
-
- // TODO: implementazione non efficiente.
- // Per ottenere una implementazione efficiente:
- // 1. Usare metodo select di questa classe indirizzando esattamente i field necessari
- // 2. Usare metodo getTransazioneInfoFetch() sul risultato della select per ottenere un oggetto TransazioneInfo
- // La fetch con la map inserirĂ nell'oggetto solo i valori estratti
- List<Object> ids = this._findAllObjectIds(jdbcProperties, log, connection, sqlQueryObject, expression);
-
- for(Object id: ids) {
- list.add(this.getEngine(jdbcProperties, log, connection, sqlQueryObject, id, idMappingResolutionBehaviour));
- }
- return list;
-
- }
-
- @Override
- public TransazioneInfo find(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject, JDBCExpression expression, org.openspcoop2.generic_project.beans.IDMappingBehaviour idMappingResolutionBehaviour)
- throws NotFoundException, MultipleResultException, NotImplementedException, ServiceException,Exception {
- Object id = this._findObjectId(jdbcProperties, log, connection, sqlQueryObject, expression);
- if(id!=null){
- return this.getEngine(jdbcProperties, log, connection, sqlQueryObject, id, idMappingResolutionBehaviour);
- }else{
- throw new NotFoundException("Entry with id["+id+"] not found");
- }
-
- }
-
- @Override
- public NonNegativeNumber count(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject, JDBCExpression expression) throws NotImplementedException, ServiceException,Exception {
-
- List<Object> listaQuery = org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.prepareCount(jdbcProperties, log, connection, sqlQueryObject, expression,
- this.getTransazioneInfoFieldConverter(), TransazioneInfo.model());
-
- sqlQueryObject.addSelectCountField("tot");
-
- joinEngine(expression,sqlQueryObject);
-
- return org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.count(jdbcProperties, log, connection, sqlQueryObject, expression,
- this.getTransazioneInfoFieldConverter(), TransazioneInfo.model(),listaQuery);
- }
- @Override
- public List<Object> select(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject,
- JDBCPaginatedExpression paginatedExpression, IField field) throws ServiceException,NotFoundException,NotImplementedException,Exception {
- return this.select(jdbcProperties, log, connection, sqlQueryObject,
- paginatedExpression, false, field);
- }
-
- @Override
- public List<Object> select(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject,
- JDBCPaginatedExpression paginatedExpression, boolean distinct, IField field) throws ServiceException,NotFoundException,NotImplementedException,Exception {
- List<Map<String,Object>> map =
- this.select(jdbcProperties, log, connection, sqlQueryObject, paginatedExpression, distinct, new IField[]{field});
- return org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.selectSingleObject(map);
- }
-
- @Override
- public List<Map<String,Object>> select(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject,
- JDBCPaginatedExpression paginatedExpression, IField ... field) throws ServiceException,NotFoundException,NotImplementedException,Exception {
- return this.select(jdbcProperties, log, connection, sqlQueryObject,
- paginatedExpression, false, field);
- }
-
- @Override
- public List<Map<String,Object>> select(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject,
- JDBCPaginatedExpression paginatedExpression, boolean distinct, IField ... field) throws ServiceException,NotFoundException,NotImplementedException,Exception {
-
- org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.setFields(sqlQueryObject,paginatedExpression,field);
- try{
-
- ISQLQueryObject sqlQueryObjectDistinct =
- org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.prepareSqlQueryObjectForSelectDistinct(distinct,sqlQueryObject, paginatedExpression, log,
- this.getTransazioneInfoFieldConverter(), field);
- return selectEngine(jdbcProperties, log, connection, sqlQueryObject, paginatedExpression, sqlQueryObjectDistinct);
-
- }finally{
- org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.removeFields(sqlQueryObject,paginatedExpression,field);
- }
- }
- @Override
- public Object aggregate(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject,
- JDBCExpression expression, FunctionField functionField) throws ServiceException,NotFoundException,NotImplementedException,Exception {
- Map<String,Object> map =
- this.aggregate(jdbcProperties, log, connection, sqlQueryObject, expression, new FunctionField[]{functionField});
- return org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.selectAggregateObject(map,functionField);
- }
-
- @Override
- public Map<String,Object> aggregate(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject,
- JDBCExpression expression, FunctionField ... functionField) throws ServiceException,NotFoundException,NotImplementedException,Exception {
-
- org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.setFields(sqlQueryObject,expression,functionField);
- try{
- List<Map<String,Object>> list = selectEngine(jdbcProperties, log, connection, sqlQueryObject, expression);
- return list.get(0);
- }finally{
- org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.removeFields(sqlQueryObject,expression,functionField);
- }
- }
- @Override
- public List<Map<String,Object>> groupBy(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject,
- JDBCExpression expression, FunctionField ... functionField) throws ServiceException,NotFoundException,NotImplementedException,Exception {
-
- if(expression.getGroupByFields().isEmpty()){
- throw new ServiceException("GroupBy conditions not found in expression");
- }
-
- org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.setFields(sqlQueryObject,expression,functionField);
- try{
- return selectEngine(jdbcProperties, log, connection, sqlQueryObject, expression);
- }finally{
- org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.removeFields(sqlQueryObject,expression,functionField);
- }
- }
-
- @Override
- public List<Map<String,Object>> groupBy(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject,
- JDBCPaginatedExpression paginatedExpression, FunctionField ... functionField) throws ServiceException,NotFoundException,NotImplementedException,Exception {
-
- if(paginatedExpression.getGroupByFields().isEmpty()){
- throw new ServiceException("GroupBy conditions not found in expression");
- }
-
- org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.setFields(sqlQueryObject,paginatedExpression,functionField);
- try{
- return selectEngine(jdbcProperties, log, connection, sqlQueryObject, paginatedExpression);
- }finally{
- org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.removeFields(sqlQueryObject,paginatedExpression,functionField);
- }
- }
-
- protected List<Map<String,Object>> selectEngine(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject,
- IExpression expression) throws ServiceException,NotFoundException,NotImplementedException,Exception {
- return selectEngine(jdbcProperties, log, connection, sqlQueryObject, expression, null);
- }
- protected List<Map<String,Object>> selectEngine(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject,
- IExpression expression, ISQLQueryObject sqlQueryObjectDistinct) throws ServiceException,NotFoundException,NotImplementedException,Exception {
-
- List<Object> listaQuery = new ArrayList<>();
- List<JDBCObject> listaParams = new ArrayList<>();
- List<Object> returnField = org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.prepareSelect(jdbcProperties, log, connection, sqlQueryObject,
- expression, this.getTransazioneInfoFieldConverter(), TransazioneInfo.model(),
- listaQuery,listaParams);
-
- joinEngine(expression,sqlQueryObject);
-
- List<Map<String,Object>> list = org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.select(jdbcProperties, log, connection,
- org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.prepareSqlQueryObjectForSelectDistinct(sqlQueryObject,sqlQueryObjectDistinct),
- expression, this.getTransazioneInfoFieldConverter(), TransazioneInfo.model(),
- listaQuery,listaParams,returnField);
- if(list!=null && !list.isEmpty()){
- return list;
- }
- else{
- throw org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.newNotFoundException();
- }
- }
-
- @Override
- public List<Map<String,Object>> union(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject,
- Union union, UnionExpression ... unionExpression) throws ServiceException,NotFoundException,NotImplementedException,Exception {
-
- List<ISQLQueryObject> sqlQueryObjectInnerList = new ArrayList<>();
- List<JDBCObject> jdbcObjects = new ArrayList<>();
- List<Class<?>> returnClassTypes = org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.prepareUnion(jdbcProperties, log, connection, sqlQueryObject,
- this.getTransazioneInfoFieldConverter(), TransazioneInfo.model(),
- sqlQueryObjectInnerList, jdbcObjects, union, unionExpression);
-
- if(unionExpression!=null){
- for (int i = 0; i < unionExpression.length; i++) {
- UnionExpression ue = unionExpression[i];
- IExpression expression = ue.getExpression();
- joinEngine(expression,sqlQueryObjectInnerList.get(i));
- }
- }
-
- List<Map<String,Object>> list = org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.union(jdbcProperties, log, connection, sqlQueryObject,
- this.getTransazioneInfoFieldConverter(), TransazioneInfo.model(),
- sqlQueryObjectInnerList, jdbcObjects, returnClassTypes, union, unionExpression);
- if(list!=null && !list.isEmpty()){
- return list;
- }
- else{
- throw org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.newNotFoundException();
- }
- }
-
- @Override
- public NonNegativeNumber unionCount(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject,
- Union union, UnionExpression ... unionExpression) throws ServiceException,NotFoundException,NotImplementedException,Exception {
-
- List<ISQLQueryObject> sqlQueryObjectInnerList = new ArrayList<>();
- List<JDBCObject> jdbcObjects = new ArrayList<>();
- List<Class<?>> returnClassTypes = org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.prepareUnionCount(jdbcProperties, log, connection, sqlQueryObject,
- this.getTransazioneInfoFieldConverter(), TransazioneInfo.model(),
- sqlQueryObjectInnerList, jdbcObjects, union, unionExpression);
-
- if(unionExpression!=null){
- for (int i = 0; i < unionExpression.length; i++) {
- UnionExpression ue = unionExpression[i];
- IExpression expression = ue.getExpression();
- joinEngine(expression,sqlQueryObjectInnerList.get(i));
- }
- }
-
- NonNegativeNumber number = org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.unionCount(jdbcProperties, log, connection, sqlQueryObject,
- this.getTransazioneInfoFieldConverter(), TransazioneInfo.model(),
- sqlQueryObjectInnerList, jdbcObjects, returnClassTypes, union, unionExpression);
- if(number!=null && number.longValue()>=0){
- return number;
- }
- else{
- throw org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.newNotFoundException();
- }
- }
- // -- ConstructorExpression
- @Override
- public JDBCExpression newExpression(Logger log) throws NotImplementedException, ServiceException {
- try{
- return new JDBCExpression(this.getTransazioneInfoFieldConverter());
- }catch(Exception e){
- throw new ServiceException(e);
- }
- }
- @Override
- public JDBCPaginatedExpression newPaginatedExpression(Logger log) throws NotImplementedException, ServiceException {
- try{
- return new JDBCPaginatedExpression(this.getTransazioneInfoFieldConverter());
- }catch(Exception e){
- throw new ServiceException(e);
- }
- }
-
- @Override
- public JDBCExpression toExpression(JDBCPaginatedExpression paginatedExpression, Logger log) throws NotImplementedException, ServiceException {
- try{
- return new JDBCExpression(paginatedExpression);
- }catch(Exception e){
- throw new ServiceException(e);
- }
- }
- @Override
- public JDBCPaginatedExpression toPaginatedExpression(JDBCExpression expression, Logger log) throws NotImplementedException, ServiceException {
- try{
- return new JDBCPaginatedExpression(expression);
- }catch(Exception e){
- throw new ServiceException(e);
- }
- }
-
-
-
- // -- DB
-
- @Override
- public TransazioneInfo get(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject, long tableId, org.openspcoop2.generic_project.beans.IDMappingBehaviour idMappingResolutionBehaviour) throws NotFoundException, MultipleResultException, NotImplementedException, ServiceException, Exception {
- throw new NotImplementedException("Table without long id column PK");
- }
-
- protected TransazioneInfo getEngine(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject, Object objectId, org.openspcoop2.generic_project.beans.IDMappingBehaviour idMappingResolutionBehaviour) throws NotFoundException, MultipleResultException, NotImplementedException, ServiceException, Exception {
-
- org.openspcoop2.generic_project.dao.jdbc.utils.JDBCPreparedStatementUtilities jdbcUtilities =
- new org.openspcoop2.generic_project.dao.jdbc.utils.JDBCPreparedStatementUtilities(sqlQueryObject.getTipoDatabaseOpenSPCoop2(), log, connection);
-
- ISQLQueryObject sqlQueryObjectGet = sqlQueryObject.newSQLQueryObject();
-
- TransazioneInfo transazioneInfo = new TransazioneInfo();
-
- // Object transazioneInfo
- ISQLQueryObject sqlQueryObjectGet_transazioneInfo = sqlQueryObjectGet.newSQLQueryObject();
- sqlQueryObjectGet_transazioneInfo.setANDLogicOperator(true);
- sqlQueryObjectGet_transazioneInfo.addFromTable(this.getTransazioneInfoFieldConverter().toTable(TransazioneInfo.model()));
- sqlQueryObjectGet_transazioneInfo.addSelectField(this.getTransazioneInfoFieldConverter().toColumn(TransazioneInfo.model().TIPO,true));
- sqlQueryObjectGet_transazioneInfo.addSelectField(this.getTransazioneInfoFieldConverter().toColumn(TransazioneInfo.model().DATA,true));
- sqlQueryObjectGet_transazioneInfo.addWhereCondition(this.getTransazioneInfoFieldConverter().toColumn(TransazioneInfo.model().TIPO,true)+"=?");
- // Get transazioneInfo
- transazioneInfo = (TransazioneInfo) jdbcUtilities.executeQuerySingleResult(sqlQueryObjectGet_transazioneInfo.createSQLQuery(), jdbcProperties.isShowSql(), TransazioneInfo.model(), this.getTransazioneInfoFetch(),
- new JDBCObject(objectId,objectId.getClass()));
-
- return transazioneInfo;
-
- }
-
- @Override
- public boolean exists(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject, long tableId) throws MultipleResultException, NotImplementedException, ServiceException, Exception {
- throw new NotImplementedException("Table without long id column PK");
- }
-
- protected boolean _exists(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject, Object objectId) throws MultipleResultException, NotImplementedException, ServiceException, Exception {
-
- org.openspcoop2.generic_project.dao.jdbc.utils.JDBCPreparedStatementUtilities jdbcUtilities =
- new org.openspcoop2.generic_project.dao.jdbc.utils.JDBCPreparedStatementUtilities(sqlQueryObject.getTipoDatabaseOpenSPCoop2(), log, connection);
-
- boolean existsTransazioneInfo = false;
- sqlQueryObject = sqlQueryObject.newSQLQueryObject();
- sqlQueryObject.setANDLogicOperator(true);
- sqlQueryObject.addFromTable(this.getTransazioneInfoFieldConverter().toTable(TransazioneInfo.model()));
- sqlQueryObject.addSelectField(this.getTransazioneInfoFieldConverter().toColumn(TransazioneInfo.model().TIPO,true));
- sqlQueryObject.addWhereCondition(this.getTransazioneInfoFieldConverter().toColumn(TransazioneInfo.model().TIPO,true)+"=?");
- // Exists transazioneInfo
- existsTransazioneInfo = jdbcUtilities.exists(sqlQueryObject.createSQLQuery(), jdbcProperties.isShowSql(),
- new JDBCObject(objectId,objectId.getClass()));
-
- return existsTransazioneInfo;
-
- }
-
- private void joinEngine(IExpression expression, ISQLQueryObject sqlQueryObject) throws NotImplementedException, ServiceException, Exception{
-
- // nop
-
- }
-
- protected java.util.List<Object> getRootTablePrimaryKeyValuesEngine(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject, TransazioneInfo transazioneInfo) throws NotFoundException, ServiceException, NotImplementedException, Exception{
- // Identificativi
- java.util.List<Object> rootTableIdValues = new java.util.ArrayList<>();
- return rootTableIdValues;
- }
-
- protected Map<String, List<IField>> getMapTableToPKColumnEngine() throws NotImplementedException, Exception{
-
- Map<String, List<IField>> mapTableToPKColumn = new java.util.HashMap<>();
- return mapTableToPKColumn;
-
- }
-
- @Override
- public List<Long> findAllTableIds(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject, JDBCPaginatedExpression paginatedExpression) throws ServiceException, NotImplementedException, Exception {
-
- throw new NotImplementedException("Table without long id column PK");
-
- }
- public List<Object> _findAllObjectIds(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject, JDBCPaginatedExpression paginatedExpression) throws ServiceException, NotImplementedException, Exception {
-
- sqlQueryObject.setSelectDistinct(true);
- sqlQueryObject.setANDLogicOperator(true);
- sqlQueryObject.addSelectField(this.getTransazioneInfoFieldConverter().toColumn(TransazioneInfo.model().TIPO,true));
- Class<?> objectIdClass = String.class;
-
- // NOTE: if you have a object id with more columns set the and condition in sqlQueryObject:
- // sqlQueryObject.setANDLogicOperator(true);
- // and use a list (List<Class<?>> objectIdClass) as parameter for method org.openspcoop2.generic_project.dao.jdbc.utils.JDBCUtilities.findAll
- // The method return a List<List<Object>>.
-
- List<Object> listaQuery = org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.prepareFindAll(jdbcProperties, log, connection, sqlQueryObject, paginatedExpression,
- this.getTransazioneInfoFieldConverter(), TransazioneInfo.model());
-
- joinEngine(paginatedExpression,sqlQueryObject);
-
- List<Object> listObjects = org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.findAll(jdbcProperties, log, connection, sqlQueryObject, paginatedExpression,
- this.getTransazioneInfoFieldConverter(), TransazioneInfo.model(), objectIdClass, listaQuery);
- return listObjects;
-
- }
-
- @Override
- public long findTableId(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject, JDBCExpression expression) throws ServiceException, NotFoundException, MultipleResultException, NotImplementedException, Exception {
-
- throw new NotImplementedException("Table without long id column PK");
-
- }
-
- public Object _findObjectId(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject, JDBCExpression expression) throws ServiceException, NotFoundException, MultipleResultException, NotImplementedException, Exception {
-
- sqlQueryObject.setSelectDistinct(true);
- sqlQueryObject.setANDLogicOperator(true);
- sqlQueryObject.addSelectField(this.getTransazioneInfoFieldConverter().toColumn(TransazioneInfo.model().TIPO,true));
- Class<?> objectIdClass = String.class;
-
- // NOTE: if you have a object id with more columns set the and condition in sqlQueryObject:
- // sqlQueryObject.setANDLogicOperator(true);
- // and use a list (List<Class<?>> objectIdClass) as parameter for method org.openspcoop2.generic_project.dao.jdbc.utils.JDBCUtilities.find
- // The method return a list.
-
- List<Object> listaQuery = org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.prepareFind(jdbcProperties, log, connection, sqlQueryObject, expression,
- this.getTransazioneInfoFieldConverter(), TransazioneInfo.model());
-
- joinEngine(expression,sqlQueryObject);
- Object res = org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.find(jdbcProperties, log, connection, sqlQueryObject, expression,
- this.getTransazioneInfoFieldConverter(), TransazioneInfo.model(), objectIdClass, listaQuery);
- if(res!=null){
- return res;
- }
- else{
- throw org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.newNotFoundException();
- }
-
- }
- @Override
- public InUse inUse(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject, long tableId) throws ServiceException, NotFoundException, NotImplementedException, Exception {
- throw new NotImplementedException("Table without long id column PK");
- }
- protected InUse inUseEngine(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject, Object objectId) throws ServiceException, NotFoundException, NotImplementedException, Exception {
- InUse inUse = new InUse();
- inUse.setInUse(false);
-
- /*
- * TODO: implement code that checks whether the object identified by the id parameter is used by other objects
- */
-
- // Delete this line when you have implemented the method
- int throwNotImplemented = 1;
- if(throwNotImplemented==1){
- throw new NotImplementedException("NotImplemented");
- }
- // Delete this line when you have implemented the method
- return inUse;
- }
-
-
- @Override
- public List<List<Object>> nativeQuery(JDBCServiceManagerProperties jdbcProperties, Logger log, Connection connection, ISQLQueryObject sqlQueryObject,
- String sql,List<Class<?>> returnClassTypes,Object ... param) throws ServiceException,NotFoundException,NotImplementedException,Exception{
-
- return org.openspcoop2.generic_project.dao.jdbc.utils.GenericJDBCUtilities.nativeQuery(jdbcProperties, log, connection, sqlQueryObject,
- sql,returnClassTypes,param);
-
- }
-
- }