Package org.netbeans.modules.dbschema

Examples of org.netbeans.modules.dbschema.ColumnElement


        TableDesc secondaryTable = findTableDesc(((MappingTableElementImpl) mappingSecondaryKey.getTable()).getTableObject());

        for (int i = 0; i < pairs.length; i++) {
            ColumnPairElement pair = pairs[i];

            ColumnElement lc = pair.getLocalColumn();
            ColumnElement fc = pair.getReferencedColumn();

            referencingKey.addColumn(lc);

            FieldDesc lf = getLocalFieldDesc(lc);
            referencingKey.addField(lf);
View Full Code Here


            KeyDesc key = new KeyDesc();
            t.setKey(key);
            key.addColumns(keys);

            for (int j = 0; j < keys.size(); j++) {
                ColumnElement c = (ColumnElement) keys.get(j);

                if (c != null) {
                    key.addField(getLocalFieldDesc(c));
                }
            }
View Full Code Here

     *
     * @param versionField Field used in version consistency check.
     */
    private void registerVersionFieldWithTable(LocalFieldDesc versionField) {
        // Version field must be mapped to exactly one column.
        ColumnElement ce =  (ColumnElement) versionField.getColumnElements().next();
        Iterator iter = tables.iterator();

        while (iter.hasNext()) {
            TableDesc table = (TableDesc) iter.next();

            if (!table.isJoinTable()) {
                if (ce.getDeclaringTable() == table.getTableElement()) {
                    table.setVersionField(versionField);
                    break;
                }
            }
        }
View Full Code Here

                    if (f instanceof LocalFieldDesc) {
                        result = (LocalFieldDesc) f;

                        for (int k = 0; k < result.columnDescs.size(); k++) {
                            ColumnElement c = (ColumnElement) result.columnDescs.get(k);

                            // if (c.equals(column))
                            if (c.getName().getFullName().compareTo(column.getName().getFullName()) == 0) {
                                // If f is a tracked field and it is not the primary, we continue
                                // searching.
                                if ((f.getTrackedFields() != null) &&
                                        ((f.sqlProperties & FieldDesc.PROP_PRIMARY_TRACKED_FIELD) == 0)) {
                                    continue;
View Full Code Here

    public boolean isPrimitiveMappedToNullableColumn() {
        if (primitiveMappedToNullableColumn == null) {
            boolean rc = getType().isPrimitive();

            for (Iterator iter = columnDescs.iterator(); iter.hasNext() && rc; ) {
                ColumnElement c = (ColumnElement) iter.next();
                rc = c.isNullable();
            }
            primitiveMappedToNullableColumn = new Boolean(rc);
        }

        return primitiveMappedToNullableColumn.booleanValue();
View Full Code Here

     * This method computes the type precedence for the given field f.
     * @return an integer value indicating the precedence. 0 indicates
     * highest precedence and Integer.MAX_VALUE indicates lowest.
     */
    private int computeTypePrecedence() {
        ColumnElement c = (ColumnElement) columnDescs.get(0);
        int sqlType = c.getType();
        Class type = getType();
        boolean isNullable = c.isNullable();
        int precedence = Integer.MAX_VALUE;

        switch (sqlType) {
            case Types.TINYINT:
            case Types.SMALLINT:
            case Types.INTEGER:
            case Types.BIGINT:
                if (isNullable) {
                    precedence = lookupTypePrecedence(type, nullableNonScaledTypes);
                } else {
                    precedence = lookupTypePrecedence(type, nonNullableNonScaledTypes);
                }
                break;
            case Types.REAL:
            case Types.FLOAT:
            case Types.DOUBLE:
                if (isNullable) {
                    precedence = lookupTypePrecedence(type, nullableScaledTypes);
                else {
                    precedence = lookupTypePrecedence(type, nonNullableScaledTypes);
                }
                break;
            case Types.NUMERIC:
            case Types.DECIMAL:
                int scale = -1;
                if ((scale = c.getScale().intValue()) == 0) {
                    // non scaled type
                    if (isNullable) {
                        precedence = lookupTypePrecedence(type, nullableNonScaledTypes);
                    } else {
                        precedence = lookupTypePrecedence(type, nonNullableNonScaledTypes);
View Full Code Here

            }

            for (int i = 0; i < size1; i++) {
                found = false;

                ColumnElement c1 = (ColumnElement) columnList1.get(i);

                // Find if any column of columnList2 matches with c1.
                for (int j = 0; j < size2; j++) {
                    ColumnElement c2 = (ColumnElement) columnList2.get(j);

                    if (c1.getName().getFullName().equals(c2.getName().getFullName())) {
                        found = true;
                    }
                }

                // If we are doing an exact match, and no match is found,
View Full Code Here

            }

            if (columns == null) continue;

            for (int j = 0; j < columns.size(); j++) {
                ColumnElement ce = (ColumnElement) columns.get(j);
                TableElement te = ce.getDeclaringTable();

                if (te == null) {
                    throw new JDOFatalInternalException(I18NHelper.getMessage(messages,
                            "core.configuration.columnnotable")); // NOI18N
                }
View Full Code Here

TOP

Related Classes of org.netbeans.modules.dbschema.ColumnElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.