List of usage examples for org.dom4j QName QName
public QName(String name, Namespace namespace)
From source file:cz.fi.muni.xkremser.editor.server.newObject.PeriodicalBuilder.java
License:Open Source License
private void updateDcDoc(Document dcDoc, String pid, String signature, String sysno, DigitalObjectModel model) { Element dcRootEl = dcDoc.getRootElement(); Attribute schemaLoc = dcRootEl.attribute("schemaLocation"); dcRootEl.remove(schemaLoc);/*from ww w. java2 s . com*/ Namespace xsi = DocumentHelper.createNamespace("xsi2", FedoraNamespaces.SCHEMA_NAMESPACE_URI); dcRootEl.add(xsi); dcRootEl.addAttribute(new QName("schemaLocation", xsi), "http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"); XPath typeXpath = Dom4jUtils.createXPath("/oai_dc:dc/dc:identifier"); List<? extends Node> nodes = typeXpath.selectNodes(dcDoc); for (Node node : nodes) { node.detach(); } Element idUuid = dcRootEl.addElement("dc:identifier"); idUuid.addText(pid); for (Node node : nodes) { if (node.getText() != null && !"".equals(node.getText().trim()) && !node.getText().contains(Constants.FEDORA_UUID_PREFIX)) { Element temp = dcRootEl.addElement("dc:identifier"); temp.addText(node.getText()); } } if (signature != null) { Element idSignature = dcRootEl.addElement("dc:identifier"); idSignature.addText("signature:" + signature); } if (sysno != null) { Element idSysno = dcRootEl.addElement("dc:identifier"); idSysno.addText("sysno:" + sysno); } removeDcTypeElements(dcDoc); Element typeEl = dcRootEl.addElement("dc:type"); typeEl.addText("model:" + model.getValue()); Element rightsEl = dcRootEl.addElement("dc:rights"); rightsEl.addText("policy:" + Policy.PUBLIC.toString().toLowerCase()); updateDcLanguages(dcDoc); }
From source file:cz.fi.muni.xkremser.editor.server.newObject.PeriodicalItemBuilder.java
License:Open Source License
/** * {@inheritDoc}/*from w ww. ja va 2 s. com*/ */ @Override protected void decorateMODSStream() { String volumeLabel = getLabel(); Element modsCollection = FoxmlUtils.createModsCollectionEl(); Namespace modsNs = Namespaces.mods; Element mods = modsCollection.addElement(new QName("mods", modsNs)); mods.addAttribute("version", "3.3"); Element idUrn = mods.addElement(new QName("identifier", modsNs)); idUrn.addAttribute("type", "urn"); idUrn.addText(getUuid()); Element titleInfo = mods.addElement(new QName("titleInfo", modsNs)); Element title = titleInfo.addElement(new QName("title", modsNs)); title.addText(volumeLabel); String typeOfResource = getTypeOfResource(); if (typeOfResource != null) { Element typeOfResourceEl = mods.addElement(new QName("typeOfResource", modsNs)); typeOfResourceEl.addText(getTypeOfResource()); } Element genre = mods.addElement(new QName("genre", modsNs)); genre.addAttribute("type", "issue"); Element originInfo = mods.addElement(new QName("originInfo", modsNs)); Element dateIssued = originInfo.addElement(new QName("dateIssued", modsNs)); dateIssued.addText(getDateIssued() != null ? getDateIssued() : ""); Element issuance = originInfo.addElement(new QName("issuance", modsNs)); issuance.addText("continuing"); String language = getLanguage(); if (language != null) { Element languageEl = mods.addElement(new QName("language", modsNs)); Element languageTerm = languageEl.addElement(new QName("languageTerm", modsNs)); languageTerm.addAttribute("type", "code"); languageTerm.addAttribute("authority", "iso639-2b"); languageTerm.addText(language); } Element part = mods.addElement(new QName("part", modsNs)); Element detail = part.addElement(new QName("detail", modsNs)); detail.addAttribute("type", "issue"); Element number = detail.addElement(new QName("number", modsNs)); number.addText(volumeLabel); appendDatastream(DATASTREAM_CONTROLGROUP.X, DATASTREAM_ID.BIBLIO_MODS, modsCollection, null, null); }
From source file:cz.fi.muni.xkremser.editor.server.newObject.PeriodicalVolumeBuilder.java
License:Open Source License
/** * {@inheritDoc}//from ww w. j av a 2 s. c o m */ @Override protected void decorateMODSStream() { String volumeLabel = getLabel(); Element modsCollection = FoxmlUtils.createModsCollectionEl(); Namespace modsNs = Namespaces.mods; Element mods = modsCollection.addElement(new QName("mods", modsNs)); mods.addAttribute("version", "3.3"); Element idUrn = mods.addElement(new QName("identifier", modsNs)); idUrn.addAttribute("type", "urn"); idUrn.addText(getUuid()); Element titleInfo = mods.addElement(new QName("titleInfo", modsNs)); Element title = titleInfo.addElement(new QName("title", modsNs)); title.addText(volumeLabel); String typeOfResource = getTypeOfResource(); if (typeOfResource != null) { Element typeOfResourceEl = mods.addElement(new QName("typeOfResource", modsNs)); typeOfResourceEl.addText(getTypeOfResource()); } Element genre = mods.addElement(new QName("genre", modsNs)); genre.addAttribute("type", "volume"); Element originInfo = mods.addElement(new QName("originInfo", modsNs)); Element dateIssued = originInfo.addElement(new QName("dateIssued", modsNs)); dateIssued.addText(getDateIssued() != null ? getDateIssued() : ""); Element issuance = originInfo.addElement(new QName("issuance", modsNs)); issuance.addText("continuing"); String language = getLanguage(); if (language != null) { Element languageEl = mods.addElement(new QName("language", modsNs)); Element languageTerm = languageEl.addElement(new QName("languageTerm", modsNs)); languageTerm.addAttribute("type", "code"); languageTerm.addAttribute("authority", "iso639-2b"); languageTerm.addText(language); } Element part = mods.addElement(new QName("part", modsNs)); Element detail = part.addElement(new QName("detail", modsNs)); detail.addAttribute("type", "volume"); Element number = detail.addElement(new QName("number", modsNs)); number.addText(volumeLabel); appendDatastream(DATASTREAM_CONTROLGROUP.X, DATASTREAM_ID.BIBLIO_MODS, modsCollection, null, null); }
From source file:cz.mzk.editor.server.fedora.utils.FoxmlUtils.java
License:Open Source License
public static org.dom4j.Element createModsCollectionEl() { org.dom4j.Element modsCollection = DocumentHelper .createElement(new QName("modsCollection", Namespaces.mods)); modsCollection.add(Namespaces.mods); String modsSchema = "https://raw.github.com/moravianlibrary/MEditor/master/resources/xml/mods-3-3.xsd";//"http://www.loc.gov/standards/mods/v3/mods-3-3.xsd"; modsCollection.addAttribute("schemaLocation", Namespaces.mods.getURI() + " " + modsSchema); return modsCollection; }
From source file:cz.mzk.editor.server.fedora.utils.FoxmlUtils.java
License:Open Source License
public static void addRelationshipToRelsExt(org.dom4j.Document relsExtDoc, RelsExtRelation reference) { org.dom4j.Element descriptionEl = findRelsExtDescriptionElement(relsExtDoc); org.dom4j.Element referenceEl = descriptionEl .addElement(new QName(reference.getRelationName().getStringRepresentation(), Namespaces.kramerius)); String targetUuid = reference.getTargetUuid().startsWith(Constants.FEDORA_UUID_PREFIX) ? reference.getTargetUuid()/*from w w w .jav a 2 s . c om*/ : Constants.FEDORA_UUID_PREFIX + reference.getTargetUuid(); String resourceStr = "info:fedora/".concat(targetUuid); referenceEl.addAttribute(new QName("resource", Namespaces.rdf), resourceStr); }
From source file:cz.mzk.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
protected void decorateDCStream() { Element rootElement = DocumentHelper.createElement(new QName("dc", Namespaces.oai_dc)); rootElement.add(Namespaces.dc);/*from w ww . j av a2 s .c o m*/ rootElement.add(Namespaces.xsi); Element title = rootElement.addElement(new QName("title", Namespaces.dc)); title.addText(getLabel()); Element identifier = rootElement.addElement(new QName("identifier", Namespaces.dc)); identifier.setText(getPid()); Element type = rootElement.addElement(new QName("type", Namespaces.dc)); type.addText("model:" + getModel().getValue().substring(0, 1) + getModel().getValue().substring(1).toLowerCase()); Element rights = rootElement.addElement(new QName("rights", Namespaces.dc)); rights.addText("policy:" + getPolicy().toString().toLowerCase()); appendDatastream(DATASTREAM_CONTROLGROUP.X, DATASTREAM_ID.DC, rootElement, null, null); dcXmlContent = rootElement.getDocument(); }
From source file:cz.mzk.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
protected void addRootLanguage(Element modsRootEl) { ModsTypeClient mods = getFirstMods(); if (mods != null && mods.getLanguage() != null && mods.getLanguage().size() > 0 && mods.getLanguage().get(0).getLanguageTerm() != null && mods.getLanguage().get(0).getLanguageTerm().size() > 0 && mods.getLanguage().get(0).getLanguageTerm().get(0) != null && isNotNullOrEmpty(mods.getLanguage().get(0).getLanguageTerm().get(0).getValue())) { Element languageEl = modsRootEl.addElement(new QName("language", Namespaces.mods)); Element languageTerm = languageEl.addElement(new QName("languageTerm", Namespaces.mods)); languageTerm.addAttribute("type", "code"); languageTerm.addAttribute("authority", "iso639-2b"); languageTerm.addText(mods.getLanguage().get(0).getLanguageTerm().get(0).getValue()); }/* w w w . j av a 2s .co m*/ }
From source file:cz.mzk.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
protected void addRootTitle(Element titleInfo) { TitleInfoTypeClient firstTitleInfo = getFirstTitleInfo(); if (firstTitleInfo != null && firstTitleInfo.getTitle() != null && firstTitleInfo.getTitle().size() > 0 && isNotNullOrEmpty(firstTitleInfo.getTitle().get(0))) { titleInfo.addElement(new QName("title", Namespaces.mods)).addText(firstTitleInfo.getTitle().get(0)); }/*from ww w. j a v a2s . c o m*/ }
From source file:cz.mzk.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
protected void addRootSubtitle(Element titleInfoEl) { TitleInfoTypeClient firstTitleInfo = getFirstTitleInfo(); if (firstTitleInfo != null && firstTitleInfo.getSubTitle() != null && firstTitleInfo.getSubTitle().size() > 0 && isNotNullOrEmpty(firstTitleInfo.getSubTitle().get(0))) { titleInfoEl.addElement(new QName("subtitle", Namespaces.mods)) .addText(firstTitleInfo.getSubTitle().get(0)); }// www . j a va 2s . co m }
From source file:cz.mzk.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
protected void addIdentifierUuid(Element modsRootElement, String uuid) { Element identifier = modsRootElement.addElement(new QName("identifier", Namespaces.mods)); identifier.addAttribute("type", "uuid"); identifier.addText("uuid:" + uuid); }