private boolean containsBusinessObjectType(final List<Instance> datatypes) { for (final Instance dt : datatypes) { if (dt.instanceOf("process.BusinessObjectType")) { return true; } } return false; }
private Instance aConnectorInstance(final String definitionId, final String definitionVersion) { final Instance instance = mock(Instance.class); when(instance.get(UpdateConnectorVersionMigration.DEFINITION_ID_FEATURE_NAME)) .thenReturn(definitionId); when(instance.get(UpdateConnectorVersionMigration.DEFINITION_VERSION_FEATURE_NAME)) .thenReturn(definitionVersion); return instance; }
/* (non-Javadoc) * @see org.eclipse.emf.edapt.migration.CustomMigration#migrateAfter(org.eclipse.emf.edapt.spi.migration.Model, org.eclipse.emf.edapt.migration.Metamodel) */ @Override public void migrateAfter(final Model model, final Metamodel metamodel) throws MigrationException { for (final Instance diagramInstance : model.getAllInstances("process.MainProcess")) { final List<Instance> datatypes = diagramInstance.get("datatypes"); if (!containsBusinessObjectType(datatypes)) { final Instance datatypeInstance = model.newInstance("process.BusinessObjectType"); datatypeInstance.set("name", NamingUtils.convertToId(DataTypeLabels.businessObjectType)); diagramInstance.add("datatypes", datatypeInstance); } } }
@Override public void migrateBefore(Model model, Metamodel metamodel) throws MigrationException { for (Instance group : model.getAllInstances("process.Group")) { addReportChange( (String) group.get("name"), Messages.actorSelector, group.getContainer().getUuid(), Messages.removeGroupMigrationDescription, Messages.actorProperty, IStatus.ERROR); model.delete(group); } for (Instance assignable : model.getAllInstances("process.Assignable")) { final List<Instance> filters = assignable.get("filters"); for (Instance filter : filters) { addReportChange( (String) filter.get("name"), Messages.actorSelector, filter.getContainer().getUuid(), Messages.removeFilterMigrationDescription, Messages.actorProperty, IStatus.ERROR); model.delete(filter); } } }