@Test
  public void testCustomonnectorMigrationWithGetterCustom() throws Exception {
    final URL url = TestCustomConnectorMigrationUseCase.class.getResource("fab--1.0.bar");
    final File migratedProc = BarImporterTestUtil.migrateBar(url);
    assertNotNull("Fail to migrate bar file", migratedProc);
    assertNotNull("Fail to migrate bar file", migratedProc.exists());
    final Resource resource = BarImporterTestUtil.assertIsLoadable(migratedProc);
    final MainProcess mainProc = BarImporterTestUtil.getMainProcess(resource);

    final ConnectorDefRepositoryStore defStore =
        (ConnectorDefRepositoryStore)
            RepositoryManager.getInstance().getRepositoryStore(ConnectorDefRepositoryStore.class);
    assertNotNull(defStore.getDefinition("fabulous_connector", "1.0.0"));

    final ConnectorImplRepositoryStore implStore =
        (ConnectorImplRepositoryStore)
            RepositoryManager.getInstance().getRepositoryStore(ConnectorImplRepositoryStore.class);
    ConnectorImplementation implementation =
        implStore.getImplementation("fabulous_connector-impl", "1.0.0");
    assertNotNull(implementation);

    final ConnectorSourceRepositoryStore sourceStore =
        (ConnectorSourceRepositoryStore)
            RepositoryManager.getInstance()
                .getRepositoryStore(ConnectorSourceRepositoryStore.class);
    assertNotNull(sourceStore.getChild(implementation.getImplementationClassname()));

    final List<Connector> connectors =
        ModelHelper.getAllItemsOfType(mainProc, ProcessPackage.Literals.CONNECTOR);
    assertEquals("Invalid number of connector", 1, connectors.size());
  }
 public ConnectorDefinitionWizardDialog(Shell parentShell, IWizard newWizard) {
   super(
       parentShell,
       newWizard,
       RepositoryManager.getInstance().getRepositoryStore(ConnectorConfRepositoryStore.class),
       RepositoryManager.getInstance().getRepositoryStore(ConnectorDefRepositoryStore.class),
       (IImplementationRepositoryStore)
           RepositoryManager.getInstance().getRepositoryStore(ConnectorImplRepositoryStore.class));
 }
 @Test
 public void testIdRenameEdit() throws Exception {
   final String id = "testEdit";
   final String version = "1.0.0";
   final String id2 = "testEdit2";
   SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot);
   SWTBotConnectorTestUtil.createConnectorDefinition(bot, id, version);
   bot.button(IDialogConstants.FINISH_LABEL).click();
   SWTBotConnectorTestUtil.activateConnectorDefEditionShell(bot);
   bot.tree().setFocus();
   bot.waitUntil(
       Conditions.widgetIsEnabled(
           bot.tree()
               .select("Uncategorized")
               .expandNode("Uncategorized")
               .select(id + " (" + version + ")")),
       10000);
   bot.tree().expandNode("Uncategorized").select(id + " (" + version + ")");
   bot.button(Messages.Edit).click();
   assertEquals(bot.textWithLabel("Definition id *").getText(), id);
   assertEquals(bot.textWithLabel("Version *").getText(), version);
   bot.textWithLabel("Definition id *").setText(id2);
   bot.button(IDialogConstants.FINISH_LABEL).click();
   ConnectorDefRepositoryStore store =
       (ConnectorDefRepositoryStore)
           RepositoryManager.getInstance().getRepositoryStore(ConnectorDefRepositoryStore.class);
   ConnectorDefinition connectorDef = store.getDefinition(id, version);
   ConnectorDefinition connectorDef2 = store.getDefinition(id2, version);
   assertNull("the connectorDef with previous id shouldn't exist anymore", connectorDef);
   assertNotNull("the connectorDef with new id does not exist", connectorDef2);
   removeConnectorDefinition(id2, version);
 }
 @Override
 protected DefinitionResourceProvider getDefinitionResourceProvider() {
   final IRepositoryStore<?> defStore =
       RepositoryManager.getInstance().getRepositoryStore(ConnectorDefRepositoryStore.class);
   return DefinitionResourceProvider.getInstance(
       defStore, ConnectorPlugin.getDefault().getBundle());
 }
    /* (non-Javadoc)
     * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
     */
    @Override
    protected IContributionItem[] getContributionItems() {
      final List<IContributionItem> res = new ArrayList<IContributionItem>();
      IRepository repository = RepositoryManager.getInstance().getCurrentRepository();
      diagramSotre =
          (DiagramRepositoryStore) repository.getRepositoryStore(DiagramRepositoryStore.class);
      try {
        for (AbstractProcess process : diagramSotre.getAllProcesses()) {
          if (process.getName().equals(subprocessName)) {
            Map<String, String> params = new HashMap<String, String>();
            params.put(OpenSpecificProcessCommand.PARAMETER_PROCESS_NAME, process.getName());
            params.put(OpenSpecificProcessCommand.PARAMETER_PROCESS_VERSION, process.getVersion());
            CommandContributionItemParameter param =
                new CommandContributionItemParameter(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
                    null,
                    OpenSpecificProcessCommand.ID,
                    CommandContributionItem.STYLE_PUSH);
            param.parameters = params;
            param.label = process.getVersion();
            param.visibleEnabled = true;
            param.commandId = OpenSpecificProcessCommand.ID;
            CommandContributionItem commandContributionItem = new CommandContributionItem(param);
            commandContributionItem.setVisible(true);
            res.add(commandContributionItem);
          }
        }

      } catch (Exception ex) {
        BonitaStudioLog.error(ex);
      }
      return res.toArray(new IContributionItem[res.size()]);
    }
 @Override
 protected List<ConnectorImplementation> getAllImplementations(String defId, String defVersion) {
   final ConnectorImplRepositoryStore store =
       (ConnectorImplRepositoryStore)
           RepositoryManager.getInstance().getRepositoryStore(ConnectorImplRepositoryStore.class);
   return store.getImplementations(defId, defVersion);
 }
 @Test
 public void testAssociationCreated() {
   final DatabaseConnectorPropertiesRepositoryStore repo =
       RepositoryManager.getInstance()
           .getRepositoryStore(DatabaseConnectorPropertiesRepositoryStore.class);
   assertThat(repo.getChild(DriverConstants.POSTGRES_DEFINITION_ID + ".properties")).isNotNull();
   assertThat(repo.getChild(DriverConstants.ORACLE_11G_DEFINITION_ID + ".properties")).isNotNull();
 }
 /* (non-Javadoc)
  * @see org.bonitasoft.studio.configuration.AbstractConnectorConfigurationSynchronizer#updateJarDependencies(org.bonitasoft.studio.model.configuration.FragmentContainer, org.bonitasoft.studio.connector.model.implementation.ConnectorImplementation, org.eclipse.emf.edit.domain.EditingDomain, org.eclipse.emf.common.command.CompoundCommand)
  */
 @Override
 protected void updateJarDependencies(
     FragmentContainer connectorContainer,
     ConnectorImplementation implementation,
     EditingDomain editingDomain,
     CompoundCommand cc,
     boolean forceDriver) {
   super.updateJarDependencies(connectorContainer, implementation, editingDomain, cc, forceDriver);
   store =
       (DatabaseConnectorPropertiesRepositoryStore)
           RepositoryManager.getInstance()
               .getRepositoryStore(DatabaseConnectorPropertiesRepositoryStore.class);
   DatabaseConnectorPropertiesFileStore fileStore =
       (DatabaseConnectorPropertiesFileStore)
           store.getChild(
               implementation.getDefinitionId()
                   + "."
                   + DatabaseConnectorPropertiesRepositoryStore.CONF_EXT);
   if (fileStore != null) {
     String defaultDriver = fileStore.getDefault();
     List<String> jars = fileStore.getJarList();
     boolean autoAddDriver = fileStore.getAutoAddDriver() || forceDriver;
     Configuration conf = (Configuration) connectorContainer.eContainer().eContainer();
     FragmentContainer otherDependencies = null;
     for (FragmentContainer c : conf.getProcessDependencies()) {
       if (FragmentTypes.OTHER.equals(c.getId())) {
         otherDependencies = c;
       }
     }
     for (String jar : jars) {
       boolean exists = false;
       for (Fragment dep : otherDependencies.getFragments()) {
         if (dep.getValue().equals(jar)) {
           exists = true;
           break;
         }
       }
       if (!exists) {
         Fragment depFragment = ConfigurationFactory.eINSTANCE.createFragment();
         if (jar.equals(defaultDriver) && autoAddDriver) {
           depFragment.setExported(true);
         } else {
           depFragment.setExported(false);
         }
         depFragment.setKey(jar);
         depFragment.setValue(jar);
         depFragment.setType(FragmentTypes.JAR);
         cc.append(
             AddCommand.create(
                 editingDomain,
                 otherDependencies,
                 ConfigurationPackage.Literals.FRAGMENT_CONTAINER__FRAGMENTS,
                 depFragment));
       }
     }
   }
 }
