From c46b3d9d3b781226c8cf47adcd35e271fdfcaeb0 Mon Sep 17 00:00:00 2001 From: Graham Triggs Date: Tue, 6 Nov 2007 12:43:56 +0000 Subject: [PATCH] Fixed generation of the Creative Commons RDF, including the parsing change for the cc namespace. git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@2312 9c30dcfa-912a-0410-8fc2-9e0234be79fd --- .../org/dspace/license/CreativeCommons.java | 55 ++++++++++++++----- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/dspace-api/src/main/java/org/dspace/license/CreativeCommons.java b/dspace-api/src/main/java/org/dspace/license/CreativeCommons.java index de651ade21..7a60671826 100644 --- a/dspace-api/src/main/java/org/dspace/license/CreativeCommons.java +++ b/dspace-api/src/main/java/org/dspace/license/CreativeCommons.java @@ -129,6 +129,7 @@ public class CreativeCommons String cc_license_url) throws SQLException, IOException, AuthorizeException { + boolean hasCCnamespace = true; Bundle bundle = getCcBundle(item); // get some more information @@ -137,20 +138,46 @@ public class CreativeCommons // here we need to transform the license_rdf into a document_rdf // first we find the beginning of "") + 10; - String document_rdf = "\n" - + "\n" - + "\n" - + "\n\n" - + license_rdf.substring(license_start, license_end) - + "\n\n"; + int license_end; + String document_rdf; + + if (hasCCnamespace) + { + // the 13 is the length of the license closing tag. + license_end = license_rdf.indexOf("") + 13; + document_rdf = "\n" + + "\n" + + "\n" + + "\n\n" + + license_rdf.substring(license_start, license_end) + + "\n\n"; + } + else + { + // the 10 is the length of the license closing tag. + license_end = license_rdf.indexOf("") + 10; + document_rdf = "\n" + + "\n" + + "\n" + + "\n\n" + + license_rdf.substring(license_start, license_end) + + "\n\n"; + } // set the format BitstreamFormat bs_format = BitstreamFormat.findByShortDescription( @@ -187,7 +214,7 @@ public class CreativeCommons BSN_LICENSE_RDF : BSN_LICENSE_TEXT); bs.setFormat(bs_format); bs.update(); - } + } public static void removeLicense(Context context, Item item) throws SQLException, IOException, AuthorizeException