List of usage examples for org.dom4j QName QName
public QName(String name, Namespace namespace)
From source file:cz.mzk.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
protected void addRootPlace(Element originInfoEl) { ModsTypeClient mods = getFirstMods(); PlaceTypeClient placeClient = null;/*from ww w . j av a 2 s.com*/ if (mods != null && mods.getOriginInfo() != null && mods.getOriginInfo().size() > 0 && mods.getOriginInfo().get(0).getPlace() != null && mods.getOriginInfo().get(0).getPlace().size() > 0) placeClient = mods.getOriginInfo().get(0).getPlace().get(0); if (placeClient != null && placeClient.getPlaceTerm() != null && placeClient.getPlaceTerm().size() > 0) { String authority = placeClient.getPlaceTerm().get(0).getAuthority().value(); String type = placeClient.getPlaceTerm().get(0).getType().value(); String place = placeClient.getPlaceTerm().get(0).getValue(); if (authority != null && type != null && place != null) { Element placeEl = originInfoEl.addElement(new QName("place", Namespaces.mods)); Element placeTermEl = placeEl.addElement(new QName("placeTerm", Namespaces.mods)); placeTermEl.addAttribute("type", type); placeTermEl.addAttribute("authority", authority); placeTermEl.addText(place); } } }
From source file:cz.mzk.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
protected void addRootPublisher(Element originInfoEl) { if (getBundle() != null && getBundle().getMarc() != null) { String name = getBundle().getMarc().getPublisher(); if (isNotNullOrEmpty(name)) { Element publisher = originInfoEl.addElement(new QName("publisher", Namespaces.mods)); publisher.addText(name);// w w w . j ava 2s .c om } } }
From source file:cz.mzk.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
protected Element addRootPhysicalDescriptionForm(Element modsRootEl) { ModsTypeClient mods = getFirstMods(); List<StringPlusAuthorityPlusTypeClient> physDescForms = null; Element physDescEl = modsRootEl.addElement(new QName("physicalDescription", Namespaces.mods)); if (mods != null && mods.getPhysicalDescription() != null && mods.getPhysicalDescription().size() > 0 && mods.getPhysicalDescription().get(0).getForm() != null && mods.getPhysicalDescription().get(0).getForm().size() > 0) { physDescForms = mods.getPhysicalDescription().get(0).getForm(); for (StringPlusAuthorityPlusTypeClient physDescForm : physDescForms) { String authority = physDescForm.getAuthority(); String form = physDescForm.getValue(); if (authority != null && form != null) { Element formEl = physDescEl.addElement(new QName("form", Namespaces.mods)); formEl.addAttribute("authority", authority); formEl.addText(form);/* w w w .j a va 2s . c o m*/ } } } return physDescEl; }
From source file:cz.mzk.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
protected void addLocation(Element locationEl) { Element url = locationEl.addElement(new QName("url", Namespaces.mods)); url.addText(configuration.getKrameriusHost() + "/handle/uuid:" + uuid); }
From source file:cz.mzk.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
protected void addRootRecordInfo(Element recordInfoEl) { Date now = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); String nowStr = sdf.format(now); Element creationDate = recordInfoEl.addElement(new QName("recordCreationDate", Namespaces.mods)); creationDate.addAttribute("encoding", "iso8601"); creationDate.addText(nowStr);/*from w w w . ja v a 2 s.c o m*/ Element changeDate = recordInfoEl.addElement(new QName("recordChangeDate", Namespaces.mods)); changeDate.addAttribute("encoding", "iso8601"); changeDate.addText(nowStr); }
From source file:cz.mzk.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
protected void addRootTopic(Element modsRootEl) { if (getBundle() != null && getBundle().getMarc() != null) { String topic = getBundle().getMarc().getTopic(); if (topic != null) { Element subjectEl = modsRootEl.addElement(new QName("subject", Namespaces.mods)); Element topicEl = subjectEl.addElement(new QName("topic", Namespaces.mods)); topicEl.addText(topic);/*from w w w . j a v a2 s. c om*/ } } }
From source file:cz.mzk.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
protected void addRootPhysicalLocation(Element locationEl, boolean doDetach) { if (getBundle() != null && getBundle().getMarc() != null) { String location = getBundle().getMarc().getLocation(); if (location != null) { // Element shelfLocatorEl = (Element) shelfLocatorXpath.selectSingleNode(locationEl); // String shelfLocatorStr = ""; // if (shelfLocatorEl != null) { // shelfLocatorStr = shelfLocatorEl.getTextTrim(); // if (doDetach) shelfLocatorEl.detach(); // } Element physicalLocationEl = locationEl.addElement(new QName("physicalLocation", Namespaces.mods)); physicalLocationEl.addText(location); // shelfLocatorEl = locationEl.addElement(new QName("shelfLocator", Namespaces.mods)); // shelfLocatorEl.addText(shelfLocatorStr); }/* w ww. j a v a2 s . co m*/ } }
From source file:cz.mzk.editor.server.newObject.FoxmlBuilder.java
License:Open Source License
protected void addRootUdcOrDdc(Element modsRootEl) { if (getBundle() != null && getBundle().getMarc() != null) { if (getBundle().getMarc().getUdcs() == null) { return; }//from w ww . j a v a 2 s. c o m List<String> udcs = getBundle().getMarc().getUdcs(); for (String udc : udcs) { Element classificationEl = modsRootEl.addElement(new QName("classification", Namespaces.mods)); classificationEl.addAttribute("authority", "udc"); classificationEl.addText(udc); } } }
From source file:cz.mzk.editor.server.newObject.IntPartBuilder.java
License:Open Source License
/** * {@inheritDoc}//www.ja v a 2 s .c o m */ @Override protected void decorateMODSStream() { Element modsCollection = FoxmlUtils.createModsCollectionEl(); Namespace modsNs = Namespaces.mods; Element mods = modsCollection.addElement(new QName("mods", modsNs)); mods.addAttribute("version", "3.3"); mods.addAttribute("ID", getAditionalInfo()); 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(getName()); if (isNotNullOrEmpty(getNoteOrIntSubtitle())) { Element subtitle = titleInfo.addElement(new QName("subtitle", modsNs)); subtitle.addText(getNoteOrIntSubtitle()); } if (isNotNullOrEmpty(getPartNumber())) { Element partNumber = titleInfo.addElement(new QName("partNumber", modsNs)); partNumber.addText(getPartNumber()); } if (isNotNullOrEmpty(getDateOrIntPartName())) { Element partName = titleInfo.addElement(new QName("partName", modsNs)); partName.addText(getDateOrIntPartName()); } Element genre = mods.addElement(new QName("genre", modsNs)); genre.addAttribute("type", getType()); String levelName = getAditionalInfo().substring(0, getAditionalInfo().indexOf("_", 6)); genre.addText(INTERNAL_PART_LEVEL_NAMES.MAP.get(levelName)); Element part = mods.addElement(new QName("part", modsNs)); Element extent = part.addElement(new QName("extent", modsNs)); 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())); addRootLanguage(mods); addIdentifierUuid(mods, getUuid()); addRootRecordInfo(mods.addElement(new QName("recordInfo", modsNs))); addRootTopic(mods); addLocation(mods.addElement(new QName("location", modsNs))); appendDatastream(DATASTREAM_CONTROLGROUP.X, DATASTREAM_ID.BIBLIO_MODS, modsCollection, null, null); }
From source file:cz.mzk.editor.server.newObject.MonographBuilder.java
License:Open Source License
@SuppressWarnings("unchecked") 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 ww . 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.getValue()); Element rightsEl = dcRootEl.addElement("dc:rights"); rightsEl.addText("policy:" + getPolicy().toString().toLowerCase()); updateDcLanguages(dcDoc); }