OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 174 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 174 Rev 177
Line 121... Line 121...
121
        }
121
        }
122
    };
122
    };
123
 
123
 
124
    @SuppressWarnings("unchecked")
124
    @SuppressWarnings("unchecked")
125
    public static final Map<String, Number> getUndefIDs(final SQLSchema schema) {
125
    public static final Map<String, Number> getUndefIDs(final SQLSchema schema) {
-
 
126
        assert Thread.holdsLock(UNDEFINED_IDs);
126
        if (!UNDEFINED_IDs.containsKey(schema)) {
127
        if (!UNDEFINED_IDs.containsKey(schema)) {
127
            final Map<String, Number> r;
128
            final Map<String, Number> r;
128
            if (schema.contains(undefTable)) {
129
            if (schema.contains(undefTable)) {
129
                final SQLBase b = schema.getBase();
130
                final SQLBase b = schema.getBase();
130
                final SQLTable undefT = schema.getTable(undefTable);
131
                final SQLTable undefT = schema.getTable(undefTable);
Line 162... Line 163...
162
            final Map<String, Number> map = getUndefIDs(b);
163
            final Map<String, Number> map = getUndefIDs(b);
163
            return Tuple2.create(map.containsKey(tableName), map.get(tableName));
164
            return Tuple2.create(map.containsKey(tableName), map.get(tableName));
164
        }
165
        }
165
    }
166
    }
166
 
167
 
-
 
168
    public static final Map<String, Number> getUndefinedIDs(final SQLSchema schema) {
-
 
169
        final Map<String, Number> res;
-
 
170
        synchronized (UNDEFINED_IDs) {
-
 
171
            res = new HashMap<>(getUndefIDs(schema));
-
 
172
        }
-
 
173
        return Collections.unmodifiableMap(res);
-
 
174
    }
-
 
175
 
167
    private static final SQLCreateMoveableTable getCreateUndefTable(SQLSyntax syntax) {
176
    private static final SQLCreateMoveableTable getCreateUndefTable(SQLSyntax syntax) {
168
        final SQLCreateMoveableTable createTable = new SQLCreateMoveableTable(syntax, undefTable);
177
        final SQLCreateMoveableTable createTable = new SQLCreateMoveableTable(syntax, undefTable);
169
        createTable.addVarCharColumn(UNDEF_TABLE_TABLENAME_FIELD, 250);
178
        createTable.addVarCharColumn(UNDEF_TABLE_TABLENAME_FIELD, 250);
170
        createTable.addColumn(UNDEF_TABLE_ID_FIELD, syntax.getIDType());
179
        createTable.addColumn(UNDEF_TABLE_ID_FIELD, syntax.getIDType());
171
        createTable.setPrimaryKey(UNDEF_TABLE_TABLENAME_FIELD);
180
        createTable.setPrimaryKey(UNDEF_TABLE_TABLENAME_FIELD);