Skip to content

Commit

Permalink
TEIIDDES-2456 after ModelResource is created, added setting of model
Browse files Browse the repository at this point in the history
type, metamodel type and iniatilzing of model's containers, then added
save to insure that the ModelResource is fully constructed prior to
adding model objects from DDL.
  • Loading branch information
blafond committed Mar 26, 2015
1 parent cbe8400 commit f279f16
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.teiid.designer.relational.compare.DifferenceGenerator;
import org.teiid.designer.relational.compare.DifferenceReport;
import org.teiid.designer.relational.model.RelationalModel;
import org.teiid.designer.relational.model.RelationalModelFactory;
import org.teiid.designer.relational.processor.EmfModelGenerator;

/**
Expand Down Expand Up @@ -183,6 +184,14 @@ void importDdl(FileReader reader, IProgressMonitor monitor, int totalWork ) thro
// ------------------------------------------------------------------------------
monitor.subTask(DdlImporterI18n.CREATING_MODEL_MSG);
model = ModelerCore.create(modelFile);

// Have to specifically set the metamodel type and properties and initialize the containers to anything downstream
// has a valid ModelResource
model.getModelAnnotation().setPrimaryMetamodelUri( RelationalModelFactory.RELATIONAL_PACKAGE_URI );
model.getModelAnnotation().setModelType(importManager.getModelType());
ModelerCore.getModelEditor().getAllContainers(model.getEmfResource());
model.save(monitor, false);

importManager.setRelationalModel(model);

RelationalModel targetRelationalModel = importManager.getObjectFactory().createRelationalModel(model);
Expand Down

0 comments on commit f279f16

Please sign in to comment.