You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ed...@apache.org on 2003/08/08 11:50:09 UTC
cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/publication DublinCore.java
edith 2003/08/08 02:50:09
Modified: src/java/org/apache/lenya/cms/publication DublinCore.java
Log:
method to set and get the identifier
Revision Changes Path
1.10 +59 -37 cocoon-lenya/src/java/org/apache/lenya/cms/publication/DublinCore.java
Index: DublinCore.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/publication/DublinCore.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DublinCore.java 31 Jul 2003 14:38:24 -0000 1.9
+++ DublinCore.java 8 Aug 2003 09:50:09 -0000 1.10
@@ -72,19 +72,25 @@
public class DublinCore {
private Document cmsdocument;
private File infofile;
- private NodeList nodelist;
- private String string;
+ private NodeList nodelist;
+ private String string;
- private static final String DC_NAMESPACE = "http://purl.org/dc/elements/1.1/";
+ private static final String DC_NAMESPACE =
+ "http://purl.org/dc/elements/1.1/";
- /**
- * Creates a new instance of Dublin Core
- *
- */
- protected DublinCore(Document mydocument) {
- this.cmsdocument = mydocument;
- this.infofile = cmsdocument.getPublication().getPathMapper().getFile(cmsdocument.getPublication(), cmsdocument.getPublication().AUTHORING_AREA, cmsdocument.getId(), cmsdocument.getLanguage());
- }
+ /**
+ * Creates a new instance of Dublin Core
+ *
+ */
+ protected DublinCore(Document mydocument) {
+ this.cmsdocument = mydocument;
+ this.infofile =
+ cmsdocument.getPublication().getPathMapper().getFile(
+ cmsdocument.getPublication(),
+ cmsdocument.getPublication().AUTHORING_AREA,
+ cmsdocument.getId(),
+ cmsdocument.getLanguage());
+ }
/**
* @see org.apache.lenya.cms.publication.Document#getDCTitle()
@@ -105,9 +111,9 @@
/**
* @see org.apache.lenya.cms.publication.Document#getDCTitle()
*/
- public String getCreator() throws PublicationException{
+ public String getCreator() throws PublicationException {
return getDCNode("creator");
- }
+ }
/**
* Set the DC creator
@@ -121,36 +127,39 @@
/**
* @see org.apache.lenya.cms.publication.Document#getDCTitle()
*/
- public String getSubject() throws PublicationException {
+ public String getSubject() throws PublicationException {
return getDCNode("subject");
}
private String getDCNode(String node) {
+ try {
+ nodelist =
+ DocumentHelper.readDocument(infofile).getElementsByTagNameNS(
+ DC_NAMESPACE,
+ node);
try {
- nodelist = DocumentHelper.readDocument(infofile).getElementsByTagNameNS(DC_NAMESPACE, node);
- try {
string = nodelist.item(0).getFirstChild().getNodeValue();
} catch (Exception e) {
- string = "";
- }
- } catch (Exception e) {
- string = e.toString();
+ string = "";
}
-
- return string;
+ } catch (Exception e) {
+ string = e.toString();
}
+ return string;
+ }
+
private void setDCNode(String node, String text) {
org.w3c.dom.Document document;
- try {
- document = DocumentHelper.readDocument(infofile);
- nodelist = document.getElementsByTagNameNS(DC_NAMESPACE, node);
- nodelist.item(0).getFirstChild().setNodeValue(text);
- DocumentHelper.writeDocument(document, infofile);
- } catch (Exception e) {
- string = e.toString();
- }
+ try {
+ document = DocumentHelper.readDocument(infofile);
+ nodelist = document.getElementsByTagNameNS(DC_NAMESPACE, node);
+ nodelist.item(0).getFirstChild().setNodeValue(text);
+ DocumentHelper.writeDocument(document, infofile);
+ } catch (Exception e) {
+ string = e.toString();
}
+ }
/**
* Set the DC Subject
@@ -164,10 +173,10 @@
/**
* @see org.apache.lenya.cms.publication.Document#getDCTitle()
*/
- public String getDescription() throws PublicationException {
+ public String getDescription() throws PublicationException {
return getDCNode("description");
- }
-
+ }
+
/**
* Set the DC Description
*
@@ -180,9 +189,9 @@
/**
* @see org.apache.lenya.cms.publication.Document#getDCTitle()
*/
- public String getRights() throws PublicationException {
+ public String getRights() throws PublicationException {
return getDCNode("rights");
- }
+ }
/**
* Set the DC Rights
@@ -193,5 +202,18 @@
setDCNode("rights", rights);
}
-
+ /**
+ * @see org.apache.lenya.cms.publication.Document#getDCTitle()
+ */
+ public String getIdentifier() throws PublicationException {
+ return getDCNode("identifier");
+ }
+ /**
+ * Set the DC Identifier
+ *
+ * @param identifier The identifier
+ */
+ public void setIdentifier(String identifier) {
+ setDCNode("identifier", identifier);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org