Package com.esri.sde.sdk.client

Examples of com.esri.sde.sdk.client.SeTable$SeTableStats


     *
     * @throws Exception
     */
    @Test
    public void testEditVersionedTable_DefaultVersion() throws Exception {
        final SeTable versionedTable = testData.createVersionedTable(session);

        // create a new version
        final SeVersion defaultVersion;
        final SeVersion newVersion;
        {
            defaultVersion = session.issue(new Commands.GetVersionCommand(
                    SeVersion.SE_QUALIFIED_DEFAULT_VERSION_NAME));

            newVersion = session.issue(new Command<SeVersion>() {

                @Override
                public SeVersion execute(ISession session, SeConnection connection)
                        throws SeException, IOException {
                    SeVersion newVersion = new SeVersion(connection,
                            SeVersion.SE_QUALIFIED_DEFAULT_VERSION_NAME);
                    // newVersion.getInfo();
                    newVersion.setName(connection.getUser() + ".GeoToolsTestVersion");
                    newVersion.setParentName(defaultVersion.getName());
                    newVersion.setDescription(defaultVersion.getName()
                            + " child for GeoTools ArcSDE unit tests");
                    // do not require ArcSDE to create a unique name if the
                    // required
                    // version already exists
                    boolean uniqueName = false;
                    try {
                        newVersion.create(uniqueName, newVersion);
                    } catch (SeException e) {
                        int sdeError = e.getSeError().getSdeError();
                        if (sdeError != -177) {
                            throw new ArcSdeException(e);
                        }
                        // "VERSION ALREADY EXISTS", ignore and continue..
                        newVersion.getInfo();
                    }
                    return newVersion;
                }
            });
        }

        // edit default version
        SeState newState1 = session.issue(new Command<SeState>() {
            @Override
            public SeState execute(ISession session, SeConnection connection) throws SeException,
                    IOException {
                SeObjectId defVersionStateId = defaultVersion.getStateId();
                SeState defVersionState = new SeState(connection, defVersionStateId);
                // create a new state as a child of the current one, the current
                // one
                // must be closed
                if (defVersionState.isOpen()) {
                    defVersionState.close();
                }
                SeState newState1 = new SeState(connection);
                newState1.create(defVersionState.getId());
                return newState1;
            }
        });

        session.startTransaction();
        testData.insertIntoVersionedTable(session, newState1, versionedTable.getName(),
                "name 1 state 1");
        testData.insertIntoVersionedTable(session, newState1, versionedTable.getName(),
                "name 2 state 1");

        final SeObjectId parentStateId = newState1.getId();
        session.close(newState1);

        final SeState newState2 = session.issue(new Command<SeState>() {
            @Override
            public SeState execute(ISession session, SeConnection connection) throws SeException,
                    IOException {
                SeState newState = new SeState(connection);
                newState.create(parentStateId);
                return newState;
            }
        });

        testData.insertIntoVersionedTable(session, newState2, versionedTable.getName(),
                "name 1 state 2");

        session.issue(new Command<Void>() {
            @Override
            public Void execute(ISession session, SeConnection connection) throws SeException,
                    IOException {
                // Change the version's state pointer to the last edit state.
                defaultVersion.changeState(newState2.getId());

                // Trim the state tree.
                newState2.trimTree(parentStateId, newState2.getId());

                return null;
            }
        });
        session.commitTransaction();

        // we edited the default version, lets query the default version and the
        // new version and assert they have the correct feature count
        final SeObjectId defaultVersionStateId = defaultVersion.getStateId();
        SeState defVersionState = session.createState(defaultVersionStateId);

        int defVersionCount = getTempTableCount(session, versionedTable.getName(), null, null,
                defVersionState);
        assertEquals(3, defVersionCount);

        SeState newVersionState = session.createState(newVersion.getStateId());
        int newVersionCount = getTempTableCount(session, versionedTable.getName(), null, null,
                newVersionState);
        assertEquals(0, newVersionCount);
    }
View Full Code Here


        testData = new TestData();
        testData.setUp();
        {
            ISession session = testData.getConnectionPool().getSession();
            try {
                SeTable versionedTable = testData.createVersionedTable(session);
                tableName = versionedTable.getQualifiedName();
            } finally {
                session.dispose();
            }
        }
    }
