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.FoxmlBuilder.java
License:Open Source License
private void decotateProperties() { Element properties = rootElement.addElement(new QName("objectProperties", Namespaces.foxml)); addProperty(properties, "info:fedora/fedora-system:def/model#label", label); addProperty(properties, "info:fedora/fedora-system:def/model#state", "A"); //TODO: change to the responsible person later addProperty(properties, "info:fedora/fedora-system:def/model#ownerId", "fedoraAdmin"); }
From source file:cz.fi.muni.xkremser.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
private void addProperty(Element properties, String name, String value) { Element property = properties.addElement(new QName("property", Namespaces.foxml)); property.addAttribute("NAME", name); property.addAttribute("VALUE", value); }
From source file:cz.fi.muni.xkremser.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 ww w.jav a2s . co 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()); 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.fi.muni.xkremser.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
protected Element createDatastreamVersionElement(Element rootEl, String formatUri, String mimetype, String label, String id) { Element dataStreamVersion = rootEl.addElement(new QName("datastreamVersion", Namespaces.foxml)); if (formatUri != null) { dataStreamVersion.addAttribute("FORMAT_URI", formatUri); }/* w w w. j a va2s. com*/ dataStreamVersion.addAttribute("MIMETYPE", mimetype); //probably will be generated Date now = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); dataStreamVersion.addAttribute("CREATED", sdf.format(now)); if (label != null) { dataStreamVersion.addAttribute("LABEL", label); } dataStreamVersion.addAttribute("ID", id); return dataStreamVersion; }
From source file:cz.fi.muni.xkremser.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
private void addXmlContent(Element content, Element dataStreamVersion) { Element xmlContent = dataStreamVersion.addElement(new QName("xmlContent", Namespaces.foxml)); xmlContent.add(content);//from w w w . j a v a2 s.com }
From source file:cz.fi.muni.xkremser.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
private void addContentLocation(String name, String reference, Element dataStreamVersion) { Element contentLocation = dataStreamVersion.addElement(new QName("contentLocation", Namespaces.foxml)); contentLocation.addAttribute("TYPE", name); contentLocation.addAttribute("REF", reference); }
From source file:cz.fi.muni.xkremser.editor.server.newObject.IntPartBuilder.java
License:Open Source License
/** * {@inheritDoc}/*from w w w.j a va2s .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); Element typeOfResource = mods.addElement(new QName("typeOfResource", modsNs)); typeOfResource.addText("text"); Element part = mods.addElement(new QName("part", modsNs)); part.addAttribute("type", "Chapter"); Element extent = part.addElement(new QName("extent", modsNs)); extent.addAttribute("unit", "pages"); List<RelsExtRelation> children = getChildren(); Element start = extent.addElement(new QName("start", modsNs)); start.addText(children.get(0).getTargetName()); Element end = extent.addElement(new QName("end", modsNs)); end.addText(children.get(children.size() - 1).getTargetName()); Element total = extent.addElement(new QName("total", modsNs)); total.addText(String.valueOf(children.size())); // Element detail = part.addElement(new QName("detail", modsNs)); // detail.addAttribute("type", "pageNumber"); // Element number = detail.addElement(new QName("number", modsNs)); // number.addText(""); Element accessCondition = mods.addElement(new QName("accessCondition", modsNs)); accessCondition.addAttribute("type", "restrictionOnAccess"); appendDatastream(DATASTREAM_CONTROLGROUP.X, DATASTREAM_ID.BIBLIO_MODS, modsCollection, null, null); }
From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.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 w w w . j av a 2s . c o m*/ 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.toString()); 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.MonographBuilder.java
License:Open Source License
private void addPhysicalLocation(Document modsDoc, MarcSpecificMetadata marc) { String location = marc.getLocation(); if (location != null) { Element locationEl = (Element) locationXpath.selectSingleNode(modsDoc); Element shelfLocatorEl = (Element) shelfLocatorXpath.selectSingleNode(locationEl); String shelfLocatorStr = shelfLocatorEl.getTextTrim(); shelfLocatorEl.detach();/*from ww w. j ava 2s . c om*/ Element physicalLocationEl = locationEl.addElement(new QName("physicalLocation", Namespaces.mods)); physicalLocationEl.addText(location); shelfLocatorEl = locationEl.addElement(new QName("shelfLocator", Namespaces.mods)); shelfLocatorEl.addText(shelfLocatorStr); } }
From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java
License:Open Source License
private void addUdcOrDdc(Document modsDoc, MarcSpecificMetadata marc) { if (marc.getUdcs() == null) { return;/*www. ja v a 2 s . c o m*/ } List<String> udcs = marc.getUdcs(); for (String udc : udcs) { Element modsEl = (Element) modsXpath.selectSingleNode(modsDoc); Element classificationEl = modsEl.addElement(new QName("classification", Namespaces.mods)); classificationEl.addAttribute("authority", "udc"); classificationEl.addText(udc); } }