Examples of SeState


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

                if (!(streamOperation instanceof SeQuery)) {
                    LOGGER.finer("StreamOp is not query, verifying an SeState can be used");

                    // create a new state for the operation only if its not a
                    // simple query
                    final SeState currentState;
                    final SeObjectId currStateId = version.getStateId();
                    currentState = new SeState(connection, currStateId);

                    if (LOGGER.isLoggable(Level.FINER)) {
                        LOGGER.finer(versionName + " version state: " + currStateId.longValue()
                                + ", parent: " + currentState.getParentId().longValue()
                                + ", open: " + currentState.isOpen() + ", owner: "
                                + currentState.getOwner() + ", current user: "
                                + connection.getUser());
                    }

                    final String currUser = connection.getUser();
                    final String stateOwner = currentState.getOwner();

                    if (!(currentState.isOpen() && currUser.equals(stateOwner))) {
                        LOGGER.finer("Creating new state for the operation");
                        SeState newState = session.createChildState(currStateId.longValue());
                        if (LOGGER.isLoggable(Level.FINER)) {
                            LOGGER.finer("Setting version " + versionName + "to new state "
                                    + newState.getId().longValue());
                        }
                        version.changeState(newState.getId());
                    }
                }

                SeObjectId differencesId = new SeObjectId(SeState.SE_NULL_STATE_ID);
                // version.getInfo();
View Full Code Here

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

                            LOGGER.finest("Refreshing '" + version.getName() + "' version info");
                        }
                        version.getInfo();

                        LOGGER.finest("Getting version state");
                        final SeState currentState = new SeState(connection, version.getStateId());
                        final long currentStateId = currentState.getId().longValue();

                        if (LOGGER.isLoggable(Level.FINER)) {
                            LOGGER.finer(version.getName() + "version state: " + currentStateId
                                    + ", open: " + currentState.isOpen() + ", owner: "
                                    + currentState.getOwner() + ", current user: "
                                    + connection.getUser());
                        }

                        LOGGER.finer("Creating new state for the transaction...");
                        transactionState = session.createChildState(currentStateId);
View Full Code Here

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

                }
            });
        }

        // 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

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

        }

        @Override
        public SeState execute(ISession session, SeConnection connection) throws SeException,
                IOException {
            SeState parentState = new SeState(connection, new SeObjectId(parentStateId));

            SeState realParent = null;

            boolean mergeParentToRealParent = false;

            if (parentState.isOpen()) {
                // only closed states can have child states
                try {
                    parentState.close();
                    realParent = parentState;
                } catch (SeException e) {
                    final int errorCode = e.getSeError().getSdeError();
                    if (SeError.SE_STATE_INUSE == errorCode
                            || SeError.SE_NO_PERMISSIONS == errorCode) {
                        // it's not our state or somebody's editing it so we
                        // need to clone the parent,
                        // starting from the parent of the parent
                        realParent = new SeState(connection, parentState.getParentId());
                        mergeParentToRealParent = true;
                    } else {
                        throw e;
                    }
                }
            } else {
                realParent = parentState;
            }

            // create the new state
            SeState newState = new SeState(connection);
            newState.create(realParent.getId());

            if (mergeParentToRealParent) {
                // a sibling of parentStateId was created instead of a
                // child, we need to merge the changes
                // in parentStateId to the new state so they refer to the
                // same content.
                // SE_state_merge applies changes to a parent state to
                // create a new merged state.
                // The new state is the child of the parent state with the
                // changes of the second state.
                // Both input states must have the same parent state.
                // When a row has been changed in both parent and second
                // states, the row from the changes state is used.
                // The parent and changes states must be open or owned by
                // the current user unless the current user is the ArcSDE
                // DBA.
                newState.merge(realParent.getId(), parentState.getId());
            }

            return newState;
        }
View Full Code Here

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

        }

        @Override
        public SeState execute(final ISession session, final SeConnection connection)
                throws SeException, IOException {
            return new SeState(connection, stateId);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.