Package org.locationtech.udig.catalog.document

Examples of org.locationtech.udig.catalog.document.IDocument


        return docs;
    }
       
    @Override
    public IDocument add(DocumentInfo info, IProgressMonitor monitor) {
        final IDocument doc = addInternal(info, monitor);
        save(monitor);
        return doc;
    }
View Full Code Here


            final File newFile = ShpDocUtils.copyFile(info.getInfo(), propParser.getShapefileAttachDir());
            info.setInfo(newFile.getAbsolutePath());
        } else if (Type.LINKED == info.getType()) {
            // Do special handling here for linked documents, if needed
        }
        final IDocument newDoc = docFactory.create(info);
        getDocsInternal(monitor).add(newDoc);
        return newDoc;
    }
View Full Code Here

            for (String attributeName : attributeDescriptorMap.keySet()) {
                final List<HotlinkDescriptor> attributeDescriptors = attributeDescriptorMap
                        .get(attributeName);
                final String info = (String) feature.getAttribute(attributeName);
                final String decodedInfo = decodeInfo(attributeDescriptors.get(0).getType(), info);
                final IDocument doc = create(decodedInfo, attributeDescriptors);
                setFeature(doc, feature);
                docs.add(doc);
            }
        }
        return docs;
View Full Code Here

        return docs;
    }
   
    @Override
    public IDocument add(SimpleFeature feature, DocumentInfo info, IProgressMonitor monitor) {
        final IDocument doc = addInternal(feature, info, monitor);
        save(feature, monitor);
        return doc;
    }
View Full Code Here

            final File newFile = ShpDocUtils.copyFile(info.getInfo(), getAttachmentDir(feature));
            info.setInfo(newFile.getAbsolutePath());
        } else if (Type.LINKED == info.getType()) {
            // Do special handling here for linked documents, if needed
        }
        final IDocument newDoc = docFactory.create(info);
        setFeature(newDoc, feature);
        getDocsInternal(feature, monitor).add(newDoc);
        return newDoc;
    }
View Full Code Here

    public void testCreateDocument() {
       
        final ShpDocFactory factory = new ShpDocFactory(null);
       
        DocumentInfo info = new DocumentInfo(LABEL, DESCRIPTION, INFO, ContentType.FILE, false, Type.LINKED);
        IDocument doc = factory.create(info);
        assertNotNull("Doc is null.", doc);
        assertTrue("Doc's type is not expected.", doc instanceof FileLinkedDocument);
       
        info = new DocumentInfo(LABEL, DESCRIPTION, INFO, ContentType.FILE, false, Type.ATTACHMENT);
        doc = factory.create(info);
View Full Code Here

    public void testCreateHotlink() {

        final ShpDocFactory factory = new ShpDocFactory(null);
       
        HotlinkDescriptor descriptor = new HotlinkDescriptor(LABEL, DESCRIPTION, ATTRIBUTE_NAME, ContentType.FILE, CONFIG);
        IDocument doc = factory.create(INFO, Collections.singletonList(descriptor));
        assertNotNull("Doc is null.", doc);
        assertTrue("Doc's type is not expected.", doc instanceof FileHotlinkDocument);
       
        descriptor = new HotlinkDescriptor(LABEL, DESCRIPTION, ATTRIBUTE_NAME, ContentType.WEB, CONFIG);
        doc = factory.create(INFO, Collections.singletonList(descriptor));
View Full Code Here

    public void testUpdate() {
       
        List<IDocument> docs = attachSource.getDocuments(feature, monitor);
        assertEquals("Count is not expected.", 0, docs.size());
       
        IDocument doc = attachSource.add(feature, fileDocInfo1, monitor);
        assertNotNull("Doc does not exists.", doc);
        assertTrue("File was not added.", fileExistsInLocalDir(file1));
       
        attachSource.update(feature, doc, fileDocInfo2, monitor);
       
View Full Code Here

        List<IDocument> docs = source.getDocuments(monitor);
        assertEquals("Count is not expected.", 0, docs.size());
       
        source.add(fileDocInfo1, monitor);
       
        IDocument doc = getDoc(docs, fileDocInfo1);
        assertNotNull("Doc does not exists.", doc);
       
        source.update(doc, fileDocInfo2, monitor);
        doc = getDoc(docs, fileDocInfo1);
        assertNull("Doc exists.", doc);
View Full Code Here

    public void testGetDocuments() {

        final List<IDocument> docs = source.getDocuments(feature, monitor);
        assertEquals("Count is not expected.", 3, docs.size());

        IDocument doc = source.getDocument(feature, FILE_ATTR, monitor);
        assertNotNull("Doc is null.", doc);
        assertTrue("Doc is not an instance of HotlinkFileDoc.",
                (doc instanceof FileHotlinkDocument));

        doc = source.getDocument(feature, LINK_ATTR, monitor);
View Full Code Here

TOP

Related Classes of org.locationtech.udig.catalog.document.IDocument

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.