use of org.eclipse.mylyn.docs.epub.dc.Creator in project mylyn.docs by eclipse.
the class Publication method addCreator.
/**
* Specifies a new creator for the publication.
*
* @param id
* a unique identifier or <code>null</code>
* @param lang
* the language code or <code>null</code>
* @param name
* name of the creator
* @param role
* the role or <code>null</code>
* @param fileAs
* name to file the creator under or <code>null</code>
* @return the new creator
*/
public Creator addCreator(String id, Locale lang, String name, Role role, String fileAs) {
log(// $NON-NLS-1$
MessageFormat.format(// $NON-NLS-1$
Messages.getString("OPSPublication.4"), // $NON-NLS-1$
name, // $NON-NLS-1$
role, lang == null ? // $NON-NLS-1$
Messages.getString("OPSPublication.3") : lang.getDisplayName()), Severity.VERBOSE, indent);
Creator dc = DCFactory.eINSTANCE.createCreator();
setDcLocalized(dc, id, lang, name);
if (role != null) {
dc.setRole(role);
}
if (fileAs != null) {
dc.setFileAs(fileAs);
}
opfPackage.getMetadata().getCreators().add(dc);
return dc;
}
use of org.eclipse.mylyn.docs.epub.dc.Creator in project mylyn.docs by eclipse.
the class PublicationProxy method getCreator.
/**
* Returns the name of the first instance of an {@link Creator} in the publication. If a value has not been assigned
* an empty string will be returned.
*
* @return the creator name
*/
@SuppressWarnings("rawtypes")
public String getCreator() {
EList<Creator> creators = publication.getPackage().getMetadata().getCreators();
if (creators.size() > 0) {
FeatureMap fm = creators.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