Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[epf-dev] EPF API and variability

Hello All,

I have started developing a plugin to export content from EPF as a single file, in various formats (HTML, Excel, FreeMind, MindManager, etc). To make a long story short, we do this because RMC+BIRT is too cumbersome, and requires some _javascript_ code anyway.

One aspect I looked into is how to get to the main description of an element when variability is in the model. Code snippet #1 below shows how I am doing this today.

Another aspect is how to get to the elements categorized in a custom category, again with variability. This one does not work.

So far I have been learning by trials and errors, and guessing the API, so there may be mistakes in the code below, or else I am just not using the right API.

I am looking for guidance on which API I should be using for extracting valid information from the model, including when variability is used, as I cannot make for the categorized elements. 

If this is not the right forum, please redirect me to the right place.

Thank You.

Régis Coqueret

PS:
Code snippet #1 (works)
public static String getDescribableElementMainDescription(DescribableElement calce) {
// DescribableElement calce is supposed to have been calculated
if (calce != null) {
// get content description (a.k.a. presentation)
ContentDescription contentDescription = calce.getPresentation(); // ContentDescription extends MethodUnit extends MethodElement
// get calculated description
ContentDescription calcDescription = (ContentDescription) ConfigurationHelper.getCalculatedElement(contentDescription, currentConfiguration);
// attribute to get main description
EAttribute attrMainDesc = UmaPackage.eINSTANCE.getContentDescription_MainDescription();
// calculated object, that has variability in it
Object calcMainDescObj = ConfigurationHelper.calcAttributeFeatureValue(calcDescription, attrMainDesc, currentConfiguration);
// main description string
return calcMainDescObj.toString();
} else {
return "";
}
}

Code snippet #2 (doe NOT work):
public static List<DescribableElement> getCustomCategoryCategorizedElements(CustomCategory cc) {
EReference reference = UmaPackage.eINSTANCE.getCustomCategory_CategorizedElements();
ElementRealizer realizer = DefaultElementRealizer.newElementRealizer(currentConfiguration);
List<MethodElement> theList = (List<MethodElement>) ConfigurationHelper.calc0nFeatureValue(cc, reference, realizer);
return ConfigurationHelper.getCalculatedElements(theList, currentConfiguration);
}



Back to the top