details: /erp/devel/pi/rev/be6925f7d4e7
changeset: 8112:be6925f7d4e7
user: Asier Lostalé <asier.lostale <at> openbravo.com>
date: Thu Aug 12 09:01:48 2010 +0200
summary: fixed issue 14143: You can create two modules with the same
package_name
*Added unique contraint on ad_module.javapackage column
*Added build validation to check all modules installed in the instance have
different javapackage
diffstat:
src-db/database/model/tables/AD_MODULE.xml
| 3 +
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/DuplicatedJavaPackage.class
| 0
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/DuplicatedJavaPackageData.class
| 0
src-util/buildvalidation/src/org/openbravo/buildvalidation/DuplicatedJavaPackage.java
| 54 ++++++++++
src-util/buildvalidation/src/org/openbravo/buildvalidation/DuplicatedJavaPackage_data.xsql
| 34 ++++++
5 files changed, 91 insertions(+), 0 deletions(-)
diffs (113 lines):
diff -r e485d4ccc287 -r be6925f7d4e7 src-db/database/model/tables/AD_MODULE.xml
--- a/src-db/database/model/tables/AD_MODULE.xml Wed Aug 11 17:34:05
2010 +0200
+++ b/src-db/database/model/tables/AD_MODULE.xml Thu Aug 12 09:01:48
2010 +0200
@@ -158,6 +158,9 @@
<foreign-key foreignTable="AD_ORG" name="AD_MODULE_AD_ORG">
<reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
</foreign-key>
+ <unique name="AD_MODULE_JAVAPACKAGE_UN">
+ <unique-column name="JAVAPACKAGE"/>
+ </unique>
<check name="AD_MODULE_INDEVELOPMENT_CHK"><![CDATA[ISINDEVELOPMENT IN
('Y', 'N')]]></check>
<check name="AD_MODULE_ISACTIVE_CHK"><![CDATA[ISACTIVE IN ('Y',
'N')]]></check>
<check name="AD_MODULE_ISCOMMERCIAL_CHCK"><![CDATA[ISCOMMERCIAL IN ('Y',
'N')]]></check>
diff -r e485d4ccc287 -r be6925f7d4e7
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/DuplicatedJavaPackage.class
Binary file
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/DuplicatedJavaPackage.class
has changed
diff -r e485d4ccc287 -r be6925f7d4e7
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/DuplicatedJavaPackageData.class
Binary file
src-util/buildvalidation/build/classes/org/openbravo/buildvalidation/DuplicatedJavaPackageData.class
has changed
diff -r e485d4ccc287 -r be6925f7d4e7
src-util/buildvalidation/src/org/openbravo/buildvalidation/DuplicatedJavaPackage.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++
b/src-util/buildvalidation/src/org/openbravo/buildvalidation/DuplicatedJavaPackage.java
Thu Aug 12 09:01:48 2010 +0200
@@ -0,0 +1,54 @@
+/*
+ *************************************************************************
+ * 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) 2010 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.buildvalidation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openbravo.database.ConnectionProvider;
+
+/**
+ * This validation is related to this issue 14143. A unique constraint has
been added to
+ * ad_module.javapackage column, this validation checks there are no multiple
modules with the same
+ * javapackage.
+ */
+public class DuplicatedJavaPackage extends BuildValidation {
+
+ @Override
+ public List<String> execute() {
+ ConnectionProvider cp = getConnectionProvider();
+ ArrayList<String> errors = new ArrayList<String>();
+ try {
+ String msg = "";
+ boolean error = false;
+ for (DuplicatedJavaPackageData err :
DuplicatedJavaPackageData.duplicatedPackages(cp)) {
+ msg += "\nModule name:" + err.name + " - Java package:" +
err.javapackage;
+ error = true;
+ }
+ if (error) {
+ errors
+ .add("You can not apply this MP because your instance fails in a
pre-validation: from Openbravo ERP 2.50MP21 it is not allowed to have more than
one module with the same java package. Below you can find the list of modules
with duplicated java package. Once they are fixed you should be able to apply
this MP."
+ + msg);
+ }
+ } catch (Exception e) {
+ return handleError(e);
+ }
+ return errors;
+ }
+}
diff -r e485d4ccc287 -r be6925f7d4e7
src-util/buildvalidation/src/org/openbravo/buildvalidation/DuplicatedJavaPackage_data.xsql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++
b/src-util/buildvalidation/src/org/openbravo/buildvalidation/DuplicatedJavaPackage_data.xsql
Thu Aug 12 09:01:48 2010 +0200
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ *************************************************************************
+ * 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) 2010 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ************************************************************************
+-->
+
+<SqlClass name="DuplicatedJavaPackageData"
package="org.openbravo.buildvalidation">
+ <SqlMethod name="duplicatedPackages" type="preparedStatement"
return="multiple">
+ <Sql><![CDATA[
+ select javapackage, name
+ from ad_module m
+ where exists (select 1
+ from ad_module m2
+ where m2.javapackage=m.javapackage
+ and m2.ad_module_id != m.ad_module_id)
+ order by 1,2
+ ]]>
+ </Sql>
+ </SqlMethod>
+</SqlClass>
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits