Java 类hudson.model.TextParameterValue 实例源码

项目:persistent-parameter-plugin    文件:PersistentTextParameterDefinition.java   
@Override
public ParameterValue createValue(StaplerRequest req, JSONObject jo)
{
  TextParameterValue value = req.bindJSON(TextParameterValue.class, jo);
  value.setDescription(getDescription());
  return value;
}
项目:persistent-parameter-plugin    文件:PersistentTextParameterDefinition.java   
@Override
public ParameterValue createValue(String value)
{
  return new TextParameterValue(getName(), value, getDescription());
}
项目:call-remote-job-plugin    文件:CallOtherJenkinsBuilder.java   
@Override
public boolean perform(@SuppressWarnings("rawtypes") AbstractBuild build, Launcher launcher, BuildListener listener) {
    try {
        ParametersAction parameters = build.getAction(ParametersAction.class);
        Map<String, String> parameterMap = new HashMap<String, String>();

        Map<String, String> envMap = System.getenv();
        for (String envKey : envMap.keySet()) {
            parameterMap.put(envKey, envMap.get(envKey));
        }

        if (null != parameters) {
            for (ParameterValue parameterValue : parameters.getParameters()) {
                if (parameterValue instanceof TextParameterValue) {
                    parameterMap.put(parameterValue.getName(), ((TextParameterValue) parameterValue).value);
                }
                if (parameterValue instanceof StringParameterValue) {
                    parameterMap.put(parameterValue.getName(), ((StringParameterValue) parameterValue).value);
                }
                if (parameterValue instanceof PasswordParameterValue) {
                    parameterMap.put(parameterValue.getName(), ((PasswordParameterValue) parameterValue).getValue().getPlainText());
                }
            }
        }
        JenkinsRemoteIF jenkinsRemoteIF = new JenkinsRemoteIF(getHostName(), getJobName(), getDescriptor().getHttps());
        if (null != getUserName() && !"".equals(getUserName())) {
            jenkinsRemoteIF.setAuthentication(ReplaceUtil.replaceParam(getUserName(), parameterMap), ReplaceUtil.replaceParam(getPassword(), parameterMap));
        }
        if (null != getParameters() && !"".equals(getParameters())) {
            String parameterString = getParameters();
            String replacedParameterString = ReplaceUtil.replaceParam(parameterString, parameterMap);
            jenkinsRemoteIF.setParameters(replacedParameterString);
        }
        long nextBuildNumber = jenkinsRemoteIF.loadNextBuildNumber(listener.getLogger());
        jenkinsRemoteIF.exec(listener.getLogger());
        LastCompleteBuild lastCompleteBuild = jenkinsRemoteIF.seekEnd(listener.getLogger(), nextBuildNumber, Long.valueOf(getSpan()), Long.valueOf(getRetry()));
        listener.getLogger().println("build number " + lastCompleteBuild.number + " :success ? " + lastCompleteBuild.success);
        return lastCompleteBuild.success;
    } catch (Exception e) {
        e.printStackTrace(listener.getLogger());
        return false;
    }
}