details: https://code.openbravo.com/erp/devel/pi/rev/ffae20f94461 changeset: 26396:ffae20f94461 user: Víctor Martínez Romanos <victor.martinez <at> openbravo.com> date: Mon Mar 23 16:09:38 2015 +0100 summary: Fixed bug 29353: ICS implemented indirect dataset dependencies
When getting the module dependencies we take into account all the modules installed in the instance instead of only the one selected by the user. We use the UpdateReferenceDataData.selectModules() method, which is used by the Enterprise Module Management process too, to get the right order. The UpdateReferenceDataData class is now public to be called from InitialClientSetup.java. Added missed ProcessingDataset message details: https://code.openbravo.com/erp/devel/pi/rev/0bc90e3c757f changeset: 26397:0bc90e3c757f user: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com> date: Thu Apr 30 19:24:38 2015 +0200 summary: Related to issue 29353: Refactor of class in FIN_Utility so it can be used in core. This is now used in Initial Client Setup diffstat: modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ExecutePayments.java | 2 +- modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java | 2 +- modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java | 5 +- modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java | 10 +-- src-db/database/sourcedata/AD_MESSAGE.xml | 12 +++ src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData_data.xsql | 4 +- src/org/openbravo/erpCommon/businessUtility/InitialClientSetup.java | 28 +++++-- src/org/openbravo/erpCommon/utility/Utility.java | 39 ++++++++++ 8 files changed, 79 insertions(+), 23 deletions(-) diffs (250 lines): diff -r bb4b37bb475e -r 0bc90e3c757f modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ExecutePayments.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ExecutePayments.java Wed Apr 29 16:35:18 2015 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ExecutePayments.java Thu Apr 30 19:24:38 2015 +0200 @@ -326,7 +326,7 @@ "inpfinPaymentProposalId", IsIDFilter.instance); final FIN_PaymentProposal paymentProposal = dao.getObject(FIN_PaymentProposal.class, strPaymentProposalId); - payments = FIN_Utility.getInStrList(dao.getPaymentProposalPayments(paymentProposal)); + payments = Utility.getInStrList(dao.getPaymentProposalPayments(paymentProposal)); } else if (BatchPaymentExecutionForm.equals(strWindowId)) { payments = vars.getRequestGlobalVariable("inpSelectedRowList", ""); diff -r bb4b37bb475e -r 0bc90e3c757f modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java Wed Apr 29 16:35:18 2015 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java Thu Apr 30 19:24:38 2015 +0200 @@ -485,7 +485,7 @@ vars.setSessionValue("ExecutePayments|Window_ID", strWindowId); vars.setSessionValue("ExecutePayments|Tab_ID", strTabId); vars.setSessionValue("ExecutePayments|Org_ID", strOrg); - vars.setSessionValue("ExecutePayments|payments", FIN_Utility.getInStrList(payments)); + vars.setSessionValue("ExecutePayments|payments", Utility.getInStrList(payments)); if (myMessage != null) vars.setMessage("ExecutePayments|message", myMessage); response.sendRedirect(strDireccion diff -r bb4b37bb475e -r 0bc90e3c757f modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java Wed Apr 29 16:35:18 2015 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java Thu Apr 30 19:24:38 2015 +0200 @@ -256,8 +256,7 @@ // remove selected payments if (selectedScheduledPaymentDetails != null && selectedScheduledPaymentDetails.size() > 0) { - String strSelectedPaymentDetails = FIN_Utility - .getInStrList(selectedScheduledPaymentDetails); + String strSelectedPaymentDetails = Utility.getInStrList(selectedScheduledPaymentDetails); whereClause.append(" and psd not in ("); whereClause.append(strSelectedPaymentDetails); whereClause.append(")"); @@ -272,7 +271,7 @@ for (FIN_PaymentPropDetail ppd : obc.list()) { aux.add(ppd.getFINPaymentScheduledetail()); } - whereClause.append(" and psd.id not in (" + FIN_Utility.getInStrList(aux) + ")"); + whereClause.append(" and psd.id not in (" + Utility.getInStrList(aux) + ")"); } if (!StringUtils.isEmpty(strAmountFrom)) { whereClause.append(" and psd."); diff -r bb4b37bb475e -r 0bc90e3c757f modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java Wed Apr 29 16:35:18 2015 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java Thu Apr 30 19:24:38 2015 +0200 @@ -229,15 +229,9 @@ * List of OBObjects * @return Comma separated string of Id's */ + @Deprecated public static <T extends BaseOBObject> String getInStrList(List<T> obObjectList) { - StringBuilder strInList = new StringBuilder(); - for (T obObject : obObjectList) { - if (strInList.length() == 0) - strInList.append("'" + obObject.getId() + "'"); - else - strInList.append(", '" + obObject.getId() + "'"); - } - return strInList.toString(); + return Utility.getInStrList(obObjectList); } /** diff -r bb4b37bb475e -r 0bc90e3c757f src-db/database/sourcedata/AD_MESSAGE.xml --- a/src-db/database/sourcedata/AD_MESSAGE.xml Wed Apr 29 16:35:18 2015 +0200 +++ b/src-db/database/sourcedata/AD_MESSAGE.xml Thu Apr 30 19:24:38 2015 +0200 @@ -24519,6 +24519,18 @@ <!--D0692F1D88A14444AC768A7C13785E03--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N> <!--D0692F1D88A14444AC768A7C13785E03--></AD_MESSAGE> +<!--D077198FAD434FE098679790DA376BF2--><AD_MESSAGE> +<!--D077198FAD434FE098679790DA376BF2--> <AD_MESSAGE_ID><![CDATA[D077198FAD434FE098679790DA376BF2]]></AD_MESSAGE_ID> +<!--D077198FAD434FE098679790DA376BF2--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--D077198FAD434FE098679790DA376BF2--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--D077198FAD434FE098679790DA376BF2--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--D077198FAD434FE098679790DA376BF2--> <VALUE><![CDATA[ProcessingDataset]]></VALUE> +<!--D077198FAD434FE098679790DA376BF2--> <MSGTEXT><![CDATA[Processing dataset]]></MSGTEXT> +<!--D077198FAD434FE098679790DA376BF2--> <MSGTYPE><![CDATA[I]]></MSGTYPE> +<!--D077198FAD434FE098679790DA376BF2--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> +<!--D077198FAD434FE098679790DA376BF2--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N> +<!--D077198FAD434FE098679790DA376BF2--></AD_MESSAGE> + <!--D09207D3B838452783F194A6A2CDBBA8--><AD_MESSAGE> <!--D09207D3B838452783F194A6A2CDBBA8--> <AD_MESSAGE_ID><![CDATA[D09207D3B838452783F194A6A2CDBBA8]]></AD_MESSAGE_ID> <!--D09207D3B838452783F194A6A2CDBBA8--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> diff -r bb4b37bb475e -r 0bc90e3c757f src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData_data.xsql --- a/src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData_data.xsql Wed Apr 29 16:35:18 2015 +0200 +++ b/src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData_data.xsql Thu Apr 30 19:24:38 2015 +0200 @@ -12,7 +12,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2008-2012 Openbravo SLU + * All portions are Copyright (C) 2008-2015 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -20,7 +20,7 @@ -<SqlClass name="UpdateReferenceDataData" package="org.openbravo.erpCommon.ad_forms"> +<SqlClass name="UpdateReferenceDataData" package="org.openbravo.erpCommon.ad_forms" accessModifier="public"> <SqlClassComment></SqlClassComment> <SqlMethod name="select" type="preparedStatement" return="multiple"> <SqlMethodComment></SqlMethodComment> diff -r bb4b37bb475e -r 0bc90e3c757f src/org/openbravo/erpCommon/businessUtility/InitialClientSetup.java --- a/src/org/openbravo/erpCommon/businessUtility/InitialClientSetup.java Wed Apr 29 16:35:18 2015 +0200 +++ b/src/org/openbravo/erpCommon/businessUtility/InitialClientSetup.java Thu Apr 30 19:24:38 2015 +0200 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2010-2014 Openbravo SLU + * All portions are Copyright (C) 2010-2015 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -22,7 +22,9 @@ import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; import org.apache.commons.fileupload.FileItem; import org.apache.log4j.Logger; @@ -30,8 +32,10 @@ import org.openbravo.base.secureApp.VariablesSecureApp; import org.openbravo.base.structure.BaseOBObject; import org.openbravo.dal.service.OBDal; +import org.openbravo.erpCommon.ad_forms.UpdateReferenceDataData; import org.openbravo.erpCommon.modules.ModuleUtiltiy; import org.openbravo.erpCommon.utility.OBError; +import org.openbravo.erpCommon.utility.Utility; import org.openbravo.model.ad.access.Role; import org.openbravo.model.ad.access.RoleOrganization; import org.openbravo.model.ad.access.User; @@ -43,6 +47,7 @@ import org.openbravo.model.ad.utility.TableTree; import org.openbravo.model.ad.utility.Tree; import org.openbravo.model.common.currency.Currency; +import org.openbravo.service.db.DalConnectionProvider; import org.openbravo.service.db.ImportResult; import org.openbravo.utils.FormatUtilities; @@ -650,21 +655,27 @@ log4j.debug("insertReferenceDataModules() - Starting client creation."); OBError obeResult = new OBError(); obeResult.setType(STRMESSAGEOK); - ArrayList<String> strModules = new ArrayList<String>(); - for (Module module : refDataModules) - strModules.add(module.getId()); + UpdateReferenceDataData[] data; + try { + final String strModules = Utility.getInStrList(refDataModules, true); - try { - strModules = new ArrayList<String>(ModuleUtiltiy.orderByDependency(strModules)); + data = UpdateReferenceDataData.selectModules(new DalConnectionProvider(false), strModules, + "0"); + ModuleUtiltiy.orderModuleByDependency(data); } catch (Exception e) { return logErrorAndRollback("@CreateReferenceDataFailed@", "insertReferenceDataModules() - Exception ocurred while " + "sorting reference data modules by dependencies", e); } - for (int i = 0; i < strModules.size(); i++) { - String strModuleId = strModules.get(i); + final Set<String> alreadyAppliedModules = new HashSet<String>(); + for (int i = 0; i < data.length; i++) { + String strModuleId = data[i].adModuleId; + if (alreadyAppliedModules.contains(strModuleId)) { + continue; + } + Module module = null; for (int j = 0; j < refDataModules.size(); j++) if (refDataModules.get(j).getId().equals(strModuleId)) @@ -731,6 +742,7 @@ elements = iResult.getUpdatedObjects(); logEvent(elements.size() + " @RowsUpdated@"); } + alreadyAppliedModules.add(strModuleId); } return obeResult; } diff -r bb4b37bb475e -r 0bc90e3c757f src/org/openbravo/erpCommon/utility/Utility.java --- a/src/org/openbravo/erpCommon/utility/Utility.java Wed Apr 29 16:35:18 2015 +0200 +++ b/src/org/openbravo/erpCommon/utility/Utility.java Thu Apr 30 19:24:38 2015 +0200 @@ -73,6 +73,7 @@ import org.openbravo.base.provider.OBConfigFileProvider; import org.openbravo.base.secureApp.OrgTree; import org.openbravo.base.secureApp.VariablesSecureApp; +import org.openbravo.base.structure.BaseOBObject; import org.openbravo.dal.core.OBContext; import org.openbravo.dal.service.OBDal; import org.openbravo.data.FieldProvider; @@ -1432,6 +1433,44 @@ } /** + * Creates a comma separated string with the Id's of the OBObjects included in the List. + * + * @param <T> + * @param obObjectList + * List of OBObjects + * @return Comma separated string of Id's + */ + public static <T extends BaseOBObject> String getInStrList(List<T> obObjectList) { + return getInStrList(obObjectList, false); + } + + /** + * Creates a comma separated string with the Id's of the OBObjects included in the List. + * + * @param <T> + * @param obObjectList + * List of OBObjects + * @param addParentheses + * String will be surrounded with parentheses + * @return Comma separated string of Id's + */ + public static <T extends BaseOBObject> String getInStrList(List<T> obObjectList, + boolean addParentheses) { + StringBuilder strInList = new StringBuilder(); + for (T obObject : obObjectList) { + if (strInList.length() == 0) + strInList.append("'" + obObject.getId() + "'"); + else + strInList.append(", '" + obObject.getId() + "'"); + } + if (addParentheses) { + return "(" + strInList.toString() + ")"; + } else { + return strInList.toString(); + } + } + + /** * Determines if a string of characters is an Openbravo UUID (Universal Unique Identifier), i.e., * if it is a 32 length hexadecimal string. * ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
