use of org.eclipse.mylyn.docs.epub.dc.Subject in project mylyn.docs by eclipse.
the class Publication method addSubject.
/**
* Adds a required <i>subject</i> specification to the publication.
*
* @param id
* identifier or <code>null</code>
* @param lang
* the language code or <code>null</code>
* @param value
* the subject
*/
public Subject addSubject(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.18"), // $NON-NLS-1$
value, // $NON-NLS-1$
lang == null ? Messages.getString("OPSPublication.3") : lang.getDisplayName()), // $NON-NLS-1$
Severity.VERBOSE, indent);
Subject dc = DCFactory.eINSTANCE.createSubject();
setDcLocalized(dc, id, lang, value);
opfPackage.getMetadata().getSubjects().add(dc);
return dc;
}
use of org.eclipse.mylyn.docs.epub.dc.Subject in project mylyn.docs by eclipse.
the class PublicationProxy method getSubject.
@SuppressWarnings("rawtypes")
public String getSubject() {
EList<Subject> subjects = publication.getPackage().getMetadata().getSubjects();
if (subjects.size() > 0) {
FeatureMap fm = subjects.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;
}
Aggregations