本文整理汇总了Java中hudson.model.View类的典型用法代码示例。如果您正苦于以下问题:Java View类的具体用法?Java View怎么用?Java View使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
View类属于hudson.model包,在下文中一共展示了View类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGroups
import hudson.model.View; //导入依赖的package包/类
public List<PermissionGroup> getGroups(String typeString) {
AclType type = AclType.parseAclType(typeString);
List<PermissionGroup> groups;
switch (type) {
case GLOBAL: {
groups = new ArrayList<PermissionGroup>(
PermissionGroup.getAll());
groups.remove(PermissionGroup.get(Permission.class));
break;
}
case PROJECT: {
groups = new ArrayList<PermissionGroup>(
PermissionGroup.getAll());
groups.remove(PermissionGroup.get(Permission.class));
groups.remove(PermissionGroup.get(Jenkins.class));
groups.remove(PermissionGroup.get(Computer.class));
groups.remove(PermissionGroup.get(View.class));
break;
}
default:
groups = null;
}
return groups;
}
示例2: filter
import hudson.model.View; //导入依赖的package包/类
@Override
public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) {
List<Pattern> patterns = getCompiled();
List<TopLevelItem> workList = added.isEmpty() ? all : added;
List<TopLevelItem> filtered = new LinkedList<TopLevelItem>();
for (TopLevelItem item : workList) {
if (item instanceof ParameterizedJobMixIn.ParameterizedJob) {
DockerHubTrigger trigger = DockerHubTrigger.getTrigger((ParameterizedJobMixIn.ParameterizedJob)item);
if (trigger != null) {
if (patterns.isEmpty()) {
filtered.add(item);
} else {
for (String name : trigger.getAllRepoNames()) {
if(matches(name)) {
filtered.add(item);
}
}
}
}
}
}
return filtered;
}
示例3: testBindView_simpleWithJob
import hudson.model.View; //导入依赖的package包/类
@Test
public void testBindView_simpleWithJob() throws Exception {
JSONObject json = (JSONObject) JSONSerializer.toJSON(EMPTY_LIST_VIEW);
json.put("name", NAME);
// Add our job to the list view
json.put(project.getName(), true);
View view = underTest.bindView(viewGroupMixIn, NAME, json);
assertNotNull(view);
assertThat(view, instanceOf(ListView.class));
assertEquals(NAME, view.getViewName());
assertTrue(views.contains(view));
ListView listView = (ListView) view;
assertTrue(listView.jobNamesContains(project));
}
示例4: testBindView_simpleWithJobAndColumns
import hudson.model.View; //导入依赖的package包/类
@Test
public void testBindView_simpleWithJobAndColumns() throws Exception {
JSONObject json = (JSONObject) JSONSerializer.toJSON(EMPTY_LIST_VIEW);
json.put("name", NAME);
// Add our job to the list view
json.put(project.getName(), true);
// Add some columns to the view.
JSONArray columns = (JSONArray) JSONSerializer.toJSON(COLUMNS_JSON);
json.put("columns", columns);
View view = underTest.bindView(viewGroupMixIn, NAME, json);
assertNotNull(view);
assertThat(view, instanceOf(ListView.class));
assertEquals(NAME, view.getViewName());
assertTrue(views.contains(view));
ListView listView = (ListView) view;
assertTrue(listView.jobNamesContains(project));
assertEquals(2, listView.getColumns().size());
}
示例5: initPython
import hudson.model.View; //导入依赖的package包/类
private void initPython() {
if (pexec == null) {
pexec = new PythonExecutor(this);
String[] jMethods = new String[1];
jMethods[0] = "filter";
String[] pFuncs = new String[1];
pFuncs[0] = "filter";
Class[][] argTypes = new Class[1][];
argTypes[0] = new Class[3];
argTypes[0][0] = List.class;
argTypes[0][1] = List.class;
argTypes[0][2] = View.class;
pexec.checkAbstrMethods(jMethods, pFuncs, argTypes);
String[] functions = new String[1];
functions[0] = "get_descriptor";
int[] argsCount = new int[1];
argsCount[0] = 0;
pexec.registerFunctions(functions, argsCount);
}
}
示例6: doSearchSubmit
import hudson.model.View; //导入依赖的package包/类
public void doSearchSubmit(StaplerRequest req, StaplerResponse rsp)
throws IOException, UnsupportedEncodingException, ServletException,
Descriptor.FormException {
Hudson.getInstance().checkPermission(View.READ);
SearchAction action = SearchAction.fromRequest(req);
switch (action) {
case runSearchButton:
JobsFilter filter = new JobsFilter(req, this);
updateSearchCache(filter);
rsp.sendRedirect(".");
break;
case resetDefaultsButton:
updateSearchCache(getDefaultFilters());
rsp.sendRedirect(".");
break;
default:
throw new IOException("Action "+action+" is not supported");
}
}
示例7: filter
import hudson.model.View; //导入依赖的package包/类
@Override
public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) {
for (TopLevelItem item : all) {
if (added.contains(item)) {
continue;
}
if (SCMHead.HeadByItem.findHead(item) instanceof GitLabSCMTagHead) {
added.add(item);
}
}
return added;
}
示例8: filter
import hudson.model.View; //导入依赖的package包/类
@Override
public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) {
for (TopLevelItem item : all) {
if (added.contains(item)) {
continue;
}
SCMHead head = SCMHead.HeadByItem.findHead(item);
if (head instanceof GitLabSCMMergeRequestHead && (!originOnly || ((GitLabSCMMergeRequestHead) head).fromOrigin())) {
added.add(item);
}
}
return added;
}
示例9: filter
import hudson.model.View; //导入依赖的package包/类
@Override
public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) {
for (TopLevelItem item : all) {
if (added.contains(item)) {
continue;
}
SCMHead head = SCMHead.HeadByItem.findHead(item);
if (head instanceof GitLabSCMBranchHead && filter(item) && filter((GitLabSCMBranchHead) head)) {
added.add(item);
}
}
return added;
}
示例10: getViewsAffectedBy
import hudson.model.View; //导入依赖的package包/类
private Collection<View> getViewsAffectedBy(Run<?, ?> run) {
Collection<View> views = Jenkins.getInstance().getViews();
List<View> affected = new ArrayList<>(views.size());
TopLevelItem parent = getTopLevelParent(run);
if (parent != null) {
for (View view : views) {
if (view.contains(parent)) {
affected.add(view);
}
}
} else {
LOG.log(Level.WARNING, run.getParent().getClass() + " not instanceof TopLevelItem");
}
return affected;
}
示例11: trackViews
import hudson.model.View; //导入依赖的package包/类
public void trackViews(Run<?, ?> run) {
Collection<View> affectedViews = getViewsAffectedBy(run);
if (run.isBuilding()) {
ensureInitialState(affectedViews);
} else {
fireDifference(affectedViews);
}
}
示例12: fireDifference
import hudson.model.View; //导入依赖的package包/类
private void fireDifference(Collection<View> affectedViews) {
for (View view : affectedViews) {
String key = key(view);
Result newResult = getResult(view);
Result oldResult = results.get(key);
if(oldResult != null && !oldResult.equals(newResult)) {
results.put(key, newResult);
fireViewChanged(view, oldResult, newResult);
}
}
}
示例13: getResult
import hudson.model.View; //导入依赖的package包/类
private Result getResult(View view) {
Result ret = Result.SUCCESS;
for (TopLevelItem item : view.getAllItems()) {
for (Job<?,?> job : item.getAllJobs()) {
Run<?, ?> build = job.getLastCompletedBuild();
if(build != null) {
Result result = build.getResult();
if(result.isBetterOrEqualTo(Result.FAILURE))
ret = ret.combine(result);
}
}
}
return ret;
}
示例14: ensureInitialState
import hudson.model.View; //导入依赖的package包/类
private void ensureInitialState(Collection<View> affectedViews) {
for (View view : affectedViews) {
String key = key(view);
if (!results.containsKey(key)) {
results.put(key, getResult(view));
}
}
}
示例15: getACL
import hudson.model.View; //导入依赖的package包/类
@Override
public ACL getACL(final View item) {
return new ACL() {
@Override
public boolean hasPermission(Authentication a, Permission permission) {
ACL base = item.getOwner().getACL();
CloudProject cloudProject = cloudProjects.get(AclType.PROJECT);
if(item == null || null == cloudProject){
return true;
}
Set<Project> matchedViewProjects = cloudProject
.getMatchedViewsProjects(item.getViewName());
String currentUserId = DescriptorImpl.getCurrentUser();
for (Project project : matchedViewProjects) {
Set<String> members = cloudProject
.listProjectMembers(project.getProjectName());
if (members.contains(currentUserId)) {
if (permission == View.READ) {
return base.hasPermission(a, View.CONFIGURE)
|| !item.getItems().isEmpty();
}
return base.hasPermission(a, permission);
}
}
return false;
}
};
}