import org.simantics.db.layer0.util.TGTransferableGraphSource;
import org.simantics.db.service.XSupport;
import org.simantics.graph.db.IImportAdvisor;
+import org.simantics.graph.db.ImportResult;
import org.simantics.graph.db.MissingDependencyException;
import org.simantics.graph.db.TransferableGraphException;
import org.simantics.graph.representation.Identity;
}
- @SuppressWarnings("deprecation")
public static Collection<MigrationStep> getMigrationSteps(DataContainer header) throws DatabaseException {
return SimanticsInternal.sync(new BinaryRead<String,Integer,Collection<MigrationStep>>(header.format, header.version) {
return t != null ? t : defaultValue;
}
- public static Resource importSharedOntology(Session session, TransferableGraph1 tg, boolean published) throws DatabaseException {
+ public static MigratedImportResult importSharedOntology(Session session, TransferableGraph1 tg, boolean published) throws DatabaseException {
return importSharedOntology(null, session, tg, published);
}
- public static Resource importSharedOntology(IProgressMonitor monitor, Session session, TransferableGraph1 tg, boolean published) throws DatabaseException {
+ public static MigratedImportResult importSharedOntology(IProgressMonitor monitor, Session session, TransferableGraph1 tg, boolean published) throws DatabaseException {
if(monitor == null) monitor = new NullProgressMonitor();
Collection<Identity> roots = TransferableGraphUtils.getRoots(tg);
if(roots.size() == 1) {
try {
-
TGTransferableGraphSource tgSource = new TGTransferableGraphSource(tg);
SharedOntologyImportAdvisor advisor = new SharedOntologyImportAdvisor(published);
state.setProperty(MigrationStateKeys.PROGRESS_MONITOR, monitor);
state.setProperty(MigrationStateKeys.CURRENT_DATA_CONTAINER, new DataContainer("sharedLibrary", 1, new Variant(TransferableGraph1.BINDING, tg)));
- return MigrationUtils.importMigrated(monitor, session, null, state, advisor, null);
-
+ MigrationUtils.importMigrated(monitor, session, null, state, advisor, null);
+
+ Collection<Resource> resultRoots = state.getProperty(MigrationStateKeys.CURRENT_ROOT_RESOURCES);
+ ImportResult result = state.getProperty(MigrationStateKeys.IMPORT_RESULT);
+ return new MigratedImportResult(resultRoots, result);
} catch (TransferableGraphException e) {
throw new DatabaseException(e);
} catch (MissingDependencyException e) {