protected void getData() {
    if (!Const.isEmpty(m_currentMeta.getIncomingKeyField())) {
      m_incomingKeyCombo.setText(m_currentMeta.getIncomingKeyField());
    }

    if (!Const.isEmpty(m_currentMeta.getIncomingResultField())) {
      m_incomingResultCombo.setText(m_currentMeta.getIncomingResultField());
    }

    if (m_currentMeta.getMapping() != null) {
      m_mappingEditor.setMapping(m_currentMeta.getMapping());
    }
  }
Exemplo n.º 2
0
  private void loadTableViewFromMapping() {
    String tableName = "";
    if (!Const.isEmpty(m_existingTableNamesCombo.getText().trim())) {
      tableName = m_existingTableNamesCombo.getText().trim();

      if (tableName.indexOf('@') > 0) {
        tableName = tableName.substring(0, tableName.indexOf('@'));
      }
    }

    try {
      if (m_admin.mappingExists(tableName, m_existingMappingNamesCombo.getText().trim())) {

        Mapping mapping =
            m_admin.getMapping(tableName, m_existingMappingNamesCombo.getText().trim());

        setMapping(mapping);

        /*m_fieldsView.clearAll();

        // do the key first
        TableItem keyItem = new TableItem(m_fieldsView.table, SWT.NONE);
        keyItem.setText(1, mapping.getKeyName());
        keyItem.setText(2, "Y");
        keyItem.setText(5, mapping.getKeyType().toString());

        // the rest of the fields in the mapping
        Map<String, HBaseValueMeta> mappedFields = mapping.getMappedColumns();
        for (String alias : mappedFields.keySet()) {
          HBaseValueMeta vm = mappedFields.get(alias);
          TableItem item = new TableItem(m_fieldsView.table, SWT.NONE);
          item.setText(1, alias);
          item.setText(2, "N");
          item.setText(3, vm.getColumnFamily());
          item.setText(4, vm.getColumnName());

          if (vm.isInteger()) {
            if (vm.getIsLongOrDouble()) {
              item.setText(5, "Long");
            } else {
              item.setText(5, "Integer");
            }
          } else if (vm.isNumber()) {
            if (vm.getIsLongOrDouble()) {
              item.setText(5, "Double");
            } else {
              item.setText(5, "Float");
            }
          }  else {
            item.setText(5, vm.getTypeDesc());
          }

          if (vm.getStorageType() == ValueMetaInterface.STORAGE_TYPE_INDEXED) {
            item.setText(6, HBaseValueMeta.objectIndexValuesToString(vm.getIndex()));
          }
        }

        m_fieldsView.removeEmptyRows();
        m_fieldsView.setRowNums();
        m_fieldsView.optWidth(true); */
      }

    } catch (IOException ex) {
      // inform the user via popup
      new ErrorDialog(
          m_shell,
          Messages.getString("MappingDialog.Error.Title.ErrorLoadingMapping"),
          Messages.getString("MappingDialog.Error.Message.ErrorLoadingMapping"),
          ex);
      ex.printStackTrace();
    }
  }