Sigh ... Implemnting embargo on the Manakin side of DSpace 1.5 is 
proving to be the bane of my life. I appreciate the suggestions I've 
received, but most of them require waiting, and that isn't an option.

Anyway, I've been trying to implement a variant of Embargo v2 
(http://wiki.dspace.org/index.php/Embargo_on_Bitstream_v2_%28JSP%29), 
and making some progress. It comes down to a modification to 
dspace-api/src/main/java/org/dspace/content/InstallItem.java , where I 
add the following code to installItem:

  DCValue[] dateAvailable = item.getDC("date", "available", Item.ANY);
  if (dateAvailable.length > 0)
       {
           DCValue dcDate = dateAvailable[0];
           String dateStr = dcDate.value;
           // Convert yyyy-mm-dd to Date object
           int hyph1 = dateStr.indexOf ('-');
           int hyph2 = dateStr.indexOf ('-', hyph1 + 1);
           if (hyph1 > 0 && hyph2 > hyph1) {
               int year = 2000, month = 1, day = 1;
               try {
                 year = Integer.parseInt
                   (dateStr.substring (0, hyph1 ));
                 month = Integer.parseInt
                   (dateStr.substring (hyph1 + 1, hyph2 ));
                 day = Integer.parseInt
                   (dateStr.substring (hyph2 + 1));
               }
               catch (Exception e) {}
               Calendar cal = Calendar.getInstance ();
               cal.set (year, month, day);
               //item.addDC("date", "available", null, now.toString());
               TableRow row = DatabaseManager.create (c, "umrestricted");
               row.setColumn ("item_id", item.getID());
               row.setColumn ("release_date", cal.getTime());
               int n = DatabaseManager.update(c, row);
           }
       }

What I'm finding is that the row is created, but the item_id and 
release_date fields are null. I can add rows with non-null values using 
a desktop database client. I've put debugging code into 
TableRow.setColumn(String, Date), so I know that it's being reached, has 
correct data, and appears to complete correctly. I've stripped out the 
debugging code for readability, but it shows that DatabaseManager.update 
() is returning 0; i.e., it thinks that the row hasn't been modified in 
spite of my setColumn calls.

Obviously I'm doing something wrong, but can't figure out what. Any 
suggestions on what I might try?


-- 
Gary McGath
Digital Library Software Engineer
Harvard University Libraries, Office for Information Systems

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to