Read EDFs
To programmatically read an EDF on a model e.g. Book, use the following syntax:
Book book = Services.get(ModelDataService.
class
).readById(Book.
class
,
10000
, userContext);
//Access EDFs
//string or string enumeration value
String sampleValue = (String) book.getAttribute(
"EPT.BookstoreEPT.TestString"
);
//nuumber value
Double doubleValue = (Double) book.getAttribute(
"EPT.BookstoreEPT.TestDouble"
);
Integer integerValue = (Integer) book.getAttribute(
"EPT.BookstoreEPT.TestInteger"
);
//duration value
DurationValue durationValue = (DurationValue) book.getAttribute(
"EPT.BookstoreEPT.TestDuration"
);
String value = durationValue.getValue();
//ModelLink field value
ModelLinkAttributeValue modelLinkValue = (ModelLinkAttributeValue) book.getAttribute(
"EPT.BookstoreEPT.TestDuration"
);
String modelLinkCompValue = modelLinkValue.get(
"EPT.BookstoreEPT.TestModelLinkName"
);
If you have selected EDFs in your view and user's role has access to the EPT then only those EDFs will be fetched selected in the view.
If you use generic read or readById and user's role has access to the EPT then all the EDFs will be fetched for that model.