Example usage for org.dom4j QName QName

List of usage examples for org.dom4j QName QName

Introduction

In this page you can find the example usage for org.dom4j QName QName.

Prototype

public QName(String name, Namespace namespace) 

Source Link

Usage

From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java

License:Open Source License

private void addTopic(Document modsDoc, MarcSpecificMetadata marc) {
    String topic = marc.getTopic();
    if (topic != null) {
        Element modsEl = (Element) modsXpath.selectSingleNode(modsDoc);
        Element subjectEl = modsEl.addElement(new QName("subject", Namespaces.mods));
        Element topicEl = subjectEl.addElement(new QName("topic", Namespaces.mods));
        topicEl.addText(topic);//from  w w  w .  ja  va2  s.co m
    }
}

From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java

License:Open Source License

private void addSysno(Document modsDoc, MarcSpecificMetadata marc) {
    String sysno = marc.getSysno();
    if (sysno != null) {
        Element modsEl = (Element) modsXpath.selectSingleNode(modsDoc);
        Element identifierEl = modsEl.addElement(new QName("identifier", Namespaces.mods));
        identifierEl.addAttribute("type", "sysno");
        identifierEl.addText(sysno);// w  w w.j  a  v a2s.  c  o m
    }
}

From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java

License:Open Source License

private void addLinks(Document modsDoc, MarcSpecificMetadata marc, String uuid) {
    Element copyInformation = (Element) copyInformationXpath.selectSingleNode(modsDoc);
    copyInformation.addElement(new QName("electronicLocator", Namespaces.mods));
    copyInformation.addText(alephLink(marc));

    Element location = (Element) locationXpath.selectSingleNode(modsDoc);
    Element url = location.addElement(new QName("url", Namespaces.mods));
    url.addText(krameriusLink(uuid));/*w w w  . j  a va2  s. c o m*/
}

From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java

License:Open Source License

private void addPublishment(Document modsDoc, MarcSpecificMetadata marc) {
    Element modsEl = (Element) modsXpath.selectSingleNode(modsDoc);
    Element originInfoEl = modsEl.addElement(new QName("originInfo", Namespaces.mods));
    originInfoEl.addAttribute("transliteration", "publisher");
    addPublishmentPlace(originInfoEl, marc);
    addPublisher(originInfoEl, marc);/* w  ww  .  j a v  a 2  s  .  c om*/
    addPublishmentDate(originInfoEl, marc);
}

From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java

License:Open Source License

private void addPublishmentPlace(Element originInfoEl, MarcSpecificMetadata marc) {
    String place = marc.getPlace();
    if (place != null) {
        Element placeEl = originInfoEl.addElement(new QName("place", Namespaces.mods));
        Element placeTerm = placeEl.addElement(new QName("placeTerm", Namespaces.mods));
        placeTerm.addAttribute("type", "text");
        placeTerm.addText(place);//from   w w  w . j  a va  2s.c  o m
    }
}

From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java

License:Open Source License

private void addPublisher(Element originInfoEl, MarcSpecificMetadata marc) {
    String name = marc.getPublisher();
    if (name != null) {
        Element publisher = originInfoEl.addElement(new QName("publisher", Namespaces.mods));
        publisher.addText(name);/*from   www . j av  a2s .  c o  m*/
    }
}

From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java

License:Open Source License

private void addPublishmentDate(Element originInfoEl, MarcSpecificMetadata marc) {
    String dates = marc.getDateIssued();
    if (dates != null) {
        Element dateIssued = originInfoEl.addElement(new QName("dateIssued", Namespaces.mods));
        dateIssued.addText(dates);//w w  w.j a  v  a  2 s  .  c o  m
    }
}

From source file:cz.fi.muni.xkremser.editor.server.newObject.MonographBuilder.java

License:Open Source License

private void updateRecordInfo(Document modsDoc, String uuid) {
    Element recordInfo = (Element) recordInfoXpath.selectSingleNode(modsDoc);
    if (recordInfo == null) {
        recordInfo = modsDoc.getRootElement().addElement(new QName("recordInfo", Namespaces.mods));
    }// w  w  w.j a v a2s  .c o m
    Date now = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");

    String nowStr = sdf.format(now);
    Element creationDate = recordInfo.addElement(new QName("recordCreationDate", Namespaces.mods));
    creationDate.addAttribute("encoding", "iso8601");
    creationDate.addText(nowStr);
    Element changeDate = recordInfo.addElement(new QName("recordChangeDate", Namespaces.mods));
    changeDate.addAttribute("encoding", "iso8601");
    changeDate.addText(nowStr);
    Element recordId = recordInfo.addElement(new QName("recordIdentifier", Namespaces.mods));
    recordId.addText("uuid:" + uuid);
}

From source file:cz.fi.muni.xkremser.editor.server.newObject.PageBuilder.java

License:Open Source License

/**
 * {@inheritDoc}//from  www.j a va  2  s .  co m
 */
@Override
protected void decorateMODSStream() {
    String pageLabel = 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 idSici = mods.addElement(new QName("identifier", modsNs));
    idSici.addAttribute("type", "sici");

    Element typeOfResource = mods.addElement(new QName("typeOfResource", modsNs));
    typeOfResource.addText("text");
    Element part = mods.addElement(new QName("part", modsNs));
    String resolvedPageType = Constants.PAGE_TYPES.MAP.get(getPageType());
    part.addAttribute("type", resolvedPageType == null ? "NormalPage" : resolvedPageType);
    //pageNumber
    Element detail = part.addElement(new QName("detail", modsNs));
    detail.addAttribute("type", "pageNumber");

    Element number = null;
    if (pageLabel.contains(Constants.TWO_PAGES_SEPARATOR)) {
        String[] splitedLabel = pageLabel.split("\\" + Constants.TWO_PAGES_SEPARATOR);
        number = detail.addElement(new QName("number", modsNs));
        number.addText(splitedLabel[0]);
        number = detail.addElement(new QName("number", modsNs));
        number.addText(splitedLabel[1]);
    } else {
        number = detail.addElement(new QName("number", modsNs));
        number.addText(pageLabel);
    }
    //page index
    detail = part.addElement(new QName("detail", modsNs));
    detail.addAttribute("type", "pageIndex");
    number = detail.addElement(new QName("number", modsNs));
    number.addText(String.valueOf(getPageIndex()));
    appendDatastream(DATASTREAM_CONTROLGROUP.X, DATASTREAM_ID.BIBLIO_MODS, modsCollection, null, null);
}

From source file:cz.fi.muni.xkremser.editor.server.newObject.PageBuilder.java

License:Open Source License

/**
 * {@inheritDoc}//from   ww  w  . ja  v  a  2 s .com
 */
@Override
protected void decorateRelsExtStream() {
    super.decorateRelsExtStream();
    Element description = FoxmlUtils.findDescriptionElement(getRelsExtXmlContent());
    Element url = description.addElement(new QName("tiles-url", Namespaces.kramerius));
    url.addText(getImageUrl() + ".jp2");
}