Ejemplo n.º 9
0
 @Test
 public void testXSDImport() throws IOException {
   XSDRepositoryStore xsdStore =
       (XSDRepositoryStore)
           RepositoryManager.getInstance().getRepositoryStore(XSDRepositoryStore.class);
   int countBefore = xsdStore.getChildren().size();
   String xsdFilePath = createXSDFileToImport();
   XSDImport.importXSD(xsdFilePath);
   int countAfter = xsdStore.getChildren().size();
   Assert.assertEquals("XSD import doesn't work", countBefore + 1, countAfter);
 }
Ejemplo n.º 10
0
 @BonitaAPI
 public static void importXSD(String filePath) {
   File file = new File(filePath);
   XSDRepositoryStore xsdStore =
       (XSDRepositoryStore)
           RepositoryManager.getInstance().getRepositoryStore(XSDRepositoryStore.class);
   IRepositoryFileStore fileStore = xsdStore.createRepositoryFileStore(file.getName());
   Resource resource =
       new XSDResourceFactoryImpl().createResource(URI.createFileURI(file.getAbsolutePath()));
   try {
     resource.load(Collections.EMPTY_MAP);
   } catch (IOException e1) {
     BonitaStudioLog.error(e1);
   }
   if (!resource.getContents().isEmpty()) {
     XSDSchema content = (XSDSchema) resource.getContents().get(0);
     fileStore.save(content);
   }
 }
