details: https://code.openbravo.com/erp/devel/main/rev/22d3347bafe7 changeset: 33974:22d3347bafe7 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Thu May 17 18:44:14 2018 +0200 summary: related to issue 38548: added test case
details: https://code.openbravo.com/erp/devel/main/rev/3ac8e2eb5a9e changeset: 33975:3ac8e2eb5a9e user: RM packaging bot <staff.rm <at> openbravo.com> date: Thu May 17 19:30:38 2018 +0000 summary: CI: merge back from main details: https://code.openbravo.com/erp/devel/main/rev/3404760330bc changeset: 33976:3404760330bc user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Fri May 18 12:42:38 2018 +0200 summary: fixes issue 38518: Compile subreports with HttpSecureAppServlet.renderJR It has been deprecate the ability of specifying to the reporting API if the sub-reports should be compiled or not. Instead the API is smart enough to find the subreports (if any) and compile them. Besides, note that this subreport search will be performed just once per report, because the compilation results are cached since[1]. With this change, reports generated both with HttpSecureAppServlet and BaseReportActionHandler will compile the subreports in a transparent way, i.e., without the need of explicitly specifying it. [1] https://issues.openbravo.com/view.php?id=37741 details: https://code.openbravo.com/erp/devel/main/rev/4d0349cd40a0 changeset: 33977:4d0349cd40a0 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Fri May 18 13:36:23 2018 +0200 summary: related to issue 38518: improve javadoc details: https://code.openbravo.com/erp/devel/main/rev/0544b0b49fca changeset: 33978:0544b0b49fca user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Mon May 14 09:07:29 2018 +0200 summary: [registersql] Provide new mechanism to register SQL functions in Hibernate details: https://code.openbravo.com/erp/devel/main/rev/86215bdfc6b1 changeset: 33979:86215bdfc6b1 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Mon May 14 11:54:17 2018 +0200 summary: [registersql] Fix compilation error Allow to use WeldUtils in DalLayerInitializer class by including the WeldUtils path on the compilation performed in ant.generate.entities task details: https://code.openbravo.com/erp/devel/main/rev/688440979f0a changeset: 33980:688440979f0a user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Mon May 14 12:22:30 2018 +0200 summary: [registersql] Replace OBDal.registerSQLFunction usage details: https://code.openbravo.com/erp/devel/main/rev/de69cab43f47 changeset: 33981:de69cab43f47 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Mon May 14 12:24:41 2018 +0200 summary: [registersql] Deprecate OBDal.registerSQLFunction details: https://code.openbravo.com/erp/devel/main/rev/b1cc016015fb changeset: 33982:b1cc016015fb user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Mon May 14 17:03:33 2018 +0200 summary: [registersql] Adapt changes for the test infrastructure details: https://code.openbravo.com/erp/devel/main/rev/d07b30c36739 changeset: 33983:d07b30c36739 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Tue May 15 08:35:48 2018 +0200 summary: [registersql] Fix compilation error Fix compilation error by adding the location for the WeldUtils class in the compilation performed by the compile.apply.module task details: https://code.openbravo.com/erp/devel/main/rev/6d728fb43a43 changeset: 33984:6d728fb43a43 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Wed May 16 10:34:38 2018 +0200 summary: [registersql] Test infrastructure improvements Allow to define a custom DalSessionFactoryController for the DAL Layer initialization per test case. This way it is possible to register the set of SQL functions in Hibernate that each test requires details: https://code.openbravo.com/erp/devel/main/rev/2f84c038350a changeset: 33985:2f84c038350a user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Wed May 16 10:37:12 2018 +0200 summary: [registersql] Add comment details: https://code.openbravo.com/erp/devel/main/rev/046f05dceb2d changeset: 33986:046f05dceb2d user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Wed May 16 11:15:04 2018 +0200 summary: [registersql] Use StandardBasicTypes to provide the SQL function type details: https://code.openbravo.com/erp/devel/main/rev/b53a18f934fd changeset: 33987:b53a18f934fd user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Wed May 16 11:21:43 2018 +0200 summary: [registersql] Add missing method javadoc details: https://code.openbravo.com/erp/devel/main/rev/2079491c295d changeset: 33988:2079491c295d user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Wed May 16 13:38:39 2018 +0200 summary: [registersql] Minor code improvements details: https://code.openbravo.com/erp/devel/main/rev/e45af08d8eaa changeset: 33989:e45af08d8eaa user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Wed May 16 14:21:12 2018 +0200 summary: [registersql] Log warn with stack trace when using deprecated method details: https://code.openbravo.com/erp/devel/main/rev/f48136592eae changeset: 33990:f48136592eae user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Wed May 16 18:55:35 2018 +0200 summary: [registersql] Fix registry failure in Oracle APRMSQLFunctionRegister can not use DAL to check whether the functions to be registered exist, because DAL layer is not initialized yet. Therefore, we should use sqlc instead details: https://code.openbravo.com/erp/devel/main/rev/b5f8e5dad6fe changeset: 33991:b5f8e5dad6fe user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Thu May 17 09:19:04 2018 +0200 summary: [registersql] Expose the SQL functions map in the API instead of the controller details: https://code.openbravo.com/erp/devel/main/rev/055351d43c80 changeset: 33992:055351d43c80 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Fri May 18 13:37:54 2018 +0200 summary: fixes issue 38520: Deprecate OBDal.registerSQLFunction details: https://code.openbravo.com/erp/devel/main/rev/0ac5c4647a10 changeset: 33993:0ac5c4647a10 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Mon May 21 10:50:06 2018 +0200 summary: related to issue 38520: disable the warning temporarily to make CI stable details: https://code.openbravo.com/erp/devel/main/rev/c7d184de88d8 changeset: 33994:c7d184de88d8 user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Mon May 21 12:30:20 2018 +0200 summary: related to issue 38520: catch Throwable catch Throwable to avoid the failure of the export.database task which is throwing a NoClassDefFoundError when trying to recover the DalSessionFactoryController with weld details: https://code.openbravo.com/erp/devel/main/rev/915bf19e1d5b changeset: 33995:915bf19e1d5b user: RM packaging bot <staff.rm <at> openbravo.com> date: Mon May 21 16:11:15 2018 +0000 summary: CI: update AD_MODULE to version 33994 diffstat: modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 4 +- modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMApplicationInitializer.java | 88 ------- modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMSQLFunctionRegister.java | 99 ++++++++ modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.base.weld/src/META-INF/beans.xml | 4 +- modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 8 +- modules/org.openbravo.client.application/src/org/openbravo/client/application/report/BaseReportActionHandler.java | 21 +- modules/org.openbravo.client.application/src/org/openbravo/client/application/report/CompiledReportManager.java | 7 +- modules/org.openbravo.client.application/src/org/openbravo/client/application/report/ReportCompiler.java | 9 +- modules/org.openbravo.client.application/src/org/openbravo/client/application/report/ReportingUtils.java | 116 +++++---- modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 6 +- modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelApplicationInitializer.java | 20 +- modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelSQLFunctionRegister.java | 52 ++++ modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 4 +- modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 10 +- modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 4 +- modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 12 +- modules/org.openbravo.userinterface.skin.250to300Comp/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.userinterface.skin.250to300Comp/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.userinterface.smartclient/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.userinterface.smartclient/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 6 +- modules/org.openbravo.utility.cleanup.log/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.utility.cleanup.log/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 2 +- modules/org.openbravo.v3.datasets/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.v3.datasets/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 6 +- modules/org.openbravo.v3.framework/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.v3.framework/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 24 +- modules/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml | 2 +- modules/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml | 22 +- src-db/database/sourcedata/AD_MODULE.xml | 4 +- src-test/src/org/openbravo/test/AllWebserviceTests.java | 4 +- src-test/src/org/openbravo/test/base/OBBaseTest.java | 21 +- src-test/src/org/openbravo/test/dal/IssuesTest.java | 15 +- src-test/src/org/openbravo/test/datasource/DatasourceTestUtil.java | 2 +- src-test/src/org/openbravo/test/inventoryStatus/InventoryStatusTest.java | 9 +- src-test/src/org/openbravo/test/selector/TestSelectorDefaultFilterActionHandler.java | 66 +++++ src/build.xml | 3 +- src/org/openbravo/base/secureApp/HttpSecureAppServlet.java | 17 +- src/org/openbravo/base/session/SessionFactoryController.java | 21 +- src/org/openbravo/common/actionhandler/CashflowForecastReportActionHandler.java | 11 +- src/org/openbravo/costing/CostingMigrationProcess.java | 9 +- src/org/openbravo/dal/core/DalLayerInitializer.java | 42 +++- src/org/openbravo/dal/core/DalSessionFactoryController.java | 39 +++- src/org/openbravo/dal/core/SQLFunctionRegister.java | 39 +++ src/org/openbravo/dal/service/OBDal.java | 7 + src/org/openbravo/erpCommon/utility/SystemInfo.java | 19 +- src/org/openbravo/erpCommon/utility/reporting/ReportManager.java | 2 +- src/org/openbravo/erpReports/RptM_Requisition.java | 5 - 72 files changed, 587 insertions(+), 336 deletions(-) diffs (truncated from 2285 to 300 lines): diff -r fca1e4e42285 -r 915bf19e1d5b modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml --- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml Thu May 17 17:22:21 2018 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml Mon May 21 16:11:15 2018 +0000 @@ -6,7 +6,7 @@ <!--A918E3331C404B889D69AA9BFAFB23AC--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> <!--A918E3331C404B889D69AA9BFAFB23AC--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--A918E3331C404B889D69AA9BFAFB23AC--> <NAME><![CDATA[Advanced Payables and Receivables Mngmt]]></NAME> -<!--A918E3331C404B889D69AA9BFAFB23AC--> <VERSION><![CDATA[3.0.33963]]></VERSION> +<!--A918E3331C404B889D69AA9BFAFB23AC--> <VERSION><![CDATA[3.0.33994]]></VERSION> <!--A918E3331C404B889D69AA9BFAFB23AC--> <DESCRIPTION><![CDATA[Managing your finances with an ERP does not have to be difficult. Enjoy a radically improved user experience that combines the power of an enterprise grade financial application with the simplicity and ease of a web 2.0 personal accounting service.]]></DESCRIPTION> <!--A918E3331C404B889D69AA9BFAFB23AC--> <HELP><![CDATA[Advanced Payables and Receivables Management simplifies and automates the business processes around the management of financial accounts, from the receipt and issue of payment, to the reconciliation of those events with bank statements. If you would like to help shape this module you are welcome to take part in the forum discussions or register feature requests or issues in the corresponding (Forum and Bug Tracking) sections in the Advanced Payables and Receivable project in the OB Forge.]]></HELP> diff -r fca1e4e42285 -r 915bf19e1d5b modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml --- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml Thu May 17 17:22:21 2018 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml Mon May 21 16:11:15 2018 +0000 @@ -7,7 +7,7 @@ <!--89326AE95DAD449D85DFAB2C5B1C6683--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--89326AE95DAD449D85DFAB2C5B1C6683--> <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID> <!--89326AE95DAD449D85DFAB2C5B1C6683--> <AD_DEPENDENT_MODULE_ID><![CDATA[5EB4F15C80684ACA904756BDC12ADBE5]]></AD_DEPENDENT_MODULE_ID> -<!--89326AE95DAD449D85DFAB2C5B1C6683--> <STARTVERSION><![CDATA[2.1.33963]]></STARTVERSION> +<!--89326AE95DAD449D85DFAB2C5B1C6683--> <STARTVERSION><![CDATA[2.1.33994]]></STARTVERSION> <!--89326AE95DAD449D85DFAB2C5B1C6683--> <ISINCLUDED><![CDATA[N]]></ISINCLUDED> <!--89326AE95DAD449D85DFAB2C5B1C6683--> <DEPENDANT_MODULE_NAME><![CDATA[User Interface Selector]]></DEPENDANT_MODULE_NAME> <!--89326AE95DAD449D85DFAB2C5B1C6683--> <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT> @@ -21,7 +21,7 @@ <!--B97FC854C6DD41E692161585645A900F--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--B97FC854C6DD41E692161585645A900F--> <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID> <!--B97FC854C6DD41E692161585645A900F--> <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID> -<!--B97FC854C6DD41E692161585645A900F--> <STARTVERSION><![CDATA[3.0.33963]]></STARTVERSION> +<!--B97FC854C6DD41E692161585645A900F--> <STARTVERSION><![CDATA[3.0.33994]]></STARTVERSION> <!--B97FC854C6DD41E692161585645A900F--> <ISINCLUDED><![CDATA[N]]></ISINCLUDED> <!--B97FC854C6DD41E692161585645A900F--> <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME> <!--B97FC854C6DD41E692161585645A900F--> <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT> diff -r fca1e4e42285 -r 915bf19e1d5b modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMApplicationInitializer.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMApplicationInitializer.java Thu May 17 17:22:21 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* - ************************************************************************* - * The contents of this file are subject to the Openbravo Public License - * Version 1.0 (the "License"), being the Mozilla Public License - * Version 1.1 with a permitted attribution clause; you may not use this - * file except in compliance with the License. You may obtain a copy of - * the License at http://www.openbravo.com/legal/license.html - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - * License for the specific language governing rights and limitations - * under the License. - * The Original Code is Openbravo ERP. - * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2012-2014 Openbravo SLU - * All Rights Reserved. - * Contributor(s): ______________________________________. - ************************************************************************* - */ - -package org.openbravo.advpaymentmngt.utility; - -import javax.enterprise.context.ApplicationScoped; -import javax.servlet.ServletException; - -import org.hibernate.SQLQuery; -import org.hibernate.dialect.function.SQLFunctionTemplate; -import org.hibernate.dialect.function.StandardSQLFunction; -import org.hibernate.type.StandardBasicTypes; -import org.openbravo.client.kernel.ApplicationInitializer; -import org.openbravo.dal.service.OBDal; -import org.openbravo.erpCommon.utility.SystemInfo; -import org.openbravo.service.db.DalConnectionProvider; - -@ApplicationScoped -public class APRMApplicationInitializer implements ApplicationInitializer { - final static String RDBMS = new DalConnectionProvider(false).getRDBMS(); - - @Override - public void initialize() { - OBDal.getInstance().registerSQLFunction("ad_message_get2", - new StandardSQLFunction("ad_message_get2", StandardBasicTypes.STRING)); - OBDal.getInstance().registerSQLFunction("hqlagg", - new SQLFunctionTemplate(StandardBasicTypes.STRING, getAggregationSQL())); - OBDal.getInstance().registerSQLFunction("get_uuid", - new StandardSQLFunction("get_uuid", StandardBasicTypes.STRING)); - } - - private String getAggregationSQL() { - if ("ORACLE".equals(RDBMS)) { - if (is11R2orNewer()) { - return "listagg(to_char(?1), ',') WITHIN GROUP (ORDER BY ?1)"; - } else if (existsStrAgg()) { - return "stragg(to_char(?1))"; - } else { - return "wm_concat(to_char(?1))"; - } - } else { - return "array_to_string(array_agg(?1), ',')"; - } - } - - private boolean existsStrAgg() { - try { - SQLQuery qry = OBDal.getInstance().getSession().createSQLQuery("select stragg(1) from dual"); - qry.list(); - } catch (Exception e) { - return false; - } - return true; - } - - private boolean is11R2orNewer() { - String dbVersion = null; - try { - dbVersion = SystemInfo.getDatabaseVersion(new DalConnectionProvider(false)); - } catch (ServletException ignore) { - - } - if (dbVersion == null) { - return false; - } - int version = Integer.valueOf(dbVersion.replaceAll("\\.", "").substring(0, 3)); - if (version >= 112) { - return true; - } - return false; - } -} diff -r fca1e4e42285 -r 915bf19e1d5b modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMSQLFunctionRegister.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMSQLFunctionRegister.java Mon May 21 16:11:15 2018 +0000 @@ -0,0 +1,99 @@ +/* + ************************************************************************* + * The contents of this file are subject to the Openbravo Public License + * Version 1.0 (the "License"), being the Mozilla Public License + * Version 1.1 with a permitted attribution clause; you may not use this + * file except in compliance with the License. You may obtain a copy of + * the License at http://www.openbravo.com/legal/license.html + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * The Original Code is Openbravo ERP. + * The Initial Developer of the Original Code is Openbravo SLU + * All portions are Copyright (C) 2018 Openbravo SLU + * All Rights Reserved. + * Contributor(s): ______________________________________. + ************************************************************************* + */ + +package org.openbravo.advpaymentmngt.utility; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.HashMap; +import java.util.Map; + +import javax.enterprise.context.ApplicationScoped; + +import org.hibernate.dialect.function.SQLFunction; +import org.hibernate.dialect.function.SQLFunctionTemplate; +import org.hibernate.dialect.function.StandardSQLFunction; +import org.hibernate.type.StandardBasicTypes; +import org.openbravo.base.session.OBPropertiesProvider; +import org.openbravo.dal.core.SQLFunctionRegister; +import org.openbravo.database.ConnectionProviderImpl; +import org.openbravo.erpCommon.utility.SystemInfo; +import org.openbravo.service.db.DalConnectionProvider; + +/** + * A class in charge of registering APRM SQL functions in Hibernate. + */ +@ApplicationScoped +public class APRMSQLFunctionRegister implements SQLFunctionRegister { + private static final String RDBMS = new DalConnectionProvider(false).getRDBMS(); + + @Override + public Map<String, SQLFunction> getSQLFunctions() { + Map<String, SQLFunction> sqlFunctions = new HashMap<>(); + sqlFunctions.put("ad_message_get2", new StandardSQLFunction("ad_message_get2", + StandardBasicTypes.STRING)); + sqlFunctions.put("hqlagg", new SQLFunctionTemplate(StandardBasicTypes.STRING, + getAggregationSQL())); + return sqlFunctions; + } + + private String getAggregationSQL() { + if ("ORACLE".equals(RDBMS)) { + if (is11R2orNewer()) { + return "listagg(to_char(?1), ',') WITHIN GROUP (ORDER BY ?1)"; + } else if (existsStrAgg()) { + return "stragg(to_char(?1))"; + } else { + return "wm_concat(to_char(?1))"; + } + } else { + return "array_to_string(array_agg(?1), ',')"; + } + } + + private boolean existsStrAgg() { + try { + ConnectionProviderImpl connectionProvider = new ConnectionProviderImpl(OBPropertiesProvider + .getInstance().getOpenbravoProperties()); + String sql = "select stragg(1) from dual"; + try (PreparedStatement st = connectionProvider.getPreparedStatement(sql); + Connection connection = st.getConnection(); + ResultSet result = st.executeQuery()) { + return true; + } + } catch (Exception ignore) { + } + return false; + } + + private boolean is11R2orNewer() { + String dbVersion = null; + try { + dbVersion = SystemInfo.getDatabaseVersion(new ConnectionProviderImpl(OBPropertiesProvider + .getInstance().getOpenbravoProperties())); + } catch (Exception ignore) { + } + if (dbVersion == null) { + return false; + } + int version = Integer.parseInt(dbVersion.replaceAll("\\.", "").substring(0, 3)); + return version >= 112; + } +} diff -r fca1e4e42285 -r 915bf19e1d5b modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE.xml --- a/modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE.xml Thu May 17 17:22:21 2018 +0200 +++ b/modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE.xml Mon May 21 16:11:15 2018 +0000 @@ -6,7 +6,7 @@ <!--8A098711BB324335A19833286BDB093D--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> <!--8A098711BB324335A19833286BDB093D--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--8A098711BB324335A19833286BDB093D--> <NAME><![CDATA[Apache External Connection Pool]]></NAME> -<!--8A098711BB324335A19833286BDB093D--> <VERSION><![CDATA[1.0.33963]]></VERSION> +<!--8A098711BB324335A19833286BDB093D--> <VERSION><![CDATA[1.0.33994]]></VERSION> <!--8A098711BB324335A19833286BDB093D--> <DESCRIPTION><![CDATA[Apache External Connection Pool]]></DESCRIPTION> <!--8A098711BB324335A19833286BDB093D--> <HELP><![CDATA[This module implements the Apache JDBC Connection Pool (http://wiki.openbravo.com/wiki/Modules:Apache_JDBC_Connection_Pool).]]></HELP> <!--8A098711BB324335A19833286BDB093D--> <TYPE><![CDATA[M]]></TYPE> diff -r fca1e4e42285 -r 915bf19e1d5b modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml --- a/modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml Thu May 17 17:22:21 2018 +0200 +++ b/modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml Mon May 21 16:11:15 2018 +0000 @@ -7,7 +7,7 @@ <!--1467C397BC5F4999A5606F39CD6FF8A4--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--1467C397BC5F4999A5606F39CD6FF8A4--> <AD_MODULE_ID><![CDATA[8A098711BB324335A19833286BDB093D]]></AD_MODULE_ID> <!--1467C397BC5F4999A5606F39CD6FF8A4--> <AD_DEPENDENT_MODULE_ID><![CDATA[7E48CDD73B7E493A8BED4F7253E7C989]]></AD_DEPENDENT_MODULE_ID> -<!--1467C397BC5F4999A5606F39CD6FF8A4--> <STARTVERSION><![CDATA[2.1.33963]]></STARTVERSION> +<!--1467C397BC5F4999A5606F39CD6FF8A4--> <STARTVERSION><![CDATA[2.1.33994]]></STARTVERSION> <!--1467C397BC5F4999A5606F39CD6FF8A4--> <ISINCLUDED><![CDATA[N]]></ISINCLUDED> <!--1467C397BC5F4999A5606F39CD6FF8A4--> <DEPENDANT_MODULE_NAME><![CDATA[Openbravo 3.0 Framework]]></DEPENDANT_MODULE_NAME> <!--1467C397BC5F4999A5606F39CD6FF8A4--> <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT> diff -r fca1e4e42285 -r 915bf19e1d5b modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml --- a/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml Thu May 17 17:22:21 2018 +0200 +++ b/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml Mon May 21 16:11:15 2018 +0000 @@ -6,7 +6,7 @@ <!--C70732EA90A14EC0916078B85CC33D2D--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> <!--C70732EA90A14EC0916078B85CC33D2D--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--C70732EA90A14EC0916078B85CC33D2D--> <NAME><![CDATA[JBoss Weld]]></NAME> -<!--C70732EA90A14EC0916078B85CC33D2D--> <VERSION><![CDATA[1.1.33963]]></VERSION> +<!--C70732EA90A14EC0916078B85CC33D2D--> <VERSION><![CDATA[1.1.33994]]></VERSION> <!--C70732EA90A14EC0916078B85CC33D2D--> <DESCRIPTION><![CDATA[JBoss Weld]]></DESCRIPTION> <!--C70732EA90A14EC0916078B85CC33D2D--> <HELP><![CDATA[Provides the JBoss Weld framework: Java Contexts and Dependency Injection for the Java EE platform (CDI). For more information see http://seamframework.org/Weld]]></HELP> <!--C70732EA90A14EC0916078B85CC33D2D--> <URL><![CDATA[http://forge.openbravo.com/projects/weld]]></URL> diff -r fca1e4e42285 -r 915bf19e1d5b modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml --- a/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml Thu May 17 17:22:21 2018 +0200 +++ b/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml Mon May 21 16:11:15 2018 +0000 @@ -7,7 +7,7 @@ <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <AD_MODULE_ID><![CDATA[C70732EA90A14EC0916078B85CC33D2D]]></AD_MODULE_ID> <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID> -<!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <STARTVERSION><![CDATA[3.0.33963]]></STARTVERSION> +<!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <STARTVERSION><![CDATA[3.0.33994]]></STARTVERSION> <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <ISINCLUDED><![CDATA[N]]></ISINCLUDED> <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <DEPENDANT_MODULE_NAME><![CDATA[Core]]></DEPENDANT_MODULE_NAME> <!--8BDE81545C1A43EAAC4BA3C5ED754DC8--> <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT> diff -r fca1e4e42285 -r 915bf19e1d5b modules/org.openbravo.base.weld/src/META-INF/beans.xml --- a/modules/org.openbravo.base.weld/src/META-INF/beans.xml Thu May 17 17:22:21 2018 +0200 +++ b/modules/org.openbravo.base.weld/src/META-INF/beans.xml Mon May 21 16:11:15 2018 +0000 @@ -24,7 +24,9 @@ <weld:exclude name="org.openbravo.base.structure.**"/> <weld:exclude name="org.openbravo.base.util.**"/> <weld:exclude name="org.openbravo.base.validation.**"/> - <weld:exclude name="org.openbravo.dal.**"/> + <weld:exclude name="org.openbravo.dal.security.**"/> + <weld:exclude name="org.openbravo.dal.service.**"/> + <weld:exclude name="org.openbravo.dal.xml.**"/> <weld:exclude name="org.openbravo.erpReports.**"/> <weld:exclude name="org.openbravo.reference.**"/> <weld:exclude name="org.openbravo.scheduling.**"/> diff -r fca1e4e42285 -r 915bf19e1d5b modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml --- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml Thu May 17 17:22:21 2018 +0200 +++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml Mon May 21 16:11:15 2018 +0000 @@ -6,7 +6,7 @@ <!--9BA0836A3CD74EE4AB48753A47211BCC--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> <!--9BA0836A3CD74EE4AB48753A47211BCC--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--9BA0836A3CD74EE4AB48753A47211BCC--> <NAME><![CDATA[User Interface Application]]></NAME> -<!--9BA0836A3CD74EE4AB48753A47211BCC--> <VERSION><![CDATA[2.1.33963]]></VERSION> +<!--9BA0836A3CD74EE4AB48753A47211BCC--> <VERSION><![CDATA[2.1.33994]]></VERSION> <!--9BA0836A3CD74EE4AB48753A47211BCC--> <DESCRIPTION><![CDATA[Provides the main application components for the openbravo user interface]]></DESCRIPTION> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits