hudson.model.Hudson.checkGoodName()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中hudson.model.Hudson.checkGoodName()方法的一些代码示例,展示了Hudson.checkGoodName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hudson.checkGoodName()方法的具体详情如下:
包路径:hudson.model.Hudson
类名称:Hudson
方法名:checkGoodName

Hudson.checkGoodName介绍

[英]Check if the given name is suitable as a name for job, view, etc.
[中]检查给定名称是否适合作为作业、视图等的名称。

代码示例

代码示例来源:origin: hudson/hudson-2.x

/**
 * Creates a new log recorder.
 */
public HttpResponse doNewLogRecorder(@QueryParameter String name) {
  Hudson.checkGoodName(name);
  
  logRecorders.put(name,new LogRecorder(name));
  // redirect to the config screen
  return new HttpRedirect(name+"/configure");
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Creates a new log recorder.
 */
public HttpResponse doNewLogRecorder(@QueryParameter String name) {
  Hudson.checkGoodName(name);
  logRecorders.put(name, new LogRecorder(name));
  // redirect to the config screen
  return new HttpRedirect(name + "/configure");
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
   * Makes sure that the given name is good as a axis name.
   */
  public FormValidation doCheckName(@QueryParameter String value) {
    if(Util.fixEmpty(value)==null)
      return FormValidation.ok();

    try {
      Hudson.checkGoodName(value);
      return FormValidation.ok();
    } catch (Failure e) {
      return FormValidation.error(e.getMessage());
    }
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Creates a new log recorder.
 */
public HttpResponse doNewLogRecorder(@QueryParameter String name) {
  Hudson.checkGoodName(name);
  
  logRecorders.put(name,new LogRecorder(name));
  // redirect to the config screen
  return new HttpRedirect(name+"/configure");
}

代码示例来源:origin: hudson/hudson-2.x

/**
   * Makes sure that the given name is good as a axis name.
   */
  public FormValidation doCheckName(@QueryParameter String value) {
    if(Util.fixEmpty(value)==null)
      return FormValidation.ok();

    try {
      Hudson.checkGoodName(value);
      return FormValidation.ok();
    } catch (Failure e) {
      return FormValidation.error(e.getMessage());
    }
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
   * Makes sure that the given name is good as a axis name.
   */
  public FormValidation doCheckName(@QueryParameter String value) {
    if(Util.fixEmpty(value)==null)
      return FormValidation.ok();

    try {
      Hudson.checkGoodName(value);
      return FormValidation.ok();
    } catch (Failure e) {
      return FormValidation.error(e.getMessage());
    }
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Creates a new log recorder.
 */
public HttpResponse doNewLogRecorder(@QueryParameter String name) {
  Hudson.checkGoodName(name);
  
  logRecorders.put(name,new LogRecorder(name));
  // redirect to the config screen
  return new HttpRedirect(name+"/configure");
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

public FormValidation doCheckName(@QueryParameter String value ) {
  String name = Util.fixEmptyAndTrim(value);
  if(name==null)
    return FormValidation.error(Messages.NodeDescripter_CheckName_Mandatory());
  try {
    Hudson.checkGoodName(name);
  } catch (Failure f) {
    return FormValidation.error(f.getMessage());
  }
  return FormValidation.ok();
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public FormValidation doCheckName(@QueryParameter String value) {
  String name = Util.fixEmptyAndTrim(value);
  if (name == null) {
    return FormValidation.error(Messages.NodeDescripter_CheckName_Mandatory());
  }
  try {
    Hudson.checkGoodName(name);
  } catch (Failure f) {
    return FormValidation.error(f.getMessage());
  }
  return FormValidation.ok();
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public FormValidation doCheckName(@QueryParameter String value ) {
  String name = Util.fixEmptyAndTrim(value);
  if(name==null)
    return FormValidation.error(Messages.NodeDescripter_CheckName_Mandatory());
  try {
    Hudson.checkGoodName(name);
  } catch (Failure f) {
    return FormValidation.error(f.getMessage());
  }
  return FormValidation.ok();
}

代码示例来源:origin: hudson/hudson-2.x

public FormValidation doCheckName(@QueryParameter String value ) {
  String name = Util.fixEmptyAndTrim(value);
  if(name==null)
    return FormValidation.error(Messages.NodeDescripter_CheckName_Mandatory());
  try {
    Hudson.checkGoodName(name);
  } catch (Failure f) {
    return FormValidation.error(f.getMessage());
  }
  return FormValidation.ok();
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Makes sure that the given name is good as a job name.
 * @return trimmed name if valid; throws ParseException if not
 */
private String checkJobName(String name) throws Failure {
  checkGoodName(name);
  name = name.trim();
  if (getItem(name) != null) {
    throw new Failure(Messages.Hudson_JobAlreadyExists(name));
  }
  // looks good
  return name;
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Makes sure that the given name is good as a job name.
 * @return trimmed name if valid; throws ParseException if not
 */
private String checkJobName(String name) throws Failure {
  checkGoodName(name);
  name = name.trim();
  if (getItem(name) != null) {
    throw new Failure(Messages.Hudson_JobAlreadyExists(name));
  }
  // looks good
  return name;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Makes sure that the given name is good as a job name.
 * @return trimmed name if valid; throws ParseException if not
 */
private String checkJobName(String name) throws Failure {
  checkGoodName(name);
  name = name.trim();
  if (getItem(name) != null) {
    throw new Failure(Messages.Hudson_JobAlreadyExists(name));
  }
  // looks good
  return name;
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Renames this view.
 */
public void rename(String newName) throws Failure, FormException {
  if(name.equals(newName))    return; // noop
  checkGoodName(newName);
  if(owner.getView(newName)!=null)
    throw new FormException(Messages.Hudson_ViewAlreadyExists(newName),"name");
  String oldName = name;
  name = newName;
  owner.onViewRenamed(this,oldName,newName);
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Renames this view.
 */
public void rename(String newName) throws Failure, FormException {
  if(name.equals(newName))    return; // noop
  checkGoodName(newName);
  if(owner.getView(newName)!=null)
    throw new FormException(Messages.Hudson_ViewAlreadyExists(newName),"name");
  String oldName = name;
  name = newName;
  owner.onViewRenamed(this,oldName,newName);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Renames this view.
 */
public void rename(String newName) throws Failure, FormException {
  if(name.equals(newName))    return; // noop
  checkGoodName(newName);
  if(owner.getView(newName)!=null)
    throw new FormException(Messages.Hudson_ViewAlreadyExists(newName),"name");
  String oldName = name;
  name = newName;
  owner.onViewRenamed(this,oldName,newName);
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Makes sure that the given name is good as a slave name.
 * @return trimmed name if valid; throws ParseException if not
 */
public String checkName(String name) throws Failure {
  if(name==null)
    throw new Failure("Query parameter 'name' is required");
  name = name.trim();
  Hudson.checkGoodName(name);
  if(Hudson.getInstance().getNode(name)!=null)
    throw new Failure(Messages.ComputerSet_SlaveAlreadyExists(name));
  // looks good
  return name;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Makes sure that the given name is good as a slave name.
 * @return trimmed name if valid; throws ParseException if not
 */
public String checkName(String name) throws Failure {
  if(name==null)
    throw new Failure("Query parameter 'name' is required");
  name = name.trim();
  Hudson.checkGoodName(name);
  if(Hudson.getInstance().getNode(name)!=null)
    throw new Failure(Messages.ComputerSet_SlaveAlreadyExists(name));
  // looks good
  return name;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Makes sure that the given name is good as a slave name.
 * @return trimmed name if valid; throws ParseException if not
 */
public String checkName(String name) throws Failure {
  if(name==null)
    throw new Failure("Query parameter 'name' is required");
  name = name.trim();
  Hudson.checkGoodName(name);
  if(Hudson.getInstance().getNode(name)!=null)
    throw new Failure(Messages.ComputerSet_SlaveAlreadyExists(name));
  // looks good
  return name;
}

相关文章

Hudson类方法