Search in sources :

Example 1 with Identifier

use of org.eclipse.mylyn.docs.epub.dc.Identifier in project mylyn.docs by eclipse.

the class Publication method addIdentifier.

/**
 * Adds a new identifier to the publication.
 *
 * @param id
 *            the identifier id
 * @param scheme
 *            the scheme used for representing the identifier
 * @param value
 *            the identifier value
 * @return the new identifier
 */
public Identifier addIdentifier(String id, String scheme, String value) {
    if (value == null) {
        // $NON-NLS-1$
        throw new IllegalArgumentException("A value must be specified");
    }
    Identifier dc = DCFactory.eINSTANCE.createIdentifier();
    dc.setId(id);
    dc.setScheme(scheme);
    FeatureMapUtil.addText(dc.getMixed(), value);
    opfPackage.getMetadata().getIdentifiers().add(dc);
    return dc;
}
Also used : Identifier(org.eclipse.mylyn.docs.epub.dc.Identifier)

Example 2 with Identifier

use of org.eclipse.mylyn.docs.epub.dc.Identifier in project mylyn.docs by eclipse.

the class PublicationProxy method getIdentifier.

@SuppressWarnings("rawtypes")
public String getIdentifier() {
    EList<Identifier> identifiers = publication.getPackage().getMetadata().getIdentifiers();
    if (identifiers.size() > 0) {
        FeatureMap fm = identifiers.get(0).getMixed();
        Object o = fm.get(TEXT, false);
        if (o instanceof FeatureEList) {
            if (((FeatureEList) o).size() > 0) {
                return ((FeatureEList) o).get(0).toString();
            }
        }
    }
    return EMPTY_STRING;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) FeatureEList(org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList) Identifier(org.eclipse.mylyn.docs.epub.dc.Identifier)

Aggregations

Identifier (org.eclipse.mylyn.docs.epub.dc.Identifier)2 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)1 FeatureEList (org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList)1