View Full Code Here

        try {
            final String tableName;
            {
                ISession session = testData.getConnectionPool().getSession();
                try {
                    SeTable versionedTable = testData.createVersionedTable(session);
                    tableName = versionedTable.getQualifiedName();
                } finally {
                    session.dispose();
                }
            }
View Full Code Here

                // } catch (SeException e) {
                // // LOGGER.log(Level.WARNING, "while deleteing layer " +
                // tableName + " got '" +
                // // e.getSeError().getErrDesc() + "'");
                // }
                SeTable table = new SeTable(connection, tableName);
                try {
                    table.delete();
                } catch (SeException ignorable) {
                    // table did not already exist
                }
                return null;
            }
View Full Code Here

             * Create a qualified table name with current user's name and the name of the table to
             * be created, "EXAMPLE".
             */
            final String tableName = getTempTableName(session);

            final SeTable tempTable = session.createSeTable(tableName);
            final SeLayer tempTableLayer = session.issue(new Command<SeLayer>() {
                @Override
                public SeLayer execute(ISession session, SeConnection connection)
                        throws SeException, IOException {
                    SeLayer tempTableLayer = new SeLayer(connection);
View Full Code Here

        try {
            session.issue(new Command<Void>() {
                @Override
                public Void execute(ISession session, SeConnection connection) throws SeException,
                        IOException {
                    SeTable table;
                    try {
                        table = session.getTable(tempTableName);
                    } catch (IOException e) {
                        // table does not exist, its ok.
                        return null;
                    }
                    table.truncate();
                    return null;
                }
            });
        } finally {
            session.dispose();
View Full Code Here

    }

    private static void createMasterTable(final ISession session, final TestData td)
            throws IOException, UnavailableConnectionException {

        final SeTable table = session.createSeTable(MASTER);

        final Command<SeLayer> createLayerCmd = new Command<SeLayer>() {

            @Override
            public SeLayer execute(ISession session, SeConnection connection) throws SeException,
                    IOException {
                SeLayer layer;
                try {
                    table.delete();
                } catch (SeException e) {
                    // no-op, table didn't existed
                }

                SeColumnDefinition[] colDefs = new SeColumnDefinition[2];

                colDefs[0] = new SeColumnDefinition("ID", SeColumnDefinition.TYPE_INT32, 10, 0,
                        false);
                colDefs[1] = new SeColumnDefinition("NAME", SeColumnDefinition.TYPE_STRING, 255, 0,
                        false);

                layer = new SeLayer(connection);
                layer.setTableName(MASTER);
                table.create(colDefs, td.getConfigKeyword());

                layer.setSpatialColumnName("SHAPE");
                layer.setShapeTypes(SeLayer.SE_POINT_TYPE_MASK);
                layer.setGridSizes(1100.0, 0.0, 0.0);
                layer.setDescription("Geotools sde pluing join support testing master table");
View Full Code Here

        LOGGER.info("successfully created master table " + MASTER);
    }

    private static void createChildTable(final ISession session, final TestData td)
            throws IOException, UnavailableConnectionException {
        final SeTable table = session.createSeTable(CHILD);
        Command<Void> createCmd = new Command<Void>() {

            @SuppressWarnings("deprecation")
            @Override
            public Void execute(ISession session, SeConnection connection) throws SeException,
                    IOException {
                try {
                    table.delete();
                } catch (SeException e) {
                    // no-op, table didn't existed
                }

                SeColumnDefinition[] colDefs = new SeColumnDefinition[4];

                colDefs[0] = new SeColumnDefinition("ID", SeColumnDefinition.TYPE_INTEGER, 10, 0,
                        false);
                colDefs[1] = new SeColumnDefinition("MASTER_ID", SeColumnDefinition.TYPE_INTEGER,
                        10, 0, false);
                colDefs[2] = new SeColumnDefinition("NAME", SeColumnDefinition.TYPE_STRING, 255, 0,
                        false);
                colDefs[3] = new SeColumnDefinition("DESCRIPTION", SeColumnDefinition.TYPE_STRING,
                        255, 0, false);

                table.create(colDefs, td.getConfigKeyword());
                return null;
            }
        };

        session.issue(createCmd);
View Full Code Here

        }

        @Override
        public SeTable execute(final ISession session, final SeConnection connection)
                throws SeException, IOException {
            return new SeTable(connection, qualifiedName);
        }
View Full Code Here

        }

        @Override
        public SeTable execute(ISession session, SeConnection connection) throws SeException,
                IOException {
            SeTable table = new SeTable(connection, tableName);

            try {
                table.describe();
            } catch (SeException e) {
                throw new IOException("Table does not exist: " + tableName);
            }

            return table;
View Full Code Here

TOP

Related Classes of com.esri.sde.sdk.client.SeTable$SeTableStats

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.