Пример #1
0
  static void isFreeDbkeyPosition(SchemaRecord record, short dbkeyPosition) {

    for (OwnerRole ownerRole : record.getOwnerRoles()) {
      if (dbkeyPosition == ownerRole.getNextDbkeyPosition()
          || ownerRole.getPriorDbkeyPosition() != null
              && dbkeyPosition == ownerRole.getPriorDbkeyPosition().shortValue()) {

        throw new RuntimeException(MSG_DBKEY_OVERLAPS);
      }
    }

    for (MemberRole memberRole : record.getMemberRoles()) {
      if (memberRole.getIndexDbkeyPosition() != null
              && dbkeyPosition == memberRole.getIndexDbkeyPosition().shortValue()
          || memberRole.getNextDbkeyPosition() != null
              && dbkeyPosition == memberRole.getNextDbkeyPosition().shortValue()
          || memberRole.getOwnerDbkeyPosition() != null
              && dbkeyPosition == memberRole.getOwnerDbkeyPosition().shortValue()
          || memberRole.getPriorDbkeyPosition() != null
              && dbkeyPosition == memberRole.getPriorDbkeyPosition().shortValue()) {

        throw new RuntimeException(MSG_DBKEY_OVERLAPS);
      }
    }
  }
Пример #2
0
  @Override
  public IWizardPage getNextPage(IWizardPage page) {
    if (page == importToolSelectionPage) {

      // The user has chosen an import tool and cannot change his/her selection; go get the
      // data entry pages from the import tool extension element and add all import wizard
      // pages.  Make sure we build and add the wizard pages only once.

      addDataEntryPages(importToolSelectionPage.getExtensionElement());

      // get a hold of the import tool and the parameters configured for it in the defining
      // extension and create the import tool proxy
      IRecordElementsImportTool importTool =
          activeRecordElementsImportToolExtensionElement.getRecordElementsImportTool();
      Properties importToolParms = activeRecordElementsImportToolExtensionElement.getParameters();
      proxy = new RecordElementsImportToolProxy(importTool, importToolParms);

      // return the first import tool data entry page or null if no data entry pages are
      // defined
      if (!dataEntryWizardPages.isEmpty()) {
        dataEntryWizardPages.get(0).aboutToShow();
        return dataEntryWizardPages.get(0);
      } else {
        return null;
      }
    } else if (dataEntryWizardPages != null && dataEntryWizardPages.contains(page)) {
      // we need the next data entry page
      int i = dataEntryWizardPages.indexOf(page);
      if (i < 0) {
        throw new RuntimeException("logic error");
      } else {
        // get the next relevant data entry page, if any
        ImportWizardPage nextPage = getNextRelevantPageIndex(i);
        if (nextPage != null) {
          // there is a next relevant data entry page, so return it
          nextPage.aboutToShow();
          return nextPage;
        } else {
          // no next data entry page, prepare the preview page and return it
          SchemaRecord record = new RecordModelBuilder().build("DUMMY");
          record.getRootElements().clear();
          record.getRootElements().addAll(proxy.invokeImportTool(context));
          String recordElementsDSL = Tools.generateRecordElementsDSL(record);
          previewPage.setRecordElementsDSL(recordElementsDSL);
          return previewPage;
        }
      }
    }
    return null;
  }
Пример #3
0
 public String getRecordName() {
   if (initOK) {
     return Tools.removeTrailingUnderscore(record.getName());
   } else {
     throw new IllegalStateException("init() was NOT invoked");
   }
 }
Пример #4
0
  private ImportWizardPage createImportWizardPage(DataEntryPageExtensionElement configElement) {

    // create the data entry page
    AbstractDataEntryPage dataEntryPage = configElement.createDataEntryPage();

    // wrap the data entry page in a wizard page
    ImportWizardPage importWizardPage =
        new ImportWizardPage(
            dataEntryPage,
            configElement.getName(),
            "Elements for Record " + record.getName(),
            configElement.getMessage());

    // inject the context in the data entry page's @Context annotated field
    injectContext(dataEntryPage);

    // create a controller and inject it in the data entry page's @Controller annotated field
    createAndInjectController(importWizardPage);

    // return the import wizard page
    return importWizardPage;
  }