OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 182
Line 1... Line 1...
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
Line 486... Line 486...
486
        return this.equalsDesc(o, null, true) == null;
486
        return this.equalsDesc(o, null, true) == null;
487
    }
487
    }
488
 
488
 
489
    // compareDefault useful when fields' default are functions containing the name of the table (eg
489
    // compareDefault useful when fields' default are functions containing the name of the table (eg
490
    // serial)
490
    // serial)
491
    public String equalsDesc(SQLField o, SQLSystem otherSystem, boolean compareDefault) {
491
    public String equalsDesc(SQLField o, SQLSyntax otherSyntax, boolean compareDefault) {
492
        final Map<Properties, String> res = getDiffMap(o, otherSystem, compareDefault);
492
        final Map<Properties, String> res = getDiffMap(o, otherSyntax, compareDefault);
493
        if (res.size() == 0)
493
        if (res.size() == 0)
494
            return null;
494
            return null;
495
        else
495
        else
496
            return this.getSQLName() + " != " + o.getSQLName() + ":\n" + CollectionUtils.join(res.values(), "\n");
496
            return this.getSQLName() + " != " + o.getSQLName() + ":\n" + CollectionUtils.join(res.values(), "\n");
497
    }
497
    }
Line 502... Line 502...
502
     * @param o another field.
502
     * @param o another field.
503
     * @param otherSystem the system <code>o</code> originated from, can be <code>null</code>.
503
     * @param otherSystem the system <code>o</code> originated from, can be <code>null</code>.
504
     * @param compareDefault <code>true</code> if defaults should be compared.
504
     * @param compareDefault <code>true</code> if defaults should be compared.
505
     * @return a map containing properties that differs and their values.
505
     * @return a map containing properties that differs and their values.
506
     */
506
     */
507
    public synchronized Map<Properties, String> getDiffMap(SQLField o, SQLSystem otherSystem, boolean compareDefault) {
507
    public synchronized Map<Properties, String> getDiffMap(SQLField o, SQLSyntax otherSystem, boolean compareDefault) {
508
        if (o == null)
508
        if (o == null)
509
            return Collections.singletonMap(null, "other field is null");
509
            return Collections.singletonMap(null, "other field is null");
510
        final Map<Properties, String> res = new HashMap<Properties, String>();
510
        final Map<Properties, String> res = new HashMap<Properties, String>();
511
        if (!this.getName().equals(o.getName()))
511
        if (!this.getName().equals(o.getName()))
512
            res.put(Properties.NAME, "name unequal : " + quoteIdentifier(this.getName()) + " != " + quoteIdentifier(o.getName()));
512
            res.put(Properties.NAME, "name unequal : " + quoteIdentifier(this.getName()) + " != " + quoteIdentifier(o.getName()));