Mercurial > hg > mpdl-group
diff software/eXist/mpdl-modules/src/de/mpg/mpiwg/berlin/mpdl/xml/SchemaHandler.java @ 16:257f67be5c00
diverse Fehlerbehebungen
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 27 Sep 2011 16:40:57 +0200 |
parents | 59ff47d1e237 |
children |
line wrap: on
line diff
--- a/software/eXist/mpdl-modules/src/de/mpg/mpiwg/berlin/mpdl/xml/SchemaHandler.java Mon Aug 29 17:40:19 2011 +0200 +++ b/software/eXist/mpdl-modules/src/de/mpg/mpiwg/berlin/mpdl/xml/SchemaHandler.java Tue Sep 27 16:40:57 2011 +0200 @@ -35,7 +35,7 @@ String fName = docOperation.getFileName(); if (fName == null || fName.trim().equals("")) throw new ApplicationException("Your document file name is empty. Please specify a file name for your document."); - if (! fName.endsWith(".xml")) + if (! fName.endsWith(".xml") && docBase != null && ! docBase.equals("diverse")) throw new ApplicationException("Your document file name does not end with \".xml\". Please specify a file name with the suffix \".xml\" for your document."); // RelaxNG schema validation validateByRelaxNGSchema(destFile, docBase); @@ -75,6 +75,14 @@ String id = getIdByExistId(eXistIdentifier); mdRecord.setIdentifier("TEI:" + id + ".xml"); } + } else if (docBase != null && docBase.equals("diverse")) { + mdRecord = getMetadataRecordDiverse(documentNode); + if (mdRecord != null) { + String id = getIdByExistId(eXistIdentifier); + mdRecord.setIdentifier(id); + String lang = docOperation.getLanguage(); + mdRecord.setLanguage(lang); + } } if (mdRecord != null) { mdRecord.setEXistIdentifier(eXistIdentifier); @@ -132,6 +140,8 @@ } private void validate(Node docNode, String docBase) throws ApplicationException { + if (docBase.equals("diverse")) + return; XmlUtil xmlUtil = XmlUtil.getInstance(); NamespaceContext nsContext = getEchoNsContext(); String echoTest = null; @@ -192,6 +202,9 @@ } private void validate(MetadataRecord mdRecord) throws ApplicationException { + String docBase = mdRecord.getDocBase(); + if (docBase.equals("diverse")) + return; String identifier = mdRecord.getIdentifier(); String creator = mdRecord.getCreator(); String title = mdRecord.getTitle(); @@ -318,6 +331,18 @@ return mdRecord; } + private MetadataRecord getMetadataRecordDiverse(Node documentNode) throws ApplicationException { + String rights = "open access"; + String license = "http://echo.mpiwg-berlin.mpg.de/policy/oa_basics/declaration"; + String accessRights = "free"; + accessRights = StringUtilEscapeChars.deresolveXmlEntities(accessRights); + MetadataRecord mdRecord = new MetadataRecord(null, null, null, null, null, null, null, rights, null); + mdRecord.setDocBase("diverse"); + mdRecord.setLicense(license); + mdRecord.setAccessRights(accessRights); + return mdRecord; + } + private String getIndexMetaDataPageImg(String imagesDocDirectory) throws ApplicationException { String resultStr = null; String nausikaaURLTexter = "http://nausikaa2.mpiwg-berlin.mpg.de/digitallibrary/servlet/Texter";