Search in sources :

Example 1 with Rights

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

the class Publication method addRights.

/**
 * Adds a optional <i>rights</i> specification to the publication.
 *
 * @param id
 *            identifier or <code>null</code>
 * @param lang
 *            the language code or <code>null</code>
 * @param value
 *            the rights text
 * @return the new rights element
 */
public Rights addRights(String id, Locale lang, String value) {
    if (value == null) {
        // $NON-NLS-1$
        throw new IllegalArgumentException("A value must be specified");
    }
    log(// $NON-NLS-1$
    MessageFormat.format(// $NON-NLS-1$
    Messages.getString("OPSPublication.14"), // $NON-NLS-1$
    value, // $NON-NLS-1$
    lang == null ? Messages.getString("OPSPublication.3") : lang.getDisplayName()), // $NON-NLS-1$
    Severity.VERBOSE, indent);
    Rights dc = DCFactory.eINSTANCE.createRights();
    setDcLocalized(dc, id, lang, value);
    opfPackage.getMetadata().getRights().add(dc);
    return dc;
}
Also used : Rights(org.eclipse.mylyn.docs.epub.dc.Rights)

Example 2 with Rights

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

the class PublicationProxy method getRights.

@SuppressWarnings("rawtypes")
public String getRights() {
    EList<Rights> rights = publication.getPackage().getMetadata().getRights();
    if (rights.size() > 0) {
        FeatureMap fm = rights.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) Rights(org.eclipse.mylyn.docs.epub.dc.Rights)

Aggregations

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