Examples of DCDate


Examples of org.dspace.content.DCDate

                    "SELECT * FROM item WHERE withdrawal_date IS NOT NULL");

            while (tri.hasNext())
            {
                TableRow row = tri.next();
                DCDate d = new DCDate(row.getStringColumn("withdrawal_date"));
                row.setColumn("last_modified", d.toDate());
                DatabaseManager.update(context, row);
            }
            tri.close();

            // Next, update those items with a date.available
            tri = DatabaseManager.query(context,
                        "SELECT item.item_id, dcvalue.text_value FROM item, dctyperegistry, "+
                        "dcvalue WHERE item.item_id=dcvalue.item_id AND dcvalue.dc_type_id="+
                        "dctyperegistry.dc_type_id AND dctyperegistry.element LIKE 'date' "+
                        "AND dctyperegistry.qualifier LIKE 'available'");

            while (tri.hasNext())
            {
                TableRow resultRow = tri.next();
                DCDate d = new DCDate(resultRow.getStringColumn("text_value"));

                // Can't update the row, have to do a separate query
                TableRow itemRow = DatabaseManager.find(context, "item",
                        resultRow.getIntColumn("item_id"));
                itemRow.setColumn("last_modified", d.toDate());
                DatabaseManager.update(context, itemRow);
            }
            tri.close();

            // Finally, for all items that have no date.available or withdrawal
View Full Code Here

Examples of org.dspace.content.DCDate

       
        // Get the start and end dates for yesterday
        Date thisTimeYesterday = new Date(System.currentTimeMillis()
                - (24 * 60 * 60 * 1000));

        DCDate dcDateYesterday = new DCDate(thisTimeYesterday);

        // this time yesterday in ISO 8601, stripping the time
        String isoDateYesterday = dcDateYesterday.toString().substring(0, 10);

        String startDate = isoDateYesterday;

        // FIXME: text of email should be more configurable from an
        // i18n viewpoint
View Full Code Here

Examples of org.dspace.content.DCDate

            Calendar calValue;
            if ((calValue = docinfo.getCreationDate()) == null)
                calValue = docinfo.getModificationDate();
            if (calValue != null)
                item.addDC("date", "created", null,
                             (new DCDate(calValue.getTime())).toString());
            item.update();
        }
        finally
        {
            if (cos != null)
View Full Code Here

Examples of org.dspace.content.DCDate

    {
        // Get non-internal format bitstreams
        Bitstream[] bitstreams = myitem.getNonInternalBitstreams();

        // get date
        DCDate now = DCDate.getCurrent();

        // Create provenance description
        String provmessage = "";

        if (myitem.getSubmitter() != null)
        {
            provmessage = "Submitted by " + myitem.getSubmitter().getFullName()
                    + " (" + myitem.getSubmitter().getEmail() + ") on "
                    + now.toString() + "\n";
        }
        else
        // null submitter
        {
            provmessage = "Submitted by unknown (probably automated) on"
                    + now.toString() + "\n";
        }

        // add sizes and checksums of bitstreams
        provmessage += InstallItem.getBitstreamProvenanceMessage(myitem);
View Full Code Here

Examples of org.dspace.content.DCDate

    public String getDatestamp(Object nativeItem)
    {
        Date d = ((HarvestedItemInfo) nativeItem).datestamp;

        // Return as ISO8601
        return new DCDate(d).toString();
    }
View Full Code Here

Examples of org.dspace.content.DCDate

    //item.setHarvestDate(new Date());
    hi.setHarvestDate(new Date());

                 // Add provenance that this item was harvested via OAI
                String provenanceMsg = "Item created via OAI harvest from source: "
                                        + this.harvestRow.getOaiSource() + " on " new DCDate(hi.getHarvestDate())
                                        + " (GMT).  Item's OAI Record identifier: " + hi.getOaiID();
                item.addMetadata("dc", "description", "provenance", "en", provenanceMsg);
       
    item.update();
    hi.update();
View Full Code Here

Examples of org.dspace.content.DCDate

            
                // "published" date -- should be dc.date.issued
                String pubDate = getOneDC(item, dateField);
                if (pubDate != null)
                {
                    entry.setPublishedDate((new DCDate(pubDate)).toDate());
                    hasDate = true;
                }
                // date of last change to Item
                entry.setUpdatedDate(item.getLastModified());
            
                StringBuffer db = new StringBuffer();
                for (String df : descriptionFields)
                {
                    // 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)
View Full Code Here

Examples of org.dspace.content.DCDate

      if (terms != null && terms.length() > 0)
      {
        if (termsOpen.equals(terms))
                return EmbargoManager.FOREVER;
            else
                return new DCDate(terms);
      }
        return null;
    }
View Full Code Here

Examples of org.dspace.content.DCDate

      if (terms != null && terms.length() > 0)
      {
          if (termsOpen.equals(terms))
                return EmbargoManager.FOREVER;
            else
                return new DCDate(terms);
      }
        return null;
    }
View Full Code Here

Examples of org.dspace.content.DCDate

    public static DCDate getEmbargoDate(Context context, Item item)
        throws SQLException, AuthorizeException, IOException
    {
        init();
        DCValue terms[] = item.getMetadata(terms_schema, terms_element, terms_qualifier, Item.ANY);
        DCDate result = setter.parseTerms(context, item, terms.length > 0 ? terms[0].value : null);

        // sanity check: do not allow an embargo lift date in the past.
        if (result != null && result.toDate().before(new Date()))
        {
            throw new IllegalArgumentException("Embargo lift date must be in the future, but this is in the past: "+result.toString());
        }
        return result;
    }
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.