protected void encryptApiKey(ActionParametersMap params) {
   if (params.containsKey(API_KEY)) {
     try {
       // test if the key is already encrypted
       encryptionService.decrypt(params.getString(API_KEY));
     } catch (EncryptionException e) {
       // otherwise, encrypt it
       params.put(API_KEY, encryptionService.encrypt(params.getString(API_KEY)));
     }
   }
 }
 /** {@inheritDoc} */
 @Override
 public void validateSonarServer(ActionParametersMap params, ErrorCollection errorCollection) {
   LOGGER.debug("Validating Sonar JDBC Properties");
   if (!params.getBoolean(CFG_SONAR_SERVER_CONFIGURED)) {
     super.validateSonarServer(params, errorCollection);
   }
 }
コード例 #3
0
  public void validate(final ActionParametersMap params, final ErrorCollection errorCollection) {
    super.validate(params, errorCollection);

    this.validator.params = params;
    this.validator.errorCollection = errorCollection;
    this.errorCollection = errorCollection;

    validator.validateZsUrl();
    validator.validateApiKey();
    validator.validateApiSecret();
    validator.validateAppName();
    validator.validateBaseUrl();
    validator.validateZsVersion();
    validateRetry(params.getString("retry"));
    validateWaittime(params.getString("waittime"));
  }
 protected void enforceFieldRequiredness(
     ActionParametersMap params, ErrorCollection errorCollection) {
   for (String field : getFieldsToCopy()) {
     if (StringUtils.isEmpty(params.getString(field))) {
       errorCollection.addError(field, getI18nBean().getText("com.heroku.errors.emptyField"));
     }
   }
 }
 /** {@inheritDoc} */
 @Override
 public void validateSonarProject(ActionParametersMap params, ErrorCollection errorCollection) {
   LOGGER.debug("Validating Sonar Project Properties");
   if (!params.getBoolean(CFG_SONAR_PROJECT_CONFIGURED)) {
     if (StringUtils.isBlank(params.getString(CFG_SONAR_PROJECT_KEY))) {
       errorCollection.addError(
           CFG_SONAR_PROJECT_KEY, getI18nBean().getText("sonar.project.key.mandatory"));
     } else if (params.getString(CFG_SONAR_PROJECT_KEY).indexOf(":") == -1) {
       errorCollection.addError(
           CFG_SONAR_PROJECT_KEY, getI18nBean().getText("sonar.project.key.invalid"));
     }
     if (StringUtils.isBlank(params.getString(CFG_SONAR_PROJECT_NAME))) {
       errorCollection.addError(
           CFG_SONAR_PROJECT_NAME, getI18nBean().getText("sonar.project.name.mandatory"));
     }
     if (StringUtils.isBlank(params.getString(CFG_SONAR_PROJECT_VERSION))) {
       errorCollection.addError(
           CFG_SONAR_PROJECT_VERSION, getI18nBean().getText("sonar.project.version.mandatory"));
     }
     if (StringUtils.isBlank(params.getString(CFG_SONAR_SOURCES))) {
       errorCollection.addError(
           CFG_SONAR_SOURCES, getI18nBean().getText("sonar.sources.mandatory"));
     } else if (StringUtils.split(params.getString(CFG_SONAR_SOURCES), DIRECTORY_SEPARATOR).length
         < 1) {
       errorCollection.addError(
           CFG_SONAR_SOURCES, getI18nBean().getText("sonar.sources.mandatory"));
     }
   }
 }
コード例 #6
0
  public Map<String, String> generateTaskConfigMap(
      final ActionParametersMap params, final TaskDefinition previousTaskDefinition) {
    final Map<String, String> context = super.generateTaskConfigMap(params, previousTaskDefinition);

    context.put("zs_url", params.getString("zs_url"));
    context.put("api_key", params.getString("api_key"));
    context.put("api_secret", params.getString("api_secret"));
    context.put("package", params.getString("package"));
    context.put("base_url", params.getString("base_url"));
    context.put("app_name", params.getString("app_name"));
    context.put("zsversion", params.getString("zsversion"));
    context.put("custom_options", params.getString("custom_options"));
    context.put("retry", params.getString("retry"));
    context.put("waittime", params.getString("waittime"));

    return context;
  }