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.mzk.editor.server.newObject.MonographBuilder.java

License:Open Source License

private void updateModsDoc(Document modsDoc, MarcSpecificMetadata marc, String uuid) {
    ((Element) modsXpath.selectSingleNode(modsDoc)).addAttribute("ID", "MODS_VOLUME_0001");

    addRootUdcOrDdc((Element) modsXpath.selectSingleNode(modsDoc));
    addRootTopic((Element) modsXpath.selectSingleNode(modsDoc));
    addSysno(modsDoc, marc);//from ww w . ja v a  2 s . com
    //        addLinks(modsDoc, marc, uuid);
    //addPublishment(modsDoc, marc);
    updateRecordInfo(modsDoc);
    addIdentifierUuid((Element) modsXpath.selectSingleNode(modsDoc), uuid);
    Element locationEl = (Element) locationXpath.selectSingleNode(modsDoc);
    addRootPhysicalLocation(locationEl != null ? locationEl
            : ((Element) modsXpath.selectSingleNode(modsDoc))
                    .addElement(new QName("location", Namespaces.mods)),
            true);
}

From source file:cz.mzk.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);
    addLocation(location);/*from w w w . j  a  v a2s  .  co m*/
}

From source file:cz.mzk.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);
    addRootPublisher(originInfoEl);/*from  w  ww .j  a  v  a 2 s  .c om*/
    addPublishmentDate(originInfoEl, marc);
}

From source file:cz.mzk.editor.server.newObject.MonographBuilder.java

License:Open Source License

private void updateRecordInfo(Document modsDoc) {
    Element recordInfo = (Element) recordInfoXpath.selectSingleNode(modsDoc);
    if (recordInfo == null) {
        recordInfo = modsDoc.getRootElement().addElement(new QName("recordInfo", Namespaces.mods));
    }/*from w w w . ja v  a2s.c  o m*/
    addRootRecordInfo(recordInfo);
}

From source file:cz.mzk.editor.server.newObject.MonographUnitBuilder.java

License:Open Source License

/**
 * {@inheritDoc}/* w w  w. ja  va2s  .  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));

    addRootTitle(titleInfo.addElement(new QName("title", modsNs)));

    if (isNotNullOrEmpty(getPartNumber())) {
        Element partNumber = titleInfo.addElement(new QName("partNumber", modsNs));
        partNumber.addText(getPartNumber());
    }
    if (isNotNullOrEmpty(getName())) {
        Element partName = titleInfo.addElement(new QName("partName", modsNs));
        partName.addText(getName());
    }

    Element genre = mods.addElement(new QName("genre", modsNs));
    String levelName = getAditionalInfo().substring(0, getAditionalInfo().indexOf("_", 6));
    genre.addText(Constants.MONOGRAPH_UNIT_LEVEL_NAMES.MAP.get(levelName));

    Element originInfo = mods.addElement(new QName("originInfo", modsNs));
    Element dateIssued = originInfo.addElement(new QName("dateIssued", modsNs));
    if (isNotNullOrEmpty(getDateOrIntPartName())) {
        dateIssued.addText(getDateOrIntPartName());
    } else {
        dateIssued.addAttribute("qualifier", "approximate");
    }

    addRootPlace(originInfo);
    addRootPublisher(originInfo);
    addRootLanguage(mods);
    addRootTopic(mods);

    Element physicalDescription = addRootPhysicalDescriptionForm(mods);
    if (isNotNullOrEmpty(getNoteOrIntSubtitle())) {
        Element noteEl = physicalDescription.addElement(new QName("note", modsNs));
        noteEl.addText(getNoteOrIntSubtitle());
    }

    addIdentifierUuid(mods, getUuid());

    appendDatastream(DATASTREAM_CONTROLGROUP.X, DATASTREAM_ID.BIBLIO_MODS, modsCollection, null, null);
}

From source file:cz.mzk.editor.server.newObject.PageBuilder.java

License:Open Source License

/**
 * {@inheritDoc}//from  w w  w .  j a  v  a  2s  .c  om
 */
@Override
protected void decorateMODSStream() {
    String pageLabel = getName();
    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 titleInfo = mods.addElement(new QName("titleInfo", modsNs));
    Element title = titleInfo.addElement(new QName("title", modsNs));
    title.addText(pageLabel);

    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(getType());
    part.addAttribute("type", resolvedPageType == null ? "NormalPage" : resolvedPageType);
    //pageNumber
    Element detail = part.addElement(new QName("detail", modsNs));
    detail.addAttribute("type", Constants.MODS_PART_DETAIL_PAGE_NUMBER);

    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()));

    addLocation(mods.addElement(new QName("location", modsNs)));
    addIdentifierUuid(mods, getUuid());

    appendDatastream(DATASTREAM_CONTROLGROUP.X, DATASTREAM_ID.BIBLIO_MODS, modsCollection, null, null);
}

From source file:cz.mzk.editor.server.newObject.PageBuilder.java

License:Open Source License

/**
 * {@inheritDoc}/*w w w.  jav a2  s. co m*/
 */
@Override
protected void decorateRelsExtStream() {
    super.decorateRelsExtStream();

    Element description = FoxmlUtils.findDescriptionElement(getRelsExtXmlContent());
    Element url = description.addElement(new QName("tiles-url", Namespaces.kramerius));
    url.addText(getImageUrl());
}

From source file:cz.mzk.editor.server.newObject.PeriodicalBuilder.java

License:Open Source License

