Package org.locationtech.udig.catalog.document.IDocumentSource

Examples of org.locationtech.udig.catalog.document.IDocumentSource.DocumentInfo


        if (docDialog != null) {
            final Job editDocJob = new Job(Messages.DocumentView_updateDocProgressMsg){
                @Override
                protected IStatus run(IProgressMonitor monitor) {
                    boolean isUpdated = false;
                    final DocumentInfo info = docDialog.getDocInfo();
                    if (source instanceof IDocumentSource) {
                        final IDocumentSource resourceDocSource = (IDocumentSource) source;
                        isUpdated = resourceDocSource.update(doc, info, monitor);
                    } else if (source instanceof IAttachmentSource) {
                        final IAttachmentSource featureDocSource = (IAttachmentSource) source;
View Full Code Here


     * after the dialog's Ok button has been clicked.
     *
     * @return document info
     */
    public DocumentInfo getDocInfo() {
        return (new DocumentInfo(getLabel(), getDescription(), getInfo(), getType(), isTemplate(),
                getParamType()));
    }
View Full Code Here

    private List<DocumentInfo> toDocInfoList(String spec) {
        if (spec != null && !spec.isEmpty()) {
            final List<DocumentInfo> docInfos = new ArrayList<DocumentInfo>();
            final String[] docInfoArray = spec.split(DELIMITER_REGEX);
            for (String docInfo : docInfoArray) {
                final DocumentInfo info = new DocumentInfo(docInfo);
                if (ContentType.FILE == info.getContentType()) {
                    info.setInfo(ShpDocUtils.getAbsolutePath(url, info.getInfo()));   
                }
                docInfos.add(info);
            }
            return docInfos;
        }
View Full Code Here

        int count = 0;
        final StringBuilder sb = new StringBuilder();
        for (DocumentInfo info : docInfos) {
            count++;
            if (ContentType.FILE == info.getContentType()) {
                final DocumentInfo writeInfo = new DocumentInfo(info.toString());
                writeInfo.setInfo(ShpDocUtils.getRelativePath(url, writeInfo.getInfo()));
                sb.append(writeInfo.toString());
            } else {
                sb.append(info.toString());
            }
            if (count < docInfos.size()) {
                sb.append(DELIMITER);
View Full Code Here

    @Test
    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);
        assertNotNull("Doc is null.", doc);
        assertTrue("Doc's type is not expected.", doc instanceof FileAttachmentDocument);
       
        info = new DocumentInfo(LABEL, DESCRIPTION, INFO, ContentType.WEB, false, Type.LINKED);
        doc = factory.create(info);
        assertNotNull("Doc is null.", doc);
        assertTrue("Doc's type is not expected.", doc instanceof WebLinkedDocument);
       
    }
View Full Code Here

    @Test
    public void testFromString() {

        String infoString = String.format(FORMAT, INFO, TYPE.toString(), CONTENT_TYPE.toString(),
                LABEL, DESCRIPTION, Boolean.toString(IS_TEMPLATE));
        DocumentInfo info = new DocumentInfo(infoString);
        assertEquals("Info is not expected.", INFO, info.getInfo());
        assertEquals("Type is not expected.", TYPE, info.getType());
        assertEquals("Content type is not expected.", CONTENT_TYPE, info.getContentType());
        assertEquals("Label is not expected.", LABEL, info.getLabel());
        assertEquals("Description is not expected.", DESCRIPTION, info.getDescription());
        assertEquals("Is template flag is not expected.", IS_TEMPLATE, info.isTemplate());

        infoString = String.format(FORMAT, INFO, TYPE.toString(), CONTENT_TYPE.toString(), "",
                DESCRIPTION, Boolean.toString(IS_TEMPLATE));
        info = new DocumentInfo(infoString);
        assertEquals("Info is not expected.", INFO, info.getInfo());
        assertEquals("Type is not expected.", TYPE, info.getType());
        assertEquals("Content type is not expected.", CONTENT_TYPE, info.getContentType());
        assertEquals("Label is not expected.", null, info.getLabel());
        assertEquals("Description is not expected.", DESCRIPTION, info.getDescription());
        assertEquals("Is template flag is not expected.", IS_TEMPLATE, info.isTemplate());

        infoString = String.format(FORMAT, INFO, TYPE.toString(), CONTENT_TYPE.toString(), "", "",
                Boolean.toString(IS_TEMPLATE));
        info = new DocumentInfo(infoString);
        assertEquals("Info is not expected.", INFO, info.getInfo());
        assertEquals("Type is not expected.", TYPE, info.getType());
        assertEquals("Content type is not expected.", CONTENT_TYPE, info.getContentType());
        assertEquals("Label is not expected.", null, info.getLabel());
        assertEquals("Description is not expected.", null, info.getDescription());
        assertEquals("Is template flag is not expected.", IS_TEMPLATE, info.isTemplate());
       
    }
View Full Code Here

    @Test
    public void testToString() {
       
        String infoString = String.format(FORMAT, INFO, TYPE.toString(), CONTENT_TYPE.toString(),
                LABEL, DESCRIPTION, Boolean.toString(IS_TEMPLATE));
        DocumentInfo hotlinkDesc = new DocumentInfo(LABEL, DESCRIPTION, INFO, CONTENT_TYPE,
                IS_TEMPLATE, TYPE);
        assertEquals("Description string is not expected.", infoString, hotlinkDesc.toString());

        infoString = String.format(FORMAT, INFO, TYPE.toString(), CONTENT_TYPE.toString(), "",
                DESCRIPTION, Boolean.toString(IS_TEMPLATE));
        hotlinkDesc = new DocumentInfo(null, DESCRIPTION, INFO, CONTENT_TYPE, IS_TEMPLATE, TYPE);
        assertEquals("Description string is not expected.", infoString, hotlinkDesc.toString());

        hotlinkDesc = new DocumentInfo("", DESCRIPTION, INFO, CONTENT_TYPE, IS_TEMPLATE, TYPE);
        assertEquals("Description string is not expected.", infoString, hotlinkDesc.toString());

        infoString = String.format(FORMAT, INFO, TYPE.toString(), CONTENT_TYPE.toString(), "", "",
                Boolean.toString(IS_TEMPLATE));
        hotlinkDesc = new DocumentInfo(null, null, INFO, CONTENT_TYPE, IS_TEMPLATE, TYPE);
        assertEquals("Description string is not expected.", infoString, hotlinkDesc.toString());

        hotlinkDesc = new DocumentInfo("", "", INFO, CONTENT_TYPE, IS_TEMPLATE, TYPE);
        assertEquals("Description string is not expected.", infoString, hotlinkDesc.toString());
       
    }
View Full Code Here

       
        file = new File(directory, SHAPEFILE);
        url = file.toURI().toURL();

        file1 = new File(directory, FILE1);
        fileDocInfo1 = new DocumentInfo("fileDoc1", "fileDocDesc1", file1.getAbsolutePath(), ContentType.FILE, false, Type.ATTACHMENT);
        file2 = new File(directory, FILE2);
        fileDocInfo2 = new DocumentInfo("fileDoc2", "fileDocDesc2", file2.getAbsolutePath(), ContentType.FILE, true, Type.ATTACHMENT);
       
        webDocInfo1 = new DocumentInfo("webDoc1", "webDocDesc1", WEB1, ContentType.WEB, false, Type.LINKED);
        webDocInfo2 = new DocumentInfo("webDoc2", "webDocDesc2", WEB2, ContentType.WEB, false, Type.LINKED);
       
        descriptor1 = new HotlinkDescriptor("fileLabel", "description", FILE_ATTR, ContentType.FILE, "config");
        descriptor2 = new HotlinkDescriptor("webLabel", "description", LINK_ATTR, ContentType.WEB, "config");
        descriptor3 = new HotlinkDescriptor("actionLabel", "description", STATE_ATTR, ContentType.ACTION, "config");
       
View Full Code Here

TOP

Related Classes of org.locationtech.udig.catalog.document.IDocumentSource.DocumentInfo

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.