Package com.sun.syndication.feed.module

Examples of com.sun.syndication.feed.module.DCModuleImpl


                // only add DC module if any DC fields are configured
                if (dcCreatorField != null || dcDateField != null ||
                    dcDescriptionField != null)
                {
                    DCModule dc = new DCModuleImpl();
                    if (dcCreatorField != null)
                    {
                        DCValue dcAuthors[] = item.getMetadata(dcCreatorField);
                        if (dcAuthors.length > 0)
                        {
                            List<String> creators = new ArrayList<String>();
                            for (DCValue author : dcAuthors)
                                creators.add(author.value);
                            dc.setCreators(creators);
                        }
                    }
                    if (dcDateField != null && !hasDate)
                    {
                        DCValue v[] = item.getMetadata(dcDateField);
                        if (v.length > 0)
                            dc.setDate((new DCDate(v[0].value)).toDate());
                    }
                    if (dcDescriptionField != null)
                    {
                        DCValue v[] = item.getMetadata(dcDescriptionField);
                        if (v.length > 0)
                        {
                            StringBuffer descs = new StringBuffer();
                            for (DCValue d : v)
                            {
                                if (descs.length() > 0)
                                    descs.append("\n\n");
                                descs.append(d.value);
                            }
                            dc.setDescription(descs.toString());
                        }
                    }
                    entry.getModules().add(dc);
                }
            }
View Full Code Here


     * @param dcRoot the root element containing the module elements.
     * @return the module parsed from the element tree, <i>null</i> if none.
     */
    public Module parse(Element dcRoot) {
        boolean foundSomething = false;
        DCModule dcm = new DCModuleImpl();

        List eList = dcRoot.getChildren("title", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setTitles(parseElementList(eList));
        }
        eList = dcRoot.getChildren("creator", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setCreators(parseElementList(eList));
        }
        eList = dcRoot.getChildren("subject", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setSubjects(parseSubjects(eList));
        }
        eList = dcRoot.getChildren("description", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setDescriptions(parseElementList(eList));
        }
        eList = dcRoot.getChildren("publisher", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setPublishers(parseElementList(eList));
        }
        eList = dcRoot.getChildren("contributor", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setContributors(parseElementList(eList));
        }
        eList = dcRoot.getChildren("date", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setDates(parseElementListDate(eList));
        }
        eList = dcRoot.getChildren("type", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setTypes(parseElementList(eList));
        }
        eList = dcRoot.getChildren("format", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setFormats(parseElementList(eList));
        }
        eList = dcRoot.getChildren("identifier", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setIdentifiers(parseElementList(eList));
        }
        eList = dcRoot.getChildren("source", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setSources(parseElementList(eList));
        }
        eList = dcRoot.getChildren("language", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setLanguages(parseElementList(eList));
        }
        eList = dcRoot.getChildren("relation", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setRelations(parseElementList(eList));
        }
        eList = dcRoot.getChildren("coverage", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setCoverages(parseElementList(eList));
        }
        eList = dcRoot.getChildren("rights", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setRightsList(parseElementList(eList));
        }

        return (foundSomething) ? dcm : null;
    }
View Full Code Here

     * @param dcRoot the root element containing the module elements.
     * @return the module parsed from the element tree, <i>null</i> if none.
     */
    public Module parse(Element dcRoot) {
        boolean foundSomething = false;
        DCModule dcm = new DCModuleImpl();

        List eList = dcRoot.getChildren("title", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setTitles(parseElementList(eList));
        }
        eList = dcRoot.getChildren("creator", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setCreators(parseElementList(eList));
        }
        eList = dcRoot.getChildren("subject", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setSubjects(parseSubjects(eList));
        }
        eList = dcRoot.getChildren("description", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setDescriptions(parseElementList(eList));
        }
        eList = dcRoot.getChildren("publisher", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setPublishers(parseElementList(eList));
        }
        eList = dcRoot.getChildren("contributor", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setContributors(parseElementList(eList));
        }
        eList = dcRoot.getChildren("date", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setDates(parseElementListDate(eList));
        }
        eList = dcRoot.getChildren("type", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setTypes(parseElementList(eList));
        }
        eList = dcRoot.getChildren("format", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setFormats(parseElementList(eList));
        }
        eList = dcRoot.getChildren("identifier", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setIdentifiers(parseElementList(eList));
        }
        eList = dcRoot.getChildren("source", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setSources(parseElementList(eList));
        }
        eList = dcRoot.getChildren("language", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setLanguages(parseElementList(eList));
        }
        eList = dcRoot.getChildren("relation", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setRelations(parseElementList(eList));
        }
        eList = dcRoot.getChildren("coverage", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setCoverages(parseElementList(eList));
        }
        eList = dcRoot.getChildren("rights", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setRightsList(parseElementList(eList));
        }

        return (foundSomething) ? dcm : null;
    }
View Full Code Here

                // only add DC module if any DC fields are configured
                if (dcCreatorField != null || dcDateField != null ||
                    dcDescriptionField != null)
                {
                    DCModule dc = new DCModuleImpl();
                    if (dcCreatorField != null)
                    {
                        Metadatum dcAuthors[] = item.getMetadataByMetadataString(dcCreatorField);
                        if (dcAuthors.length > 0)
                        {
                            List<String> creators = new ArrayList<String>();
                            for (Metadatum author : dcAuthors)
                            {
                                creators.add(author.value);
                            }
                            dc.setCreators(creators);
                        }
                    }
                    if (dcDateField != null && !hasDate)
                    {
                        Metadatum v[] = item.getMetadataByMetadataString(dcDateField);
                        if (v.length > 0)
                        {
                            dc.setDate((new DCDate(v[0].value)).toDate());
                        }
                    }
                    if (dcDescriptionField != null)
                    {
                        Metadatum v[] = item.getMetadataByMetadataString(dcDescriptionField);
                        if (v.length > 0)
                        {
                            StringBuffer descs = new StringBuffer();
                            for (Metadatum d : v)
                            {
                                if (descs.length() > 0)
                                {
                                    descs.append("\n\n");
                                }
                                descs.append(d.value);
                            }
                            dc.setDescription(descs.toString());
                        }
                    }
                    entry.getModules().add(dc);
                }
View Full Code Here

     * @param dcRoot the root element containing the module elements.
     * @return the module parsed from the element tree, <i>null</i> if none.
     */
    public Module parse(Element dcRoot) {
        boolean foundSomething = false;
        DCModule dcm = new DCModuleImpl();

        List eList = dcRoot.getChildren("title", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setTitles(parseElementList(eList));
        }
        eList = dcRoot.getChildren("creator", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setCreators(parseElementList(eList));
        }
        eList = dcRoot.getChildren("subject", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setSubjects(parseSubjects(eList));
        }
        eList = dcRoot.getChildren("description", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setDescriptions(parseElementList(eList));
        }
        eList = dcRoot.getChildren("publisher", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setPublishers(parseElementList(eList));
        }
        eList = dcRoot.getChildren("contributor", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setContributors(parseElementList(eList));
        }
        eList = dcRoot.getChildren("date", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setDates(parseElementListDate(eList));
        }
        eList = dcRoot.getChildren("type", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setTypes(parseElementList(eList));
        }
        eList = dcRoot.getChildren("format", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setFormats(parseElementList(eList));
        }
        eList = dcRoot.getChildren("identifier", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setIdentifiers(parseElementList(eList));
        }
        eList = dcRoot.getChildren("source", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setSources(parseElementList(eList));
        }
        eList = dcRoot.getChildren("language", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setLanguages(parseElementList(eList));
        }
        eList = dcRoot.getChildren("relation", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setRelations(parseElementList(eList));
        }
        eList = dcRoot.getChildren("coverage", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setCoverages(parseElementList(eList));
        }
        eList = dcRoot.getChildren("rights", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setRightsList(parseElementList(eList));
        }

        return (foundSomething) ? dcm : null;
    }
View Full Code Here

     * @param dcRoot the root element containing the module elements.
     * @return the module parsed from the element tree, <i>null</i> if none.
     */
    public Module parse(Element dcRoot) {
        boolean foundSomething = false;
        DCModule dcm = new DCModuleImpl();

        List eList = dcRoot.getChildren("title", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setTitles(parseElementList(eList));
        }
        eList = dcRoot.getChildren("creator", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setCreators(parseElementList(eList));
        }
        eList = dcRoot.getChildren("subject", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setSubjects(parseSubjects(eList));
        }
        eList = dcRoot.getChildren("description", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setDescriptions(parseElementList(eList));
        }
        eList = dcRoot.getChildren("publisher", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setPublishers(parseElementList(eList));
        }
        eList = dcRoot.getChildren("contributor", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setContributors(parseElementList(eList));
        }
        eList = dcRoot.getChildren("date", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setDates(parseElementListDate(eList));
        }
        eList = dcRoot.getChildren("type", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setTypes(parseElementList(eList));
        }
        eList = dcRoot.getChildren("format", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setFormats(parseElementList(eList));
        }
        eList = dcRoot.getChildren("identifier", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setIdentifiers(parseElementList(eList));
        }
        eList = dcRoot.getChildren("source", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setSources(parseElementList(eList));
        }
        eList = dcRoot.getChildren("language", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setLanguages(parseElementList(eList));
        }
        eList = dcRoot.getChildren("relation", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setRelations(parseElementList(eList));
        }
        eList = dcRoot.getChildren("coverage", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setCoverages(parseElementList(eList));
        }
        eList = dcRoot.getChildren("rights", getDCNamespace());
        if (eList.size() > 0) {
            foundSomething = true;
            dcm.setRightsList(parseElementList(eList));
        }

        return (foundSomething) ? dcm : null;
    }
View Full Code Here

        return Namespace.getNamespace(DCModule.URI);
    }

    public Module parse(Element dcRoot) {
        boolean foundSomething = false;
        DCModule dcm = new DCModuleImpl();

        Element e = dcRoot.getChild("title",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            dcm.setTitle(e.getText());
        }
        e = dcRoot.getChild("creator",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            dcm.setCreator(e.getText());
        }
        List eList = dcRoot.getChildren("subject",getDCNamespace());
        if (eList.size()>0) {
            foundSomething = true;
            dcm.setSubjects(parseSubjects(eList));
        }
        e = dcRoot.getChild("description",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            dcm.setDescription(e.getText());
        }
        e = dcRoot.getChild("publisher",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            dcm.setPublisher(e.getText());
        }
        eList = dcRoot.getChildren("contributor",getDCNamespace());
        if (eList.size()>0) {
            foundSomething = true;
            dcm.setContributors(parseContributors(eList));
        }
        e = dcRoot.getChild("date",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            dcm.setDate(DateParser.parseW3CDateTime(e.getText()));
        }
        e = dcRoot.getChild("type",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            dcm.setType(e.getText());
        }
        e = dcRoot.getChild("format",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            dcm.setFormat(e.getText());
        }
        e = dcRoot.getChild("identifier",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            dcm.setIdentifier(e.getText());
        }
        e = dcRoot.getChild("source",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            dcm.setSource(e.getText());
        }
        e = dcRoot.getChild("language",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            dcm.setLanguage(e.getText());
        }
        e = dcRoot.getChild("relation",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            dcm.setRelation(e.getText());
        }
        e = dcRoot.getChild("coverage",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            dcm.setCoverage(e.getText());
        }
        e = dcRoot.getChild("rights",getDCNamespace());
        if (e!=null) {
            foundSomething = true;
            dcm.setRights(e.getText());
        }

        return (foundSomething) ? dcm : null;
    }
View Full Code Here

TOP

Related Classes of com.sun.syndication.feed.module.DCModuleImpl

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.