Examples of DCValue


Examples of org.dspace.content.DCValue

                for (String qual : qualifiers)
                {
                    List<String[]> vals = getCrisMetadata(item, enh, qual);
                    for (String[] e : vals)
                    {
                        DCValue dc = new DCValue();
                        dc.schema = "crisitem";
                        dc.element = enh.getAlias();
                        dc.qualifier = qual;
                        dc.value = e[0];
                        dc.authority = e[1];
                        dc.confidence = StringUtils.isNotEmpty(e[1])?Choices.CF_ACCEPTED:Choices.CF_UNSET;
                        result.add(dc);
                    }
                }
            }

        }
        else if ("".equals(qualifier))
        {
            if (qualifier == null)
            {
                log.error("Wrong configuration asked for unqualified crisitem."
                        + element
                        + " metadata. All crisitem metadata MUST BE qualified");
            }
            return null;
        }
        else
        {
            for (CrisItemEnhancer enh : enhancers)
            {
                List<String[]> vals = getCrisMetadata(item, enh, qualifier);
                for (String[] e : vals)
                {
                    DCValue dc = new DCValue();
                    dc.schema = "crisitem";
                    dc.element = enh.getAlias();
                    dc.qualifier = qualifier;
                    dc.value = e[0];
                    dc.authority = e[1];
View Full Code Here

Examples of org.dspace.content.DCValue

            }
        }
        DCValue[] result = new DCValue[values.size()];
        for (int idx = 0; idx < values.size(); idx++)
        {
            result[idx] = new DCValue();
            result[idx].schema = schema;
            result[idx].element = element;
            result[idx].qualifier = qualifier;
            result[idx].authority = authority;
            result[idx].confidence = StringUtils.isNotEmpty(authority) ? Choices.CF_ACCEPTED
View Full Code Here

Examples of org.dspace.content.DCValue

     * @param item - item to test.
     */
    public static void checkMetadata(Item item)
        throws PackageValidationException
    {
        DCValue t[] = item.getDC( "title", null, Item.ANY);
        if (t == null || t.length == 0)
            throw new PackageValidationException("Item cannot be created without the required \"title\" DC metadata.");
    }
View Full Code Here

Examples of org.dspace.content.DCValue

                Integer key = new Integer(so.getNumber());
                String metadata = so.getMetadata();

                // If we've already used the metadata for this Item
                // it will be cached in the map
                DCValue value = null;

                if (itemMDMap != null)
                    value = (DCValue) itemMDMap.get(metadata);

                // We haven't used this metadata before, so grab it from the item
View Full Code Here

Examples of org.dspace.content.DCValue

            metas.add(e);
        }

        for (int i = 0; i < values.length; i++)
        {
            DCValue v = values[i];

            // Work out the key for the Maps that will tell us which metadata
            // name + scheme to use
            String key = v.schema + "." + v.element
                    + (v.qualifier != null ? "." + v.qualifier : "");
View Full Code Here

Examples of org.dspace.content.DCValue

            }

            while (tri.hasNext())
            {
                TableRow tr = tri.next();
                DCValue dcv = new DCValue();
                dcv.schema = schema;
                dcv.element = tr.getStringColumn("element");
                dcv.qualifier = tr.getStringColumn("qualifier");
                dcv.language = tr.getStringColumn("text_lang");
                dcv.value = tr.getStringColumn("text_value");
View Full Code Here

Examples of org.dspace.content.DCValue

                //Arrays.asList(mydc)
                log.debug("Metadata fields size: " + mydc.length);
                for (int i = 0; i < merge.length; i++) {
                    log.debug("Searching repeated fields for " + merge[i]);
                    for (int m = 0; m < mydc.length; m++) {
                        DCValue meta = mydc[m];
                        String field = meta.schema + "." + meta.element;
                        if (meta.qualifier != null && !meta.qualifier.trim().equals("")) {
                            field += "." + meta.qualifier;
                        }
                        if (merge[i].equals(field)) {
                            log.debug("Found field for merge: " + field);
                            for (int m2 = m + 1; m2 < mydc.length; m2++) {
                                DCValue meta2 = mydc[m2];
                                String field2 = meta2.schema + "." + meta2.element;
                                if (meta2.qualifier != null && !meta2.qualifier.trim().equals("")) {
                                    field2 += "." + meta2.qualifier;
                                }
                                if (merge[i].equals(field2)) {
View Full Code Here

Examples of org.dspace.content.DCValue

            }

            while (tri.hasNext())
            {
                TableRow tr = tri.next();
                DCValue dcv = new DCValue();
                dcv.schema = schema;
                dcv.element = tr.getStringColumn("element");
                dcv.qualifier = tr.getStringColumn("qualifier");
                dcv.language = tr.getStringColumn("text_lang");
                dcv.value = tr.getStringColumn("text_value");
View Full Code Here

Examples of org.dspace.content.DCValue

                    // Special Case: "(date)" in field name means render as date
                    boolean isDate = df.indexOf("(date)") > 0;
                    if (isDate)
                        df = df.replaceAll("\\(date\\)", "");
            
                    DCValue dcv[] = item.getMetadata(df);
                    if (dcv.length > 0)
                    {
                        String fieldLabel = labels.get(MSG_METADATA + df);
                        if (fieldLabel != null && fieldLabel.length()>0)
                            db.append(fieldLabel + ": ");
                        boolean first = true;
                        for (DCValue v : dcv)
                        {
                            if (first)
                                first = false;
                            else
                                db.append("; ");
                            db.append(isDate ? new DCDate(v.value).toString() : v.value);
                        }
                        db.append("\n");
                    }
                }
                if (db.length() > 0)
                {
                    SyndContent desc = new SyndContentImpl();
                    desc.setType("text/plain");
                    desc.setValue(db.toString());
                    entry.setDescription(desc);
                }

                // This gets the authors into an ATOM feed
                DCValue authors[] = item.getMetadata(authorField);
                if (authors.length > 0)
                {
                    List<SyndPerson> creators = new ArrayList<SyndPerson>();
                    for (DCValue author : authors)
                    {
                        SyndPerson sp = new SyndPersonImpl();
                        sp.setName(author.value);
                        creators.add(sp);
                    }
                    entry.setAuthors(creators);
                }

                // 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)
                            {
View Full Code Here

Examples of org.dspace.content.DCValue

    }

    // spoonful of syntactic sugar when we only need first value
    private String getOneDC(Item item, String field)
    {
        DCValue dcv[] = item.getMetadata(field);
        return (dcv.length > 0) ? dcv[0].value : null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.