/**
  * Creates the entry.
  *
  * @param attr the attr
  * @param PKG the pkg
  * @return the step injection meta entry
  */
 protected StepInjectionMetaEntry createEntry(KettleAttributeInterface attr, Class<?> PKG) {
   return new StepInjectionMetaEntry(
       attr.getKey(), attr.getType(), BaseMessages.getString(PKG, attr.getDescription()));
 }
  public void injectStepMetadataEntries(List<StepInjectionMetaEntry> metadata) {
    for (StepInjectionMetaEntry entry : metadata) {
      KettleAttributeInterface attr = findAttribute(entry.getKey());

      // Set top level attributes...
      //
      if (entry.getValueType() != ValueMetaInterface.TYPE_NONE) {

        if (entry.getKey().equals("SCHEMA")) {
          schemaName = (String) entry.getValue();
        } else if (entry.getKey().equals("TABLE")) {
          tableName = (String) entry.getValue();
        } else if (entry.getKey().equals("LOADACTION")) {
          loadAction = (String) entry.getValue();
        } else if (entry.getKey().equals("PSQLPATH")) {
          setPsqlpath((String) entry.getValue());
        } else if (entry.getKey().equals("DBNAMEOVERRIDE")) {
          dbNameOverride = (String) entry.getValue();
        } else if (entry.getKey().equals("ENCLOSURE")) {
          enclosure = (String) entry.getValue();
        } else if (entry.getKey().equals("DELIMITER")) {
          delimiter = (String) entry.getValue();
        } else if (entry.getKey().equals("STOPONERROR")) {
          stopOnError = (Boolean) entry.getValue();
        } else {
          throw new RuntimeException(
              "Unhandled metadata injection of attribute: "
                  + attr.toString()
                  + " - "
                  + attr.getDescription());
        }
      } else {
        // The data sets...
        //
        if (attr.getKey().equals("MAPPINGS")) {
          List<StepInjectionMetaEntry> selectMappings = entry.getDetails();

          fieldTable = new String[selectMappings.size()];
          fieldStream = new String[selectMappings.size()];
          dateMask = new String[selectMappings.size()];

          for (int row = 0; row < selectMappings.size(); row++) {
            StepInjectionMetaEntry selectField = selectMappings.get(row);

            List<StepInjectionMetaEntry> fieldAttributes = selectField.getDetails();
            // CHECKSTYLE:Indentation:OFF
            for (int i = 0; i < fieldAttributes.size(); i++) {
              StepInjectionMetaEntry fieldAttribute = fieldAttributes.get(i);
              KettleAttributeInterface fieldAttr = findAttribute(fieldAttribute.getKey());

              String attributeValue = (String) fieldAttribute.getValue();
              if (fieldAttr.getKey().equals("STREAMNAME")) {
                getFieldStream()[row] = attributeValue;
              } else if (fieldAttr.getKey().equals("FIELDNAME")) {
                getFieldTable()[row] = attributeValue;
              } else if (fieldAttr.getKey().equals("DATEMASK")) {
                getDateMask()[row] = attributeValue;
              } else {
                throw new RuntimeException(
                    "Unhandled metadata injection of attribute: "
                        + fieldAttr.toString()
                        + " - "
                        + fieldAttr.getDescription());
              }
            }
          }
        }
        if (!Const.isEmpty(getFieldStream())) {
          for (int i = 0; i < getFieldStream().length; i++) {
            logDetailed(
                "row "
                    + Integer.toString(i)
                    + ": stream="
                    + getFieldStream()[i]
                    + " : table="
                    + getFieldTable()[i]);
          }
        }
      }
    }
  }