details: http://code.openbravo.com/erp/devel/upgrader-2.40_2.50/rev/5635fe45973a changeset: 0:5635fe45973a user: Antonio Moreno <antonio.moreno <at> openbravo.com> date: Tue Mar 24 17:34:52 2009 +0100 summary: First version of the upgrade files
diffstat: build.xml | 49 + config/upgrader.properties | 7 + files/build-trl.xml | 348 +++++ files/build.xml | 379 +++++ files/build.xml.src-db | 656 +++++++++ files/dbsourcemanager.jar | files/fileComparator/.classpath | 13 + files/fileComparator/.project | 17 + files/fileComparator/build.xml | 37 + files/fileComparator/build/.svn/all-wcprops | 5 + files/fileComparator/build/.svn/entries | 28 + files/fileComparator/build/.svn/format | 1 + files/fileComparator/build/log4j.properties | 25 + files/fileComparator/build/org/openbravo/upgrader/checksum/CheckSum$1.class | files/fileComparator/build/org/openbravo/upgrader/checksum/CheckSum.class | files/fileComparator/build/org/openbravo/upgrader/checksum/CheckSumTask.class | files/fileComparator/build/org/openbravo/upgrader/checksum/Comparator$1.class | files/fileComparator/build/org/openbravo/upgrader/checksum/Comparator.class | files/fileComparator/build/org/openbravo/upgrader/checksum/ComparatorTask.class | files/fileComparator/build/org/openbravo/upgrader/utils/Utility.class | files/fileComparator/config/upgrader.properties | 7 + files/fileComparator/lib/ant-1.7.1.jar | files/fileComparator/lib/antlr-2.7.6.jar | files/fileComparator/lib/antlr-runtime-3.0.jar | files/fileComparator/lib/commons-logging-1.1.jar | files/fileComparator/lib/hybridlabs-beautifier-1.1.9.jar | files/fileComparator/lib/jalopy-1.5-rc3p1.jar | files/fileComparator/lib/log4j-1.2.8.jar | files/fileComparator/lib/org.openarchitectureware.core.xpand2_4.3.1.20080910-1400PRD.jar | files/fileComparator/src/log4j.properties | 25 + files/fileComparator/src/org/openbravo/upgrader/checksum/CheckSum.java | 92 + files/fileComparator/src/org/openbravo/upgrader/checksum/CheckSumTask.java | 20 + files/fileComparator/src/org/openbravo/upgrader/checksum/Comparator.java | 113 + files/fileComparator/src/org/openbravo/upgrader/checksum/ComparatorTask.java | 16 + files/fileComparator/src/org/openbravo/upgrader/utils/Utility.java | 100 + files/postscript-upgrader-Oracle.sql | 265 ++++ files/postscript-upgrader-PostgreSql.sql | 273 ++++ files/prescript-upgrader-Oracle.sql | 5 + files/prescript-upgrader-PostgreSql.sql | 5 + 39 files changed, 2486 insertions(+), 0 deletions(-) diffs (truncated from 2610 to 300 lines): diff -r 000000000000 -r 5635fe45973a build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build.xml Tue Mar 24 17:34:52 2009 +0100 @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<project name="upgrade-builder" default="build" basedir="."> + <property file="config/upgrader.properties"/> + + <target name="build.upgrader"> + <delete dir="database-upgrader" /> + <mkdir dir="database-upgrader" /> + <copy todir="database-upgrader/src-db"> + <fileset dir="${target.path}/src-db"/> + </copy> + <copy todir="database-upgrader/src-db/database/model/"> + <fileset file="files/pre*"/> + </copy> + <copy todir="database-upgrader/src-db/database/model/"> + <fileset file="files/post*"/> + </copy> + <copy todir="database-upgrader/"> + <fileset file="files/build.xml"/> + </copy> + <copy todir="database-upgrader/lib"> + <fileset dir="${original.path}/lib"/> + </copy> + <copy todir="database-upgrader/src-db/database/"> + <fileset file="files/build.xml.src-db"/> + </copy> + <copy todir="database-upgrader/src-db/database/lib" overwrite="yes"> + <fileset dir="${original.path}/src-db/database/lib"/> + </copy> + <move file="database-upgrader/src-db/database/build.xml.src-db" tofile="database-upgrader/src-db/database/build.xml" overwrite="yes" /> + <copy todir="database-upgrader/src-db/database/lib" overwrite="yes"> + <fileset file="files/dbsourcemanager.jar"/> + </copy> + <copy todir="database-upgrader/src-db/originalDatabase"> + <fileset dir="${original.path}/src-db/database"/> + </copy> + <copy todir="database-upgrader/config/"> + <fileset file="${original.path}/config/Openbravo.properties"/> + </copy> + <copy tofile="files/fileComparator/config/upgrader.properties" overwrite="yes"> + <fileset file="config/upgrader.properties"/> + </copy> + <delete dir="mod" /> + <delete dir="${target.path}/codeCustomizations" /> + <ant dir="files/fileComparator/" target="compare.files" inheritAll="true" inheritRefs="true" /> + <copy todir="${target.path}/codeCustomizations"> + <fileset dir="mod"/> + </copy> + </target> +</project> diff -r 000000000000 -r 5635fe45973a config/upgrader.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/upgrader.properties Tue Mar 24 17:34:52 2009 +0100 @@ -0,0 +1,7 @@ +target.path=/home/openbravo/MercTrunk/trunk.main/ +original.path=/home/openbravo/MercTrunk/r2.40/ +source.path=/home/openbravo/OpenbravoERP/AppsOpenbravo/ +checksum.file=checksum.file +module.dir=mod +modulePackage=org.openbravo.com.mycustomization.module +templatePackage=org.openbravo.com.mycustomization.template diff -r 000000000000 -r 5635fe45973a files/build-trl.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/files/build-trl.xml Tue Mar 24 17:34:52 2009 +0100 @@ -0,0 +1,348 @@ +<project name="trl" default="tranlations" basedir="."> + <property name="base.config" location="config" /> + <property file="${base.config}/Openbravo.properties" /> + <condition property="bbdd.owner.url" value="${bbdd.url}/${bbdd.sid}" else="${bbdd.url}"> + <and> + <equals arg1="${bbdd.rdbms}" arg2="POSTGRE" /> + </and> + </condition> + + <target name="tranlations"> + <antcall target="tranlations.${bbdd.rdbms}"/> + </target> + + <target name="tranlations.ORACLE"> + <sql driver="${bbdd.driver}" + url="${bbdd.owner.url}" + userid="${bbdd.user}" + password="${bbdd.password}" + onerror="continue" + keepformat="true" + delimiter="/" + delimitertype="row" + autocommit="true"> + <classpath> + <fileset dir="lib"> + <include name="**/*.jar"> + </include> + </fileset> + </classpath> + <transaction> + declare + v_package varchar2(500); + n number; + v_ti_id varchar2(32); + found boolean; + v_module_id varchar2(32); + begin + + select count(*) + into n from + ad_module m, ad_module_dbprefix p + where m.ad_module_id = p.ad_module_id + and p.name='CUS'; + if n=0 then + dbms_output.put_line('No cus module found!!'); + return; + end if; + + select javapackage, m.ad_module_id + into v_package, v_module_id + from ad_module m, ad_module_dbprefix p + where m.ad_module_id = p.ad_module_id + and p.name='CUS'; + + --Delete trl in module + delete + from ad_textinterfaces_trl t + where exists (select 1 + from ad_textinterfaces i + where i.filename like '/'||replace(v_package,'.','/')||'%' + and i.ad_textinterfaces_id = t.ad_textinterfaces_id + ); + + --Select all the interfaces for the new files (in the correct package) + for ti in (select * + from ad_textinterfaces i + where i.filename like '/'||replace(v_package,'.','/')||'%' + and isused='Y' + order by filename, text) loop + + --Identify the existent interfaces in same file but in diferent package, only + --if it is unique + found := false; + for i in (select ad_textinterfaces_id + from ad_textinterfaces i + where i.filename not like '/'||replace(v_package,'.','/')||'%' + and substr(i.filename,instr(i.filename,'/',-1)) = substr(ti.filename,instr(ti.filename,'/',-1)) + and ti.text = i.text + group by ad_textinterfaces_id + having count(*)=1) loop + found := true; + dbms_output.put_line('Found old trl for text '||ti.text||'. File '||ti.filename||' ID:'||i.ad_textinterfaces_id); + -- Create a new trl for each language, identical to the old one but + -- pointing to the new element + insert into ad_textinterfaces_trl + (AD_TEXTINTERFACES_TRL_ID, AD_TEXTINTERFACES_ID, AD_LANGUAGE, + AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, + CREATED, CREATEDBY, UPDATED, UPDATEDBY, + TEXT, ISTRANSLATED) + select get_uuid(), ti.AD_TEXTINTERFACES_ID, AD_LANGUAGE, + AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, + now(), '0', now(), '0', + TEXT, ISTRANSLATED + from ad_textinterfaces_trl + where ad_textinterfaces_id = i.ad_textinterfaces_id; + end loop; + + if (not found) then + --Not found, file might be renamed, try to find the tranlsation by text, + --only take in case the text exists in any file and there are not multiple + --translations for it + + + --check for the text in any file, not in the package + select count(*) + into n + from ad_textinterfaces i + where i.text = ti.text + and i.filename is not null + and i.filename not like '/'||replace(v_package,'.','/')||'%'; + + if n>0 then + --check for uniquness: the same text not translated in diferent ways + select count(*) + into n + from (select i.text, t.ad_language + from ad_textinterfaces i, ad_textinterfaces_trl t + where i.text = ti.text + and i.filename is not null + and i.filename not like '/'||replace(v_package,'.','/')||'%' + and t.ad_textinterfaces_id = i.ad_textinterfaces_id + group by i.text, t.ad_language + having count(*)>1); + if n=0 then + found := true; + dbms_output.put_line('Found in other file tranlation for '||ti.text||', renamed file:'||ti.filename); + insert into ad_textinterfaces_trl + (AD_TEXTINTERFACES_TRL_ID, AD_TEXTINTERFACES_ID, AD_LANGUAGE, + AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, + CREATED, CREATEDBY, UPDATED, UPDATEDBY, + TEXT, ISTRANSLATED) + select get_uuid(), ti.AD_TEXTINTERFACES_ID, AD_LANGUAGE, + AD_CLIENT_ID, AD_ORG_ID, ISACTIVE, + now(), '0', now(), '0', + TEXT, ISTRANSLATED + from ad_textinterfaces_trl + where ad_textinterfaces_id = (select max(ad_textinterfaces_id) + from ad_textinterfaces i + where i.text = ti.text + and i.filename not like '/'||replace(v_package,'.','/')||'%' + and i.filename is not null); + end if; + end if; + end if; + if not found then + dbms_output.put_line('WARN: NOT found tranlation for '||ti.text||', in file:'||ti.filename); + end if; + end loop; + + --Clean the texitinterfaces that where not found + delete + from ad_textinterfaces t + where not exists (select 1 + from ad_textinterfaces_trl i + where i.ad_textinterfaces_id = t.ad_textinterfaces_id + ) + and ad_module_id = v_module_id; + end; + </transaction> + </sql> + </target> + + + + + +<target name="tranlations.POSTGRE"> + <sql driver="${bbdd.driver}" + url="${bbdd.owner.url}" + userid="${bbdd.user}" + password="${bbdd.password}" + onerror="continue" + keepformat="true" + delimiter="/" + delimitertype="row" + autocommit="true"> + <classpath> + <fileset dir="lib"> + <include name="**/*.jar"> + </include> + </fileset> + </classpath> + <transaction> + +CREATE OR REPLACE FUNCTION keep_old_trl() + RETURNS void AS +$BODY$ DECLARE +/************************************************************************* +* 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 SL +* All portions are Copyright (C) 2009 Openbravo SL +* All Rights Reserved. +* Contributor(s): ______________________________________. +************************************************************************/ + + declare + v_package varchar(500); + n numeric; + v_ti_id varchar(32); + found boolean; + v_module_id varchar(32); + ti RECORD; + c RECORD; + begin + + select count(*) + into n from + ad_module m, ad_module_dbprefix p + where m.ad_module_id = p.ad_module_id + and p.name='CUS'; + if n=0 then + RAISE NOTICE 'No cus module found!!'; + + return; + end if; + + select javapackage, m.ad_module_id + into v_package, v_module_id + from ad_module m, ad_module_dbprefix p + where m.ad_module_id = p.ad_module_id + and p.name='CUS'; + + --Delete trl in module ------------------------------------------------------------------------------ Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits