Search in sources :

Example 6 with FeatureMap

use of org.eclipse.emf.ecore.util.FeatureMap in project mylyn.docs by eclipse.

the class PublicationProxy method getLanguage.

@SuppressWarnings("rawtypes")
public String getLanguage() {
    EList<Language> languages = publication.getPackage().getMetadata().getLanguages();
    if (languages.size() > 0) {
        FeatureMap fm = languages.get(0).getMixed();
        Object o = fm.get(TEXT, false);
        if (o instanceof FeatureEList) {
            if (((FeatureEList) o).size() > 0) {
                String iso639 = ((FeatureEList) o).get(0).toString();
                Locale l = new Locale(iso639);
                return l.getDisplayLanguage();
            }
        }
    }
    return EMPTY_STRING;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) FeatureEList(org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList) Locale(java.util.Locale) Language(org.eclipse.mylyn.docs.epub.dc.Language)

Example 7 with FeatureMap

use of org.eclipse.emf.ecore.util.FeatureMap in project mylyn.docs by eclipse.

the class PublicationProxy method getPublicationDate.

@SuppressWarnings("rawtypes")
public String getPublicationDate() {
    EList<Date> dates = publication.getPackage().getMetadata().getDates();
    if (dates.size() > 0) {
        for (Date date : dates) {
            if (date.getEvent().equals("publication")) {
                // $NON-NLS-1$
                FeatureMap fm = date.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) Date(org.eclipse.mylyn.docs.epub.dc.Date)

Example 8 with FeatureMap

use of org.eclipse.emf.ecore.util.FeatureMap in project mylyn.docs by eclipse.

the class PublicationProxy method getTitle.

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

Example 9 with FeatureMap

use of org.eclipse.emf.ecore.util.FeatureMap in project mylyn.docs by eclipse.

the class AbstractTest method getText.

@SuppressWarnings("rawtypes")
public String getText(DCType identifier) {
    FeatureMap fm = identifier.getMixed();
    Object o = fm.get(TEXT, false);
    if (o instanceof FeatureEList) {
        if (((FeatureEList) o).size() > 0) {
            return ((FeatureEList) o).get(0).toString();
        }
    }
    return null;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) FeatureEList(org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList)

Example 10 with FeatureMap

use of org.eclipse.emf.ecore.util.FeatureMap in project mylyn.docs by eclipse.

the class AbstractTest method getText.

@SuppressWarnings("rawtypes")
public String getText(Identifier element) {
    FeatureMap fm = element.getMixed();
    Object o = fm.get(TEXT, false);
    if (o instanceof FeatureEList) {
        if (((FeatureEList) o).size() > 0) {
            return ((FeatureEList) o).get(0).toString();
        }
    }
    return null;
}
Also used : FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) FeatureEList(org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList)

Aggregations

FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)25 FeatureEList (org.eclipse.emf.ecore.util.FeatureMapUtil.FeatureEList)10 List (java.util.List)8 ExtensionAttributeValue (org.eclipse.bpmn2.ExtensionAttributeValue)8 ArrayList (java.util.ArrayList)5 EList (org.eclipse.emf.common.util.EList)5 EObject (org.eclipse.emf.ecore.EObject)5 MetaDataType (org.jboss.drools.MetaDataType)5 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)4 Iterator (java.util.Iterator)3 ListIterator (java.util.ListIterator)3 RandomAccess (java.util.RandomAccess)3 InternalEObject (org.eclipse.emf.ecore.InternalEObject)3 AbstractSequentialInternalEList (org.eclipse.emf.ecore.util.AbstractSequentialInternalEList)3 InternalEList (org.eclipse.emf.ecore.util.InternalEList)3 BPSimDataType (bpsim.BPSimDataType)2 HashMap (java.util.HashMap)2 Entry (java.util.Map.Entry)2 Relationship (org.eclipse.bpmn2.Relationship)2 EStructuralFeatureImpl (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl)2