Package org.locationtech.udig.document.source

Examples of org.locationtech.udig.document.source.BasicHotlinkSource


        // assertTrue(adaptorFactory.canAdapt(resource, IHotlinkSource.class));
        //
        // IHotlinkSource hotlink = (IHotlinkSource) adaptorFactory.adapt(resource,
        // IHotlinkSource.class, new NullProgressMonitor());

        final BasicHotlinkSource hotlink = new BasicHotlinkSource(resource);
        assertNotNull(hotlink);

        List<HotlinkDescriptor> list = hotlink.getHotlinkDescriptors(null, new NullProgressMonitor());
        assertEquals("descriptors found", 2, list.size());

        SimpleFeatureStore featureStore = resource.resolve(SimpleFeatureStore.class,
                new NullProgressMonitor());
        SimpleFeatureType schema = featureStore.getSchema();
        for (HotlinkDescriptor hotlinkDescriptor : list) {
            AttributeDescriptor attributeDescriptor = schema.getDescriptor(hotlinkDescriptor
                    .getAttributeName());
            assertNotNull("confirm attribute name matches", attributeDescriptor);
            assertTrue("Confirm String",
                    String.class.isAssignableFrom(attributeDescriptor.getType().getBinding()));

            assertNotNull(hotlinkDescriptor.getType() != null);
        }
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
        SimpleFeatureCollection features = featureStore.getFeatures(ff.equals(ff.property("STATE"),
                ff.literal("Tasmania")));
        SimpleFeatureIterator iterator = features.features();
        assertTrue("Tasmania found", iterator.hasNext());
        SimpleFeature tasmania = iterator.next();

        List<IDocument> documents = hotlink.getDocuments(tasmania, new NullProgressMonitor());
        assertEquals("image document found", 2, documents.size());

        // IDocument imageDocument = documents.get(0);
        // assertEquals(ContentType.FILE, imageDocument.getContentType());
View Full Code Here

TOP

Related Classes of org.locationtech.udig.document.source.BasicHotlinkSource

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.