Package org.geotools.data

Examples of org.geotools.data.FeatureDiff


    public FeatureDiff next() throws IOException, NoSuchElementException {
        if (!hasNext()) {
            throw new NoSuchElementException("No more feature diffs in this reader");
        }

        FeatureDiff result = nextDifference;
        nextDifference = null;

        return result;
    }
View Full Code Here


        // updates -> the set of changes has to be rebuilt
        SimpleFeature from = null;
        SimpleFeature to = null;
        boolean removed = false;
        for (int i = 0; i < history.length; i++) {
            FeatureDiff diff = history[i];
            if (diff != null) {
                if (diff.getState() == FeatureDiff.INSERTED) {
                    // is this the rollback of a removal?
                    if(removed == true) {
                        from = null;
                        to = null;
                    } else {
                        from = null;
                        to = diff.getFeature();
                    }
                    removed = false;
                } else if (diff.getState() == FeatureDiff.DELETED) {
                    if (from == null) {
                        from = diff.getOldFeature();
                    }
                    to = null;
                    removed = true;
                } else {
                    // might we have a removed flag before this update? Maybe... if Central
                    // for some reason reinserted the feature (remember we're skipping
                    // changes coming from Central. But in that case we start over fresh
                    if (removed) {
                        removed = false;
                        from = diff.getOldFeature();
                    }

                    // is this the first diff or we have a history?
                    if (from == null) {
                        from = diff.getOldFeature();
                    }
                    to = diff.getFeature();
                }
            }
        }
       
        if(from == null && to == null) {
View Full Code Here

        for (int i = 0; i < delegates.length; i++) {
            if (delegates[i] != null && !featureRead[i]) {
                // read the next diff that is not linked to a conflicting feature
                while (delegates[i].hasNext()) {
                    // grab a new feature diff
                    FeatureDiff fd = delegates[i].next();
                    String fid = fd.getID();
                   
                    // is it about a feature id we already know about?
                    FeatureDiff[] history;
                    if (sortedFids.contains(fid)) {
                        history = diffHistory.get(fid);
View Full Code Here

                    String newLocalRevisionId = String.valueOf(newLocalRevision);
                    String lastLocalRevisionId = lastLocalRevision != -1 ? String.valueOf(lastLocalRevision) : "FIRST";
                    FeatureDiffReader localChanges = fs.getDifferences(lastLocalRevisionId,
                            newLocalRevisionId, ff.id(changedFids), null);
                    while (localChanges.hasNext()) {
                        FeatureDiff fd = localChanges.next();
                        FeatureId diffFeatureId = ff.featureId(fd.getID());
                        if (fd.getState() == FeatureDiff.INSERTED) {
                            throw new GSSException(
                                    "A new locally inserted feature has the same "
                                            + "id as a modified feature coming from Central, this is impossible, "
                                            + "there is either a bug in ID generation or someone manually tampered with it!");
                        } else if (fd.getState() == FeatureDiff.DELETED) {
                            if (deletedFids.contains(diffFeatureId)) {
                                saveCleanMergeMarker(fs, conflicts, lastLocalRevisionId,
                                        newLocalRevision, fd.getID());
                            } else {
                                handleDeletionConflict(fs, conflicts, lastLocalRevisionId,
                                        newLocalRevision, fd.getID());
                            }
                        } else {
                            if (updatedFids.contains(diffFeatureId)) {
                                if (isSameUpdate(fd, findUpdate(fd.getID(), updates))) {
                                    saveCleanMergeMarker(fs, conflicts, lastLocalRevisionId,
                                            newLocalRevision, fd.getID());
                                } else {
                                    handleUpdateConflict(fs, conflicts, lastLocalRevisionId,
                                            newLocalRevision, fd.getID());
                                }
                            } else {
                                handleUpdateConflict(fs, conflicts, lastLocalRevisionId,
                                        newLocalRevision, fd.getID());
                            }
                        }
                    }
                    localChanges.close();
                }
View Full Code Here

TOP

Related Classes of org.geotools.data.FeatureDiff

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.