private void addLinks(Document modsDoc) {
    Element locationEl = (Element) locationXpath.selectSingleNode(modsDoc);
    if (locationEl != null)
        locationEl.detach();// www.  ja  v a  2  s.  co m
    addLocation(
            ((Element) modsXpath.selectSingleNode(modsDoc)).addElement(new QName("location", Namespaces.mods)));
}

From source file:cz.mzk.editor.server.newObject.PeriodicalItemBuilder.java

License:Open Source License

/**
 * {@inheritDoc}//w w w  .j  a v a2 s . co  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));

    addRootTitle(titleInfo);
    addRootSubtitle(titleInfo);

    if (isNotNullOrEmpty(getName())) {
        Element partName = titleInfo.addElement(new QName("partName", modsNs));
        partName.addText(getName());
    }

    if (isNotNullOrEmpty(getPartNumber())) {
        Element partNumber = titleInfo.addElement(new QName("partNumber", modsNs));
        partNumber.addText(getPartNumber());
    }

    if (isNotNullOrEmpty(getTypeOfResource())) {
        Element typeOfResourceEl = mods.addElement(new QName("typeOfResource", modsNs));
        typeOfResourceEl.addText(getTypeOfResource());
    }

    Element genre = mods.addElement(new QName("genre", modsNs));
    if (isNotNullOrEmpty(getType()))
        genre.addAttribute("type", getType());
    String levelName = getAditionalInfo().substring(0, getAditionalInfo().indexOf("_", 6));
    genre.addText(Constants.PERIODICAL_ITEM_LEVEL_NAMES.MAP.get(levelName));

    Element originInfo = mods.addElement(new QName("originInfo", modsNs));
    Element dateIssued = originInfo.addElement(new QName("dateIssued", modsNs));
    if (isNotNullOrEmpty(getDateOrIntPartName())) {
        dateIssued.addText(getDateOrIntPartName());
    } else {
        dateIssued.addAttribute("qualifier", "approximate");
    }

    addRootPublisher(originInfo);
    addRootPlace(originInfo);
    addRootLanguage(mods);
    addRootTopic(mods);
    Element locationEl = mods.addElement(new QName("location", modsNs));
    addLocation(locationEl);
    addRootPhysicalLocation(locationEl, false);

    Element physicalDescription = addRootPhysicalDescriptionForm(mods);
    if (isNotNullOrEmpty(getNoteOrIntSubtitle())) {
        Element noteEl = physicalDescription.addElement(new QName("note", modsNs));
        noteEl.addText(getNoteOrIntSubtitle());
    }

    Element part = mods.addElement(new QName("part", modsNs));
    part.addAttribute("type", "issue");

    addIdentifierUuid(mods, getUuid());

    appendDatastream(DATASTREAM_CONTROLGROUP.X, DATASTREAM_ID.BIBLIO_MODS, modsCollection, null, null);

}

From source file:cz.mzk.editor.server.newObject.PeriodicalVolumeBuilder.java

License:Open Source License

/**
 * {@inheritDoc}/*from  ww  w. j  a  v a 2  s .co 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", "MODS_VOLUME_0001");
    Element idUrn = mods.addElement(new QName("identifier", modsNs));
    idUrn.addAttribute("type", "urn");
    idUrn.addText(getUuid());

    Element titleInfo = mods.addElement(new QName("titleInfo", modsNs));

    if (isNotNullOrEmpty(getPartNumber())) {
        Element partNumber = titleInfo.addElement(new QName("partNumber", modsNs));
        partNumber.addText(getPartNumber());
    }

    Element originInfo = mods.addElement(new QName("originInfo", modsNs));
    Element dateIssued = originInfo.addElement(new QName("dateIssued", modsNs));
    if (isNotNullOrEmpty(getDateOrIntPartName())) {
        dateIssued.addText(getDateOrIntPartName());
    } else {
        dateIssued.addAttribute("qualifier", "approximate");
    }

    addRootPublisher(originInfo);
    addRootPlace(originInfo);
    originInfo.addElement(new QName("issuance", modsNs)).addText("continuing");

    addRootPhysicalDescriptionForm(mods);
    Element locationEl = mods.addElement(new QName("location", modsNs));
    addLocation(locationEl);
    addRootPhysicalLocation(locationEl, false);
    addRootRecordInfo(mods.addElement(new QName("recordInfo", modsNs)));

    Element partEl = mods.addElement(new QName("part", modsNs));
    partEl.addAttribute("type", "volume");
    Element detailEl = partEl.addElement(new QName("detail", modsNs));
    detailEl.addAttribute("type", "volume");
    if (isNotNullOrEmpty(getPartNumber()))
        detailEl.addElement(new QName("number", modsNs)).addText(getPartNumber());//"volume number: " + getPartNumber());
    if (getBundle().getMarc() != null && isNotNullOrEmpty(getBundle().getMarc().getDateIssued()))
        partEl.addElement(new QName("date", modsNs))
                .addText(getDateOrIntPartName() != null ? getDateOrIntPartName()
                        : getBundle().getMarc().getDateIssued());

    Element genre = mods.addElement(new QName("genre", modsNs));
    genre.addText("volume");

    if (isNotNullOrEmpty(getNoteOrIntSubtitle())) {
        Element physicalDescription = mods.addElement(new QName("physicalDescription", modsNs));
        Element noteEl = physicalDescription.addElement(new QName("note", modsNs));
        noteEl.addText(getNoteOrIntSubtitle());
    }

    addRootLanguage(mods);
    addIdentifierUuid(mods, getUuid());

    appendDatastream(DATASTREAM_CONTROLGROUP.X, DATASTREAM_ID.BIBLIO_MODS, modsCollection, null, null);

}