Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.RevFeatureType


        String name = NodeRef.nodeFromPath(path);
        String refSpec = "HEAD:" + path;
        Optional<RevFeature> revFeature = repository.command(RevObjectParse.class)
                .setRefSpec(refSpec).call(RevFeature.class);
        if (revFeature.isPresent()) {
            RevFeatureType revFeatureType = repository.command(ResolveFeatureType.class)
                    .setRefSpec(refSpec).call().get();
            FeatureBuilder builder = new FeatureBuilder(revFeatureType);
            return builder.build(name, revFeature.get());
        } else {
            return null;
View Full Code Here


        String name = NodeRef.nodeFromPath(path);
        String refSpec = "WORK_HEAD:" + path;
        Optional<RevFeature> revFeature = repository.command(RevObjectParse.class)
                .setRefSpec(refSpec).call(RevFeature.class);
        if (revFeature.isPresent()) {
            RevFeatureType revFeatureType = repository.command(ResolveFeatureType.class)
                    .setRefSpec(refSpec).call().get();
            FeatureBuilder builder = new FeatureBuilder(revFeatureType);
            return builder.build(name, revFeature.get());
        } else {
            return null;
View Full Code Here

        RevTree tree = context.command(FindOrCreateSubtree.class).setChildPath(treePath)
                .setIndex(true).setParent(workHead).setParentPath(NodeRef.ROOT).call();

        ObjectId metadataId = ObjectId.NULL;
        if (type != null) {
            RevFeatureType revFeatureType = RevFeatureTypeImpl.build(type);
            if (tree.isEmpty()) {
                indexDatabase.put(revFeatureType);
            }
            metadataId = revFeatureType.getId();
        }
        Envelope bounds = SpatialOps.boundsOf(tree);
        Node node = Node.create(NodeRef.nodeFromPath(treePath), tree.getId(), metadataId,
                TYPE.TREE, bounds);
View Full Code Here

            bbox = (Envelope) bounds;
        } else {
            bbox = new Envelope(bounds.getMinimum(0), bounds.getMaximum(0), bounds.getMinimum(1),
                    bounds.getMaximum(1));
        }
        RevFeatureType revFeatureType = revFeatureTypes.get(type.getName());
        if (null == revFeatureType) {
            revFeatureType = RevFeatureTypeImpl.build(type);
            revFeatureTypes.put(type.getName(), revFeatureType);
        }
        ObjectId metadataId = revFeatureType.getId().equals(defaultMetadataId) ? ObjectId.NULL
                : revFeatureType.getId();
        Node node = Node.create(name, id, metadataId, TYPE.FEATURE, bbox);
        put(node);
        return node;
    }
View Full Code Here

            }

            private FeatureBuilder getBuilderFor(final ObjectId metadataId) {
                FeatureBuilder featureBuilder = ftCache.get(metadataId);
                if (featureBuilder == null) {
                    RevFeatureType revFtype = database.getFeatureType(metadataId);
                    featureBuilder = new FeatureBuilder(revFtype);
                    ftCache.put(metadataId, featureBuilder);
                }
                return featureBuilder;
            }
View Full Code Here

            final ObjectId forceMetadataId) {

        return Iterators.filter(plainFeatures, new Predicate<SimpleFeature>() {
            @Override
            public boolean apply(SimpleFeature input) {
                RevFeatureType type;
                type = (RevFeatureType) input.getUserData().get(RevFeatureType.class);
                ObjectId metadataId = type.getId();
                if (!forceMetadataId.equals(metadataId)) {
                    throw new GeoToolsOpException(StatusCode.MIXED_FEATURE_TYPES);
                }
                return true;
            }
View Full Code Here

            final ObjectId filterFeatureTypeId) {

        return Iterators.filter(plainFeatures, new Predicate<SimpleFeature>() {
            @Override
            public boolean apply(SimpleFeature input) {
                RevFeatureType type;
                type = (RevFeatureType) input.getUserData().get(RevFeatureType.class);
                ObjectId metadataId = type.getId();
                boolean applies = filterFeatureTypeId.equals(metadataId);
                return applies;
            }
        });
    }
View Full Code Here

    }

    private Iterator<SimpleFeature> alter(Iterator<SimpleFeature> plainFeatures,
            final ObjectId targetFeatureTypeId) {

        final RevFeatureType targetType = stagingDatabase().getFeatureType(targetFeatureTypeId);

        Function<SimpleFeature, SimpleFeature> alterFunction = new Function<SimpleFeature, SimpleFeature>() {
            @Override
            public SimpleFeature apply(SimpleFeature input) {
                final RevFeatureType oldFeatureType;
                oldFeatureType = (RevFeatureType) input.getUserData().get(RevFeatureType.class);

                final ObjectId metadataId = oldFeatureType.getId();
                if (targetType.getId().equals(metadataId)) {
                    return input;
                }

                final RevFeature oldFeature;
                oldFeature = (RevFeature) input.getUserData().get(RevFeature.class);

                ImmutableList<PropertyDescriptor> oldAttributes = oldFeatureType
                        .sortedDescriptors();
                ImmutableList<PropertyDescriptor> newAttributes = targetType.sortedDescriptors();

                ImmutableList<Optional<Object>> oldValues = oldFeature.getValues();
                List<Optional<Object>> newValues = Lists.newArrayList();
View Full Code Here

            if (trackingObject(object.getId())) {
                // We are already tracking this object, continue to do so
                return node;
            }

            RevFeatureType revFeatureType = (RevFeatureType) metadata;

            if (!repoFilter.filterObject(revFeatureType, node.getParentPath(), object)) {
                return null;
            }
View Full Code Here

                                    .setObjectId(input.getOldObject().getMetadataId()).call();
                            path = input.getOldObject().path();
                        }
                        if (feature.isPresent() && feature.get() instanceof RevFeature
                                && type.isPresent() && type.get() instanceof RevFeatureType) {
                            RevFeatureType featureType = (RevFeatureType) type.get();
                            Collection<PropertyDescriptor> attribs = featureType.type()
                                    .getDescriptors();

                            for (PropertyDescriptor attrib : attribs) {
                                PropertyType attrType = attrib.getType();
                                if (attrType instanceof GeometryType) {
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.RevFeatureType

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.