}
public <A> A adapt(ModelData modelData, Class<A> type, boolean create) {
try {
POMSession pomSession = pomMgr.getSession();
ChromatticSession chromSession = pomSession.getSession();
// TODO: Deal with the case where modelData is not persisted before invocation to adapt
// Get the workspace object
Object o = pomSession.findObjectById(modelData.getStorageId());
A a = chromSession.getEmbedded(o, type);
if (a == null && create) {
a = chromSession.create(type);
chromSession.setEmbedded(o, type, a);
}
return a;
} catch (Exception ex) {
ex.printStackTrace();