コード例 #1
0
ファイル: View.java プロジェクト: zlosch/jenkins
 /** Gets the system message to be displayed at the top of the page on all views */
 @Exported
 public String getSystemMessage() {
   if (owner.getSystemMessage() != null && !owner.getSystemMessage().isEmpty()) {
     this.systemmessage = owner.getSystemMessage();
   }
   return systemmessage;
 }
コード例 #2
0
ファイル: View.java プロジェクト: zlosch/jenkins
  /** Deletes this view. */
  public synchronized void doDoDelete(StaplerRequest req, StaplerResponse rsp)
      throws IOException, ServletException {
    requirePOST();
    checkPermission(DELETE);

    owner.deleteView(this);

    rsp.sendRedirect2(req.getContextPath() + "/" + owner.getUrl());
  }
コード例 #3
0
ファイル: View.java プロジェクト: zlosch/jenkins
 /** 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);
 }
コード例 #4
0
ファイル: View.java プロジェクト: zlosch/jenkins
 public void save() throws IOException {
   // persistence is a part of the owner
   // due to initialization timing issue, it can be null when this method is called
   if (owner != null) {
     owner.save();
   }
 }
コード例 #5
0
ファイル: View.java プロジェクト: alexkogon/jenkins
 /** Backward-compatible way of getting {@code getOwner().getItemGroup()} */
 public ItemGroup<? extends TopLevelItem> getOwnerItemGroup() {
   try {
     return owner.getItemGroup();
   } catch (AbstractMethodError e) {
     return Jenkins.getInstance();
   }
 }
コード例 #6
0
ファイル: View.java プロジェクト: arangamani/jenkins
  public static View create(StaplerRequest req, StaplerResponse rsp, ViewGroup owner)
      throws FormException, IOException, ServletException {
    String requestContentType = req.getContentType();
    if (requestContentType == null) throw new Failure("No Content-Type header set");

    boolean isXmlSubmission =
        requestContentType.startsWith("application/xml")
            || requestContentType.startsWith("text/xml");

    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) {
      if (isXmlSubmission) {
        View v;
        v = createViewFromXML(name, req.getInputStream());
        v.owner = owner;
        rsp.setStatus(HttpServletResponse.SC_OK);
        return v;
      } else 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;
  }
コード例 #7
0
ファイル: View.java プロジェクト: alexkogon/jenkins
  private static View copy(StaplerRequest req, ViewGroup owner, String name) throws IOException {
    View v;
    String from = req.getParameter("from");
    View src = src = owner.getView(from);

    if (src == null) {
      if (Util.fixEmpty(from) == null) throw new Failure("Specify which view to copy");
      else throw new Failure("No such view: " + from);
    }
    String xml = Jenkins.XSTREAM.toXML(src);
    v = createViewFromXML(name, new StringInputStream(xml));
    return v;
  }
コード例 #8
0
ファイル: View.java プロジェクト: zlosch/jenkins
  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;
  }
コード例 #9
0
ファイル: View.java プロジェクト: zlosch/jenkins
 /** Same as {@link #getUrl()} except this returns a view/{name} path even for the default view. */
 public String getViewUrl() {
   return (owner != null ? owner.getUrl() : "") + "view/" + Util.rawEncode(getViewName()) + '/';
 }
コード例 #10
0
ファイル: View.java プロジェクト: zlosch/jenkins
 /**
  * Returns the path relative to the context root.
  *
  * <p>Doesn't start with '/' but ends with '/' (except returns empty string when this is the
  * default view).
  */
 public String getUrl() {
   return isDefault() ? (owner != null ? owner.getUrl() : "") : getViewUrl();
 }
コード例 #11
0
ファイル: View.java プロジェクト: zlosch/jenkins
 private List<Action> _getOwnerViewActions() {
   return owner.getViewActions();
 }
コード例 #12
0
ファイル: View.java プロジェクト: zlosch/jenkins
 private View _getOwnerPrimaryView() {
   return owner.getPrimaryView();
 }
コード例 #13
0
ファイル: View.java プロジェクト: zlosch/jenkins
 /**
  * A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and
  * bug 6933067 on BugParade for more details.
  */
 private ItemGroup<? extends TopLevelItem> _getOwnerItemGroup() {
   return owner.getItemGroup();
 }