Ejemplo n.º 11
0
 public Configuration getConfiguration(final AbstractProcess process, String configurationId) {
   Configuration configuration = null;
   final ProcessConfigurationRepositoryStore processConfStore =
       RepositoryManager.getInstance()
           .getRepositoryStore(ProcessConfigurationRepositoryStore.class);
   if (configurationId == null) {
     configurationId =
         ConfigurationPlugin.getDefault()
             .getPreferenceStore()
             .getString(ConfigurationPreferenceConstants.DEFAULT_CONFIGURATION);
   }
   if (configurationId.equals(ConfigurationPreferenceConstants.LOCAL_CONFIGURAITON)) {
     final String id = ModelHelper.getEObjectID(process);
     IRepositoryFileStore file = processConfStore.getChild(id + ".conf");
     if (file == null) {
       file = processConfStore.createRepositoryFileStore(id + ".conf");
       configuration = ConfigurationFactory.eINSTANCE.createConfiguration();
       configuration.setName(configurationId);
       configuration.setVersion(ModelVersion.CURRENT_VERSION);
       file.save(configuration);
     }
     try {
       configuration = (Configuration) file.getContent();
     } catch (final ReadFileStoreException e) {
       BonitaStudioLog.error("Failed to read process configuration", e);
     }
   } else {
     for (final Configuration conf : process.getConfigurations()) {
       if (configurationId.equals(conf.getName())) {
         configuration = conf;
       }
     }
   }
   if (configuration == null) {
     configuration = ConfigurationFactory.eINSTANCE.createConfiguration();
     configuration.setName(configurationId);
     configuration.setVersion(ModelVersion.CURRENT_VERSION);
   }
   // Synchronize configuration with definition
   new ConfigurationSynchronizer(process, configuration).synchronize();
   return configuration;
 }
  @Test
  public void testAddCategory() throws Exception {
    final String id = "testEdit4";
    final String version = "1.0.0";

    SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot);
    SWTBotConnectorTestUtil.createConnectorDefinition(bot, id, version);
    bot.button(IDialogConstants.FINISH_LABEL).click();
    SWTBotConnectorTestUtil.activateConnectorDefEditionShell(bot);
    bot.tree().setFocus();
    bot.waitUntil(
        Conditions.widgetIsEnabled(
            bot.tree().expandNode("Uncategorized").select(id + " (" + version + ")")),
        10000);
    bot.tree()
        .select("Uncategorized")
        .expandNode("Uncategorized")
        .select(id + " (" + version + ")");
    bot.button(Messages.Edit).click();
    bot.treeWithLabel(Messages.categoryLabel).select(0);
    bot.button(IDialogConstants.FINISH_LABEL).click();
    ConnectorDefRepositoryStore store =
        (ConnectorDefRepositoryStore)
            RepositoryManager.getInstance().getRepositoryStore(ConnectorDefRepositoryStore.class);
    ConnectorDefinition connectorDef = store.getDefinition(id, version);
    assertEquals("category size should be equal to 1", 1, connectorDef.getCategory().size());
    DefinitionResourceProvider messageProvider =
        DefinitionResourceProvider.getInstance(store, ConnectorPlugin.getDefault().getBundle());
    SWTBotConnectorTestUtil.activateConnectorDefEditionShell(bot);
    final Category category = connectorDef.getCategory().get(0);
    String categoryLabel = messageProvider.getCategoryLabel(category);
    if (categoryLabel == null) {
      categoryLabel = category.getId();
    }
    final String connectorLabel =
        new ConnectorDefinitionTreeLabelProvider(messageProvider).getText(connectorDef);
    assertNotNull(
        "could not find " + connectorLabel,
        bot.tree().getTreeItem(categoryLabel).expand().getNode(connectorLabel));
    bot.button(IDialogConstants.CANCEL_LABEL).click();
  }
 protected IRepositoryStore getImplementationStore() {
   return RepositoryManager.getInstance().getRepositoryStore(ConnectorImplRepositoryStore.class);
 }
 protected SourceRepositoryStore getSourceStore() {
   return (SourceRepositoryStore)
       RepositoryManager.getInstance().getRepositoryStore(ConnectorSourceRepositoryStore.class);
 }
 @Override
 public void sessionStarted() {
   javaProject = RepositoryManager.getInstance().getCurrentRepository().getJavaProject();
 }
  @Test
  public void testDeleteDiagrams() {

    final DiagramRepositoryStore diagramStore =
        RepositoryManager.getInstance().getRepositoryStore(DiagramRepositoryStore.class);

    final int nbDiagramsInRepository = diagramStore.getChildren().size();

    final SWTBotMenu diagramMenu = bot.menu("Diagram");
    final List<String> newDiagramsName = new ArrayList<String>();
    for (int i = 0; i < nbDiagrams; i++) {
      SWTBotTestUtil.createNewDiagram(bot);
      bot.waitUntil(Conditions.widgetIsEnabled(diagramMenu), 40000);
      newDiagramsName.add(bot.activeEditor().getTitle());
    }
    assertEquals("4 diagrams should have been created", nbDiagrams, newDiagramsName.size());

    final int nbEditors = bot.editors().size();
    final String currentDiagramName = bot.activeEditor().getTitle();
    bot.waitUntil(Conditions.widgetIsEnabled(bot.menu("Diagram")), 10000);
    bot.menu("Diagram").menu("Delete...").click();
    bot.waitUntil(Conditions.shellIsActive(Messages.DeleteDiagramWizardPage_title), 10000);

    final SWTBotTree tree = bot.tree();
    assertEquals(
        "the list of diagrams should contain 4 items",
        nbDiagramsInRepository + nbDiagrams,
        tree.getAllItems().length);

    final TableCollection selection = tree.selection();
    assertEquals(
        "only " + currentDiagramName + " should be selected in the tree viewer",
        1,
        selection.rowCount());
    assertEquals(
        "diagram " + currentDiagramName + " should be selected",
        currentDiagramName,
        selection.get(0, 0));

    //   final SWTBotTreeItem firstSwtBotTreeItem = tree.getAllItems()[1];
    //   final SWTBotTreeItem secondSwtBotTreeItem = tree.getAllItems()[2];
    //   final SWTBotTreeItem thirdSwtBotTreeItem = tree.getAllItems()[3];

    tree.select(newDiagramsName.get(1), newDiagramsName.get(2), newDiagramsName.get(3));

    bot.button(Messages.removeProcessLabel).click();

    bot.waitUntil(Conditions.shellIsActive(Messages.confirmProcessDeleteTitle));
    bot.button(IDialogConstants.YES_LABEL).click();
    bot.waitUntil(
        new ICondition() {

          @Override
          public boolean test() throws Exception {
            return nbEditors - 3 == bot.editors().size();
          }

          @Override
          public void init(final SWTBot bot) {}

          @Override
          public String getFailureMessage() {
            return "editors have not been closed after deleted diagrams";
          }
        },
        40000,
        100);

    assertEquals(
        "deleted diagrams are still in repository",
        nbDiagramsInRepository + 1,
        diagramStore.getChildren().size());
  }
  protected IStatus addDependencies(ConnectorImplementation impl, IFolder classpathFolder)
      throws CoreException {
    final IDefinitionRepositoryStore store = (IDefinitionRepositoryStore) getDefinitionStore();
    final DependencyRepositoryStore depStore =
        (DependencyRepositoryStore)
            RepositoryManager.getInstance().getRepositoryStore(DependencyRepositoryStore.class);
    final DefinitionResourceProvider resourceProvider =
        DefinitionResourceProvider.getInstance(getDefinitionStore(), getBundle());

    ConnectorDefinition def =
        store.getDefinition(impl.getDefinitionId(), impl.getDefinitionVersion());
    for (String jarName : def.getJarDependency()) {
      if (ignoredLibs.contains(jarName)) {
        continue;
      }
      IRepositoryFileStore file = depStore.getChild(jarName);
      if (file != null) {
        if (file.getResource().exists()) {
          if (!classpathFolder.getFile(file.getName()).exists()) {
            try {
              file.getResource()
                  .copy(
                      classpathFolder.getFullPath().append(file.getName()),
                      true,
                      Repository.NULL_PROGRESS_MONITOR);
            } catch (CoreException e) {
              BonitaStudioLog.error(e);
            }
          }
        }
      } else { // Search in provided jars
        InputStream is = resourceProvider.getDependencyInputStream(jarName);
        if (is != null) {
          IFile jarFile = classpathFolder.getFile(jarName);
          if (!jarFile.exists()) {
            jarFile.create(is, true, Repository.NULL_PROGRESS_MONITOR);
          }
        } else {
          return ValidationStatus.error(Messages.bind(Messages.implementationDepNotFound, jarName));
        }
      }
    }
    for (String jarName : impl.getJarDependencies().getJarDependency()) {
      if (ignoredLibs.contains(jarName)) {
        continue;
      }
      IRepositoryFileStore file = depStore.getChild(jarName);
      if (file != null) {
        if (file.getResource().exists()) {
          if (!classpathFolder.getFile(file.getName()).exists()) {
            try {
              file.getResource()
                  .copy(
                      classpathFolder.getFullPath().append(file.getName()),
                      true,
                      Repository.NULL_PROGRESS_MONITOR);
            } catch (CoreException e) {
              BonitaStudioLog.error(e);
            }
          }
        }
      } else { // Search in provided jars
        InputStream is = resourceProvider.getDependencyInputStream(jarName);
        if (is != null) {
          IFile jarFile = classpathFolder.getFile(jarName);
          if (!jarFile.exists()) {
            jarFile.create(is, true, Repository.NULL_PROGRESS_MONITOR);
          }
        } else {
          return ValidationStatus.error(Messages.bind(Messages.implementationDepNotFound, jarName));
        }
      }
    }
    return Status.OK_STATUS;
  }
  /* (non-Javadoc)
   * @see org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution#createControl(org.eclipse.swt.widgets.Composite, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory, org.bonitasoft.studio.common.properties.ExtensibleGridPropertySection)
   */
  public void createControl(
      final Composite composite,
      TabbedPropertySheetWidgetFactory widgetFactory,
      ExtensibleGridPropertySection extensibleGridPropertySection) {
    composite.setLayout(new GridLayout(3, false));

    cCombo = widgetFactory.createCCombo(composite, SWT.BORDER);
    cCombo.setLayoutData(GridDataFactory.swtDefaults().hint(200, SWT.DEFAULT).create());
    final SimulationLoadProfileRepositoryStore profileStore =
        RepositoryManager.getInstance()
            .getRepositoryStore(SimulationLoadProfileRepositoryStore.class);
    for (IRepositoryFileStore artifact : profileStore.getChildren()) {
      cCombo.add(artifact.getDisplayName());
    }
    cCombo.setEditable(false);
    Button editLoadProfile = new Button(composite, SWT.FLAT);
    editLoadProfile.setText(Messages.edit);
    editLoadProfile.addSelectionListener(
        new SelectionAdapter() {
          /* (non-Javadoc)
           * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
           */
          @Override
          public void widgetSelected(SelectionEvent e) {
            EditSimulationLoadProfileWizard wizard =
                new EditSimulationLoadProfileWizard(
                    profileStore.getChild(
                        cCombo.getText()
                            + "."
                            + SimulationLoadProfileRepositoryStore.SIMULATION_LOADPROFILE_EXT));
            new CustomWizardDialog(Display.getCurrent().getActiveShell(), wizard).open();
          }
        });
    Button createLoadProfile = new Button(composite, SWT.FLAT);
    createLoadProfile.setText(Messages.create);
    createLoadProfile.addSelectionListener(
        new SelectionAdapter() {
          /* (non-Javadoc)
           * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
           */
          @Override
          public void widgetSelected(SelectionEvent e) {
            EditSimulationLoadProfileWizard wizard = new EditSimulationLoadProfileWizard();
            if (new CustomWizardDialog(Display.getCurrent().getActiveShell(), wizard).open()
                == IDialogConstants.OK_ID) {
              String id = wizard.getArtifact().getDisplayName();
              cCombo.add(id);
              cCombo.setText(id);
            }
          }
        });

    context = new EMFDataBindingContext();
    context.bindValue(
        SWTObservables.observeText(cCombo),
        EMFEditObservables.observeValue(
            editingDomain,
            eObject,
            SimulationPackage.Literals.SIMULATION_ABSTRACT_PROCESS__LOAD_PROFILE_ID));
    context.bindValue(
        SWTObservables.observeEnabled(editLoadProfile),
        SWTObservables.observeText(cCombo),
        new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
        new UpdateValueStrategy()
            .setConverter(
                new Converter(String.class, Boolean.class) {

                  public Object convert(Object fromObject) {
                    return ((String) fromObject).length() > 0;
                  }
                }));
  }
