Package com.esri.sde.sdk.client

Examples of com.esri.sde.sdk.client.SeColumnDefinition


     * @throws SeException
     *             if the SeColumnDefinition constructor throws it due to some invalid parameter
     */
    public static SeColumnDefinition createSeColumnDefinition(AttributeDescriptor type)
            throws SeException {
        SeColumnDefinition colDef = null;
        String colName = type.getLocalName();
        boolean nillable = type.isNillable();

        SdeTypeDef def = getSdeType(type.getType().getBinding());

        int sdeColType = def.colDefType;
        int fieldLength = def.size;
        int fieldScale = def.scale;

        colDef = new SeColumnDefinition(colName, sdeColType, fieldLength, fieldScale, nillable);

        return colDef;
    }
View Full Code Here


        List<AttributeDescriptor> attDescriptors = new ArrayList<AttributeDescriptor>(nCols);

        Class<?> typeClass = null;

        for (int i = 0; i < nCols; i++) {
            SeColumnDefinition colDef = seColumns[i];

            // didn't found in the ArcSDE Java API the way of knowing
            // if an SeColumnDefinition is nillable
            attName = colDef.getName();
            isNilable = colDef.allowsNulls();
            defValue = null;
            fieldLen = colDef.getSize();

            final Integer sdeType = Integer.valueOf(colDef.getType());

            if (sdeType.intValue() == SeColumnDefinition.TYPE_SHAPE) {
                CoordinateReferenceSystem crs = null;

                crs = parseCRS(sdeLayer);
                metadata = crs;

                int seShapeType = sdeLayer.getShapeTypes();
                typeClass = getGeometryTypeFromLayerMask(seShapeType);
                isNilable = (seShapeType & SeLayer.SE_NIL_TYPE_MASK) == SeLayer.SE_NIL_TYPE_MASK;
                defValue = isNilable ? null : ArcSDEGeometryBuilder.defaultValueFor(typeClass);
            } else {
                typeClass = getJavaBinding(sdeType);
                if (typeClass == null) {
                    LOGGER.info("Found an unsupported ArcSDE data type: " + sdeType
                            + " for column " + attName + ". Ignoring it.");
                    continue;
                }
                // @TODO: add restrictions once the Restrictions utility methods
                // are implemented
                // Set restrictions = Restrictions.createLength(name, typeClass,
                // fieldLen);
            }
            final int rowIdType = colDef.getRowIdType();
            if (rowIdType == SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_SDE) {
                continue; // skip over things we cannot edit modify or otherwise treat as
                // attributes
            }
            AttributeTypeBuilder b = new AttributeTypeBuilder();
View Full Code Here

                            GeometryDescriptor geometryAtt = (GeometryDescriptor) currAtt;
                            createSeLayer(layer, qualifiedName, geometryAtt);
                        } else {
                            LOGGER.fine("Creating column definition for " + currAtt);

                            SeColumnDefinition newCol = ArcSDEAdapter
                                    .createSeColumnDefinition(currAtt);

                            // /////////////////////////////////////////////////////////////
                            // HACK!!!!: this hack is just to avoid the error that
                            // occurs //
                            // when adding a column wich is not nillable. Need to fix
                            // this//
                            // but by now it conflicts with the requirement of creating
                            // //
                            // the schema with the correct attribute order. //
                            // /////////////////////////////////////////////////////////////
                            newCol = new SeColumnDefinition(newCol.getName(), newCol.getType(),
                                    newCol.getSize(), newCol.getScale(), true);

                            // /////////////////////////////////////////////////////////////
                            // END of horrible HACK //
                            // /////////////////////////////////////////////////////////////
                            LOGGER.fine("Adding column " + newCol.getName()
                                    + " to the actual table.");
                            table.addColumn(newCol);
                        }
                    }
