Exemplo n.º 1
0
  @Override
  public void performAction() {
    Scenario scenario = (Scenario) modello.getBean(Costanti.CURRENT_SCENARIO);
    MappingTask mappingTask = scenario.getMappingTask();

    JFileChooser chooser = vista.getFileChooserApriTXT();
    File file;
    continua = true;
    while (continua) {
      int returnVal =
          chooser.showDialog(
              WindowManager.getDefault().getMainWindow(),
              NbBundle.getMessage(Costanti.class, Costanti.EXPORT_TGDS));
      if (returnVal == JFileChooser.APPROVE_OPTION) {
        file = chooser.getSelectedFile();
        if (!file.exists()) {
          saveTGDs(mappingTask, file);
        } else {
          confirmSave(mappingTask, file);
        }
      } else {
        continua = false;
      }
    }
    /*    List<FORule> foRules = mappingTask.getMappingData().getSTTgds();
    for (FORule foRule : foRules) {
        System.out.println(foRule.toLogicalString(mappingTask));
    }*/
  }
 private void creaPopUpMappingTaskTreeTargetDuplicate() {
   this.popUpMenuTargetDuplicate = new JPopupMenu();
   MappingTask mappingTask = scenario.getMappingTask();
   if (mappingTask != null) {
     this.popUpMenuTargetDuplicate.add(
         new ActionDuplicateSetNode(this, targetSchemaTree, mappingTask.getTargetProxy()));
   }
 }
 private void creaPopUpMappingTaskTreeSourceDuplicate() {
   this.popUpMenuSourceDuplicate = new JPopupMenu();
   MappingTask mappingTask = scenario.getMappingTask();
   if (mappingTask != null) {
     this.popUpMenuSourceDuplicate.add(
         new ActionDuplicateSetNode(this, sourceSchemaTree, mappingTask.getSourceProxy()));
     this.popUpMenuSourceDuplicate.add(
         new ActionSelectionCondition(this, sourceSchemaTree, mappingTask.getSourceProxy()));
   }
 }
Exemplo n.º 4
0
  @Override
  public void performAction() {
    Properties config = new Properties();
    config.setProperty(
        IComputeQuality.class.getSimpleName(),
        "it.unibas.spicy.findmappings.strategies.computequality.ComputeQualityStructuralAnalysis");
    Application.reset(config);
    executeInjection();
    mappingFinder.cleanUp();
    Scenario scenario = (Scenario) modello.getBean(Costanti.CURRENT_SCENARIO);
    MappingTask mappingTask = scenario.getMappingTask();
    if (mappingTask.getTargetProxy().getInstances().isEmpty()) {
      NotifyDescriptor nd =
          new NotifyDescriptor.Message(
              NbBundle.getMessage(Costanti.class, Costanti.WARNING_NOT_TARGET_INSTANCES),
              DialogDescriptor.WARNING_MESSAGE);
      DialogDisplayer.getDefault().notify(nd);
      return;
    }
    checkValueCorrespondenceInMappingTask(mappingTask);
    SwingWorker swingWorker =
        new SwingWorker() {

          private Scenario scenario;

          @Override
          protected Object doInBackground() throws Exception {
            scenario = (Scenario) modello.getBean(Costanti.CURRENT_SCENARIO);
            MappingTask mappingTask = scenario.getMappingTask();

            List<AnnotatedMappingTask> bestMappingTasks =
                mappingFinder.findBestMappings(mappingTask);
            modello.putBean(Costanti.BEST_MAPPING_TASKS, bestMappingTasks);
            IOProvider.getDefault().getIO(Costanti.FLUSSO_SPICY, false).select();
            return true;
          }

          @Override
          protected void done() {
            try {
              if ((Boolean) get() && !isCancelled()) {
                actionViewSpicy.performActionWithScenario(this.scenario);
                actionViewBestMappings.performActionWithScenario(this.scenario);
              }
            } catch (InterruptedException ex) {
              logger.error(ex);
            } catch (ExecutionException ex) {
              logger.error(ex);
            }
          }
        };
    swingWorker.execute();
  }
  public void createConnectionWidgets(ICreaWidgetCorrespondences correspondenceCreator) {
    this.glassPane.clearConnections();
    this.glassPane.clearConstants();
    this.glassPane.clearFunctions();
    this.glassPane.validate();
    correspondenceCreator.creaWidgetCorrespondences();
    correspondenceCreator.creaWidgetIconForSelectionCondition();

    MappingTask mappingTask = scenario.getMappingTask();
    if (mappingTask != null) {
      IDataSourceProxy source = mappingTask.getSourceProxy();
      IDataSourceProxy target = mappingTask.getTargetProxy();
      correspondenceCreator.creaWidgetFunctionalDependencies(source, true);
      correspondenceCreator.creaWidgetFunctionalDependencies(target, false);
      return;
    }
  }
 ////////////////////////////    ANALISI    ///////////////////////////
 public void drawScene(
     CreaWidgetAlberi widgetCreator, ICreaWidgetCorrespondences correspondenceCreator) {
   MappingTask mappingTask = scenario.getMappingTask();
   if (mappingTask == null) {
     this.analizzato = false;
     return;
   }
   IDataSourceProxy source = mappingTask.getSourceProxy();
   IDataSourceProxy target = mappingTask.getTargetProxy();
   createTrees(source, target);
   createTreeWidgets(source, target, widgetCreator);
   createConnectionWidgets(correspondenceCreator);
   //        updateTree();
   this.analizzato = true;
   this.sourceSchemaTree.updateUI();
   this.targetSchemaTree.updateUI();
   this.moveToFront(this.glassPane);
   this.setVisible(true);
   this.glassPane.getScene().setMaximumBounds(this.glassPane.getScene().getBounds());
   initListener();
 }
 @Override
 public void performAction() {
   Scenario scenario = (Scenario) modello.getBean(Costanti.CURRENT_SCENARIO);
   MappingTask mappingTask = scenario.getMappingTask();
   if (mappingTask.getValueCorrespondences().size() == 0
       && mappingTask.getMappingData().getSTTgds().isEmpty()) {
     NotifyDescriptor nd =
         new NotifyDescriptor.Message(
             NbBundle.getMessage(Costanti.class, Costanti.EMPTY_CORRESPONDENCES),
             DialogDescriptor.WARNING_MESSAGE);
     DialogDisplayer.getDefault().notify(nd);
     return;
   }
   try {
     openTransformationWindows();
     openInstanceWindows();
     enableActions();
   } catch (Exception ex) {
     DialogDisplayer.getDefault()
         .notify(new NotifyDescriptor.Message(ex.getMessage(), DialogDescriptor.ERROR_MESSAGE));
   }
 }