Ejemplo n.º 19
0
  /* (non-Javadoc)
   * @see org.eclipse.jface.wizard.Wizard#performFinish()
   */
  @Override
  public boolean performFinish() {
    final TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(container);
    Data workingCopy = page.getWorkingCopy();
    setDatasourceId(workingCopy, dataContainmentFeature);
    if (editMode) {
      AbstractProcess process = ModelHelper.getParentProcess(container);
      CompoundCommand cc = new CompoundCommand();
      final RefactorDataOperation op =
          new RefactorDataOperation(BonitaGroovyRefactoringAction.REFACTOR_OPERATION);
      op.setCompoundCommand(cc);
      op.setEditingDomain(editingDomain);
      op.setContainer(process);
      op.setNewData(workingCopy);
      op.setOldData(originalData);
      op.updateReferencesInScripts();
      final boolean switchingDataeClass = !originalData.eClass().equals(workingCopy.eClass());
      op.setUpdateDataReferences(switchingDataeClass);
      if (op.isCanExecute()) {
        try {

          getContainer().run(true, false, op);

        } catch (InvocationTargetException e) {
          BonitaStudioLog.error(e);
        } catch (InterruptedException e) {
          BonitaStudioLog.error(e);
        }

        if (switchingDataeClass) {
          List<?> dataList = (List<?>) container.eGet(dataContainmentFeature);
          int index = dataList.indexOf(originalData);
          cc.append(
              RemoveCommand.create(editingDomain, container, dataContainmentFeature, originalData));
          cc.append(
              AddCommand.create(
                  editingDomain, container, dataContainmentFeature, workingCopy, index));
        } else {
          for (EStructuralFeature feature : originalData.eClass().getEAllStructuralFeatures()) {
            cc.append(
                SetCommand.create(editingDomain, originalData, feature, workingCopy.eGet(feature)));
          }
        }

        editingDomain.getCommandStack().execute(cc);
      } else {
        cc.dispose();
      }
    } else {
      editingDomain
          .getCommandStack()
          .execute(
              AddCommand.create(editingDomain, container, dataContainmentFeature, workingCopy));
    }
    try {
      RepositoryManager.getInstance()
          .getCurrentRepository()
          .getProject()
          .build(
              IncrementalProjectBuilder.FULL_BUILD,
              XtextProjectHelper.BUILDER_ID,
              Collections.EMPTY_MAP,
              null);
    } catch (CoreException e) {
      BonitaStudioLog.error(e, DataPlugin.PLUGIN_ID);
    }

    return true;
  }
 protected IRepositoryStore getDefinitionStore() {
   return RepositoryManager.getInstance().getRepositoryStore(ConnectorDefRepositoryStore.class);
 }