Esempio n. 1
0
  public void setField(String key, String value)
      throws InvalidFieldKeyException, AlreadyDefinedKeyException {
    try {
      validateKey(key);

      if (data.getFiles().containsKey(key)) {
        throw new AlreadyDefinedKeyException(key, "files");
      }

      data.addField(key, value);
    } catch (InvalidFieldKeyException e) {
      TransloaditLogger.logError(this.getClass(), e);
      throw e;
    } catch (AlreadyDefinedKeyException e) {
      TransloaditLogger.logError(this.getClass(), e);
      throw e;
    }
  }
Esempio n. 2
0
  public void setParam(String key, String value) throws InvalidFieldKeyException {

    try {
      validateKey(key);

      data.addParam(key, value);
    } catch (InvalidFieldKeyException e) {
      TransloaditLogger.logError(this.getClass(), e);
      throw e;
    }
  }
Esempio n. 3
0
  public void addFile(String key, File file)
      throws InvalidFieldKeyException, FileNotOpenableException {
    try {
      validateKey(key);
      fileCheck(file);

      if (data.getFields().containsKey(key) || data.getFiles().containsKey(key)) {
        TransloaditLogger.logInfo(
            this.getClass(),
            "Autogenerated key will be used for %s file with key %s, because the specified key is already defined.",
            file,
            key);
        addFile(file);
      } else {
        data.addFile(key, file);
      }
    } catch (InvalidFieldKeyException e) {
      TransloaditLogger.logError(this.getClass(), e);
      throw e;
    } catch (FileNotOpenableException e) {
      TransloaditLogger.logError(this.getClass(), e);
      throw e;
    }
  }