hudson.model.Messages.Hudson_ViewAlreadyExists()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(200)

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

Messages.Hudson_ViewAlreadyExists介绍

[英]A view already exists with the name "{0}"
[中]名为“{0}”的视图已存在

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * Checks if a top-level view with the given name exists.
 * @deprecated 1.512
 */
@Deprecated
public FormValidation doViewExistsCheck(@QueryParameter String value) {
  checkPermission(View.CREATE);
  String view = fixEmpty(value);
  if(view==null) return FormValidation.ok();
  if(getView(view)==null)
    return FormValidation.ok();
  else
    return FormValidation.error(Messages.Hudson_ViewAlreadyExists(view));
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Checks if a top-level view with the given name exists and
 * make sure that the name is good as a view name.
 */
public FormValidation doCheckViewName(@QueryParameter String value) {
  checkPermission(View.CREATE);
  String name = fixEmpty(value);
  if (name == null)
    return FormValidation.ok();
  // already exists?
  if (getView(name) != null)
    return FormValidation.error(Messages.Hudson_ViewAlreadyExists(name));
  // good view name?
  try {
    checkGoodName(name);
  } catch (Failure e) {
    return FormValidation.error(e.getMessage());
  }
  return FormValidation.ok();
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Renames this view.
 */
public void rename(String newName) throws Failure, FormException {
  if(name.equals(newName))    return; // noop
  Jenkins.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: jenkinsci/jenkins

Jenkins.checkGoodName(name);
if(owner.getView(name)!=null)
  throw new Failure(Messages.Hudson_ViewAlreadyExists(name));

代码示例来源:origin: org.jenkins-ci.plugins/nested-view

/**
 * Checks if a nested view with the given name exists.
 */
public FormValidation doViewExistsCheck(@QueryParameter String value) {
  checkPermission(View.CREATE);
  String view = fixEmpty(value);
  return (view == null || getView(view) == null) ? FormValidation.ok()
      : FormValidation.error(hudson.model.Messages.Hudson_ViewAlreadyExists(view));
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Checks if a top-level view with the given name exists.
 * @deprecated 1.512
 */
@Deprecated
public FormValidation doViewExistsCheck(@QueryParameter String value) {
  checkPermission(View.CREATE);
  String view = fixEmpty(value);
  if(view==null) return FormValidation.ok();
  if(getView(view)==null)
    return FormValidation.ok();
  else
    return FormValidation.error(Messages.Hudson_ViewAlreadyExists(view));
}

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

/**
 * Checks if a top-level view with the given name exists.
 */
public FormValidation doViewExistsCheck(@QueryParameter String value) {
  checkPermission(View.CREATE);
  String view = Util.fixEmpty(value);
  if (view == null) {
    return FormValidation.ok();
  }
  if (getView(view) == null) {
    return FormValidation.ok();
  } else {
    return FormValidation.error(Messages.Hudson_ViewAlreadyExists(view));
  }
}

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

/**
 * Checks if a top-level view with the given name exists.
 */
public FormValidation doViewExistsCheck(@QueryParameter String value) {
  checkPermission(View.CREATE);
  String view = Util.fixEmpty(value);
  if (view == null) {
    return FormValidation.ok();
  }
  if (getView(view) == null) {
    return FormValidation.ok();
  } else {
    return FormValidation.error(Messages.Hudson_ViewAlreadyExists(view));
  }
}

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

/**
 * Checks if a top-level view with the given name exists.
 */
public FormValidation doViewExistsCheck(@QueryParameter String value) {
  checkPermission(View.CREATE);
  String view = fixEmpty(value);
  if (view == null) {
    return FormValidation.ok();
  }
  if (getView(view) == null) {
    return FormValidation.ok();
  } else {
    return FormValidation.error(Messages.Hudson_ViewAlreadyExists(view));
  }
}

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

/**
 * Checks if a top-level view with the given name exists.
 */
public FormValidation doViewExistsCheck(@QueryParameter String value) {
  checkPermission(View.CREATE);
  String view = fixEmpty(value);
  if (view == null) {
    return FormValidation.ok();
  }
  if (getView(view) == null) {
    return FormValidation.ok();
  } else {
    return FormValidation.error(Messages.Hudson_ViewAlreadyExists(view));
  }
}

代码示例来源: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

/**
 * 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.jenkins-ci.main/jenkins-core

/**
 * Checks if a top-level view with the given name exists and
 * make sure that the name is good as a view name.
 */
public FormValidation doCheckViewName(@QueryParameter String value) {
  checkPermission(View.CREATE);
  String name = fixEmpty(value);
  if (name == null)
    return FormValidation.ok();
  // already exists?
  if (getView(name) != null)
    return FormValidation.error(Messages.Hudson_ViewAlreadyExists(name));
  // good view name?
  try {
    checkGoodName(name);
  } catch (Failure e) {
    return FormValidation.error(e.getMessage());
  }
  return FormValidation.ok();
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Renames this view.
 */
public void rename(String newName) throws Failure, FormException {
  if(name.equals(newName))    return; // noop
  Jenkins.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.jenkins-ci.plugins/nested-view

/**
 * Checks if a nested view with the given name exists and 
 * make sure that the name is good as a view name.
 */
public FormValidation doCheckViewName(@QueryParameter String value) {
  checkPermission(View.CREATE);
  
  String name = fixEmpty(value);
  if (name == null) 
    return FormValidation.ok();
  
  // already exists?
  if (getView(name) != null) 
    return FormValidation.error(hudson.model.Messages.Hudson_ViewAlreadyExists(name));
  
  // good view name?
  try {
    jenkins.model.Jenkins.checkGoodName(name);
  } catch (Failure e) {
    return FormValidation.error(e.getMessage());
  }
  return FormValidation.ok();
}

代码示例来源:origin: org.eclipse.hudson/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

public static View create(StaplerRequest req, StaplerResponse rsp, ViewGroup owner)
      throws FormException, IOException, ServletException {
    String name = req.getParameter("name");
    checkGoodName(name);
    if(owner.getView(name)!=null)
      throw new FormException(Messages.Hudson_ViewAlreadyExists(name),"name");

    String mode = req.getParameter("mode");
    if (mode==null || mode.length()==0)
      throw new FormException(Messages.View_MissingMode(),"mode");

    // create a view
    View v = all().findByName(mode).newInstance(req,req.getSubmittedForm());
    v.owner = owner;

    // redirect to the config screen
    rsp.sendRedirect2(req.getContextPath()+'/'+v.getUrl()+v.getPostConstructLandingPage());

    return v;
  }
}

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

public static View create(StaplerRequest req, StaplerResponse rsp, ViewGroup owner)
      throws FormException, IOException, ServletException {
    String name = req.getParameter("name");
    checkGoodName(name);
    if(owner.getView(name)!=null)
      throw new FormException(Messages.Hudson_ViewAlreadyExists(name),"name");

    String mode = req.getParameter("mode");
    if (mode==null || mode.length()==0)
      throw new FormException(Messages.View_MissingMode(),"mode");

    // create a view
    View v = all().findByName(mode).newInstance(req,req.getSubmittedForm());
    v.owner = owner;

    // redirect to the config screen
    rsp.sendRedirect2(req.getContextPath()+'/'+v.getUrl()+v.getPostConstructLandingPage());

    return v;
  }
}

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

public static View create(StaplerRequest req, StaplerResponse rsp, ViewGroup owner)
      throws FormException, IOException, ServletException {
    String name = req.getParameter("name");
    checkGoodName(name);
    if(owner.getView(name)!=null)
      throw new FormException(Messages.Hudson_ViewAlreadyExists(name),"name");

    String mode = req.getParameter("mode");
    if (mode==null || mode.length()==0)
      throw new FormException(Messages.View_MissingMode(),"mode");

    // create a view
    View v = all().findByName(mode).newInstance(req,req.getSubmittedForm());
    v.owner = owner;

    // redirect to the config screen
    rsp.sendRedirect2(req.getContextPath()+'/'+v.getUrl()+v.getPostConstructLandingPage());

    return v;
  }
}

相关文章

Messages类方法