View Full Code Here

    private static SeTable createSeTable(final SeConnection connection, final String qualifiedName,
            final String hackColName, final String configKeyword) throws SeException {

        final SeTable table;
        final SeColumnDefinition[] tmpCol = new SeColumnDefinition[1];
        tmpCol[0] = new SeColumnDefinition(hackColName, SeColumnDefinition.TYPE_STRING, 4, 0, true);

        table = new SeTable(connection, qualifiedName);

        LOGGER.info("creating table " + qualifiedName);
View Full Code Here

     */
    private static void setRowValue(final SeRow row, final int index, final Object value,
            final SeCoordinateReference coordRef, final String attName) throws IOException {

        try {
            final SeColumnDefinition seColumnDefinition = row.getColumnDef(index);

            final int colType = seColumnDefinition.getType();

            // the actual value to be set, converted to the appropriate type where
            // needed
            Object convertedValue = value;
            if (colType == SeColumnDefinition.TYPE_INT16) {
View Full Code Here

            }

            // use LinkedHashMap to respect column order
            LinkedHashMap<Integer, String> columnList = new LinkedHashMap<Integer, String>();

            SeColumnDefinition columnDefinition;
            String columnName;
            int usedIndex = 0;
            for (int actualIndex = 0; actualIndex < columnDefinitions.length; actualIndex++) {
                columnDefinition = columnDefinitions[actualIndex];
                columnName = columnDefinition.getName();
                // this is an attribute added to the featuretype
                // solely to support FIDs. It isn't an actual attribute
                // on the underlying SDE table, and as such it can't
                // be written to. Skip it!
                if (columnName.equals(shapeAttributeName)) {
                    continue;
                }

                // ignore SeColumns for which we don't have a known mapping
                final int sdeType = columnDefinition.getType();
                if (SeColumnDefinition.TYPE_SHAPE != sdeType
                        && null == ArcSDEAdapter.getJavaBinding(new Integer(sdeType))) {
                    continue;
                }

                // We need to exclude read only types from the set of "mutable"
                // column names.
                final short rowIdType = columnDefinition.getRowIdType();
                if (SeRegistration.SE_REGISTRATION_ROW_ID_COLUMN_TYPE_SDE == rowIdType) {
                    continue;
                }

                columnList.put(Integer.valueOf(usedIndex), columnName);
View Full Code Here

            final SeColumnDefinition[] columnDefinitions = session.describe(typeName);

            // use LinkedHashMap to respect column order
            LinkedHashMap<Integer, String> columnList = new LinkedHashMap<Integer, String>();

            SeColumnDefinition columnDefinition;
            String columnName;
            int usedIndex = 0;
            for (int actualIndex = 0; actualIndex < columnDefinitions.length; actualIndex++) {
                columnDefinition = columnDefinitions[actualIndex];
                columnName = columnDefinition.getName();

                if (fidReader instanceof FIDReader.SdeManagedFidReader) {
                    if (columnName.equals(fidReader.getFidColumn()))
                        continue;
                }

                // ignore SeColumns for which we don't have a known mapping
                final int sdeType = columnDefinition.getType();
                if (SeColumnDefinition.TYPE_SHAPE != sdeType
                        && null == ArcSDEAdapter.getJavaBinding(Integer.valueOf(sdeType))) {
                    continue;
                }
View Full Code Here

                 * another.
                 */
                boolean isNullable = true;

                // first column to be SDE managed feature id
                colDefs[0] = new SeColumnDefinition("ROW_ID", SeColumnDefinition.TYPE_INT32, 10, 0,
                        false);

                colDefs[1] = new SeColumnDefinition(TEST_TABLE_COLS[0],
                        SeColumnDefinition.TYPE_INT32, 10, 0, false);
                colDefs[2] = new SeColumnDefinition(TEST_TABLE_COLS[1],
                        SeColumnDefinition.TYPE_INT16, 4, 0, isNullable);
                colDefs[3] = new SeColumnDefinition(TEST_TABLE_COLS[2],
                        SeColumnDefinition.TYPE_FLOAT32, 5, 2, isNullable);
                colDefs[4] = new SeColumnDefinition(TEST_TABLE_COLS[3],
                        SeColumnDefinition.TYPE_FLOAT64, 25, 4, isNullable);
                colDefs[5] = new SeColumnDefinition(TEST_TABLE_COLS[4],
                        SeColumnDefinition.TYPE_STRING, 25, 0, isNullable);

                colDefs[6] = new SeColumnDefinition(TEST_TABLE_COLS[5],
                        SeColumnDefinition.TYPE_NSTRING, 25, 0, isNullable);

                colDefs[7] = new SeColumnDefinition(TEST_TABLE_COLS[6],
                        SeColumnDefinition.TYPE_DATE, 1, 0, isNullable);
                // this is a blob one and should be ignored to all effects
                colDefs[8] = new SeColumnDefinition("SE_ANNO_CAD_DATA",
                        SeColumnDefinition.TYPE_BLOB, 1000, 0, isNullable);

                try {
                    table.delete();
                } catch (Exception e) {
View Full Code Here

                // ROW_ID, INT_COL, DATE_COL, STRING_COL, SE_ANNO_CAD_DATA
                final int numCols = 5;
                final SeColumnDefinition[] colDefs = new SeColumnDefinition[numCols];

                // first column to be SDE managed feature id
                colDefs[0] = new SeColumnDefinition("ROW_ID", SeColumnDefinition.TYPE_INT32, 10, 0,
                        false);
                colDefs[1] = new SeColumnDefinition("INT_COL", SeColumnDefinition.TYPE_INT32, 10,
                        0, isNullable);
                colDefs[2] = new SeColumnDefinition("DATE_COL", SeColumnDefinition.TYPE_DATE, 1, 0,
                        isNullable);
                colDefs[3] = new SeColumnDefinition("STRING_COL", SeColumnDefinition.TYPE_STRING,
                        25, 0, isNullable);
                // use a blob type just to make sure they're correctly ignored
                colDefs[4] = new SeColumnDefinition("SE_ANNO_CAD_DATA",
                        SeColumnDefinition.TYPE_BLOB, 4000, 0, isNullable);

                /*
                 * Create the table using the DBMS default configuration keyword. Valid keywords are
                 * defined in the dbtune table.
View Full Code Here

                }

                SeColumnDefinition[] colDefs = new SeColumnDefinition[2];
                boolean isNullable = true;
                // first column to be SDE managed feature id
                colDefs[0] = new SeColumnDefinition("ROW_ID", SeColumnDefinition.TYPE_INT32, 10, 0,
                        false);
                colDefs[1] = new SeColumnDefinition("NAME", SeColumnDefinition.TYPE_STRING, 25, 0,
                        isNullable);

                table.create(colDefs, getConfigKeyword());
                layer.setSpatialColumnName("SHAPE");
View Full Code Here

TOP

Related Classes of com.esri.sde.sdk.client.SeColumnDefinition

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.