jenkins.model.Jenkins.getViews()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(166)

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

Jenkins.getViews介绍

[英]Gets the read-only list of all Views.
[中]获取所有视图的只读列表。

代码示例

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

public boolean isActivated() {
  Jenkins h = Jenkins.getInstance();
  return h.getViews().size()==1 && h.getItemMap().size()> THRESHOLD;
}

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

public ContextMenu doChildrenContextMenu(StaplerRequest request, StaplerResponse response) throws Exception {
  ContextMenu menu = new ContextMenu();
  for (View view : getViews()) {
    menu.add(view.getViewUrl(),view.getDisplayName());
  }
  return menu;
}

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

@Override
  public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
    // for compatibility reasons, the actual value is stored in Jenkins
    Jenkins j = Jenkins.get();
    if (json.has("primaryView")) {
      final String viewName = json.getString("primaryView");
      final View newPrimaryView = j.getView(viewName);
      if (newPrimaryView == null) {
        throw new FormException(Messages.GlobalDefaultViewConfiguration_ViewDoesNotExist(viewName), "primaryView");
      }
      j.setPrimaryView(newPrimaryView);
    } else {
      // Fallback if the view is not specified
      j.setPrimaryView(j.getViews().iterator().next());
    }
    
    return true;
  }
}

代码示例来源:origin: org.jenkins-ci.plugins/security-inspector

@CheckForNull
private AllView getAllView() {
  for (View view : JenkinsHelper.getInstanceOrFail().getViews()) {
    if (view instanceof AllView) {
      return (AllView) view;
    }
  }
  return null;
}

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

public boolean isActivated() {
  Jenkins h = Jenkins.getInstance();
  return h.getViews().size()==1 && h.getItemMap().size()> THRESHOLD;
}

代码示例来源:origin: Diabol/delivery-pipeline-plugin

private void notifyView(Item item, String oldName, String newName) {
    Collection<View> views = JenkinsUtil.getInstance().getViews();
    for (View view : views) {
      if (view instanceof DeliveryPipelineView) {
        ((DeliveryPipelineView) view).onProjectRenamed(item, oldName, newName);
      }
    }
  }
}

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

public ContextMenu doChildrenContextMenu(StaplerRequest request, StaplerResponse response) throws Exception {
  ContextMenu menu = new ContextMenu();
  for (View view : getViews()) {
    menu.add(view.getViewUrl(),view.getDisplayName());
  }
  return menu;
}

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

@Override
  public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
    // for compatibility reasons, the actual value is stored in Jenkins
    Jenkins j = Jenkins.getInstance();
    if (json.has("primaryView")) {
      final String viewName = json.getString("primaryView");
      final View newPrimaryView = j.getView(viewName);
      if (newPrimaryView == null) {
        throw new FormException(Messages.GlobalDefaultViewConfiguration_ViewDoesNotExist(viewName), "primaryView");
      }
      j.setPrimaryView(newPrimaryView);
    } else {
      // Fallback if the view is not specified
      j.setPrimaryView(j.getViews().iterator().next());
    }
    
    return true;
  }
}

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

private void locationChanged(Item item, String oldFullName, String newFullName) {
  final Jenkins jenkins = Jenkins.getInstance();
  for (View view: jenkins.getViews()) {
    if (view instanceof ListView) {
      renameViewItem(oldFullName, newFullName, jenkins, (ListView) view);
    }
  }
  for (Item g : jenkins.allItems()) {
    if (g instanceof ViewGroup) {
      ViewGroup vg = (ViewGroup) g;
      for (View v : vg.getViews()) {
        if (v instanceof ListView) {
          renameViewItem(oldFullName, newFullName, vg, (ListView) v);
        }
      }
    }
  }
}

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

private void deleted(Item item) {
  final Jenkins jenkins = Jenkins.getInstance();
  for (View view: jenkins.getViews()) {
    if (view instanceof ListView) {
      deleteViewItem(item, jenkins, (ListView) view);
    }
  }
  for (Item g : jenkins.allItems()) {
    if (g instanceof ViewGroup) {
      ViewGroup vg = (ViewGroup) g;
      for (View v : vg.getViews()) {
        if (v instanceof ListView) {
          deleteViewItem(item, vg, (ListView) v);
        }
      }
    }
  }
}

相关文章

Jenkins类方法