hudson.model.AbstractItem Java Examples
The following examples show how to use
hudson.model.AbstractItem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamicSubProject.java From DotCi with MIT License | 6 votes |
@Override public void onLoad(final ItemGroup<? extends Item> parent, final String name) throws IOException { try { final Field parentField = AbstractItem.class.getDeclaredField("parent"); parentField.setAccessible(true); ReflectionUtils.setField(parentField, this, parent); } catch (final Exception e) { throw new RuntimeException(e); } doSetName(name); if (this.transientActions == null) { this.transientActions = new Vector<>(); } updateTransientActions(); getBuildersList().setOwner(this); getPublishersList().setOwner(this); getBuildWrappersList().setOwner(this); initRepos(); }
Example #2
Source File: FolderAuthorizationStrategyManagementLink.java From folder-auth-plugin with MIT License | 5 votes |
/** * Get all {@link AbstractFolder}s in the system * * @return full names of all {@link AbstractFolder}s in the system */ @GET @Nonnull @Restricted(NoExternalUse.class) public JSONArray doGetAllFolders() { Jenkins jenkins = Jenkins.get(); jenkins.checkPermission(Jenkins.ADMINISTER); List<AbstractFolder> folders; try (ACLContext ignored = ACL.as(ACL.SYSTEM)) { folders = jenkins.getAllItems(AbstractFolder.class); } return JSONArray.fromObject(folders.stream().map(AbstractItem::getFullName).collect(Collectors.toList())); }
Example #3
Source File: FolderBasedAuthorizationStrategy.java From folder-auth-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Nonnull @Override public SidACL getACL(AbstractItem item) { String fullName = item.getFullName(); SidACL acl = jobAclCache.getIfPresent(fullName); if (acl != null) { return acl; } String[] splits = fullName.split(FOLDER_SEPARATOR); StringBuilder sb = new StringBuilder(fullName.length()); acl = globalAcl; // Roles on a folder are applicable to all children for (String str : splits) { sb.append(str); SidACL newAcl = jobAcls.get(sb.toString()); if (newAcl != null) { acl = acl.newInheritingACL(newAcl); } sb.append(FOLDER_SEPARATOR); } jobAclCache.put(fullName, acl); return acl; }
Example #4
Source File: ItemChangeListenerTest.java From audit-log-plugin with MIT License | 5 votes |
@Issue("JENKINS-56641") @Test public void testAuditOnItemUpdate() throws Exception { FreeStyleProject project = j.createFreeStyleProject("Test build"); AbstractItem item = (AbstractItem) project; item.setDescription("Item created for testing the updates"); item.save(); List<LogEvent> events = app.getEvents(); assertThat(events).hasSize(2); assertThat(events).extracting(event -> ((AuditMessage) event.getMessage()).getId().toString()).containsSequence("createItem", "updateItem"); }
Example #5
Source File: AbstractPipelineImpl.java From blueocean-plugin with MIT License | 5 votes |
public static Map<String, Boolean> getPermissions(AbstractItem item){ return ImmutableMap.of( BluePipeline.CREATE_PERMISSION, item.getACL().hasPermission(Item.CREATE), BluePipeline.CONFIGURE_PERMISSION, item.getACL().hasPermission(Item.CONFIGURE), BluePipeline.READ_PERMISSION, item.getACL().hasPermission(Item.READ), BluePipeline.START_PERMISSION, item.getACL().hasPermission(Item.BUILD), BluePipeline.STOP_PERMISSION, item.getACL().hasPermission(Item.CANCEL) ); }
Example #6
Source File: PipelineFolderImpl.java From blueocean-plugin with MIT License | 5 votes |
@Override public String getName() { if(folder instanceof AbstractItem) return ((AbstractItem) folder).getName(); else return folder.getDisplayName(); }
Example #7
Source File: PipelineFolderImpl.java From blueocean-plugin with MIT License | 5 votes |
@Override public Map<String, Boolean> getPermissions() { if(folder instanceof AbstractItem){ AbstractItem item = (AbstractItem) folder; return AbstractPipelineImpl.getPermissions(item); }else{ return null; } }
Example #8
Source File: FolderBasedAuthorizationStrategy.java From folder-auth-plugin with MIT License | 4 votes |
/** * Gets the {@link ACL} for a {@link Job} * * @return the {@link ACL} for the {@link Job} */ @Nonnull @Override public SidACL getACL(Job<?, ?> project) { return getACL((AbstractItem) project); }
Example #9
Source File: MockAuthorizationStrategy.java From jenkins-test-harness with MIT License | 4 votes |
@Override public ACL getACL(AbstractItem item) { return new ACLImpl(item.getFullName()); }
Example #10
Source File: MockAuthorizationStrategy.java From jenkins-test-harness with MIT License | 4 votes |
@Override public ACL getACL(Job<?, ?> project) { return getACL((AbstractItem) project); // stupid overload }
Example #11
Source File: DbBackedProject.java From DotCi with MIT License | 4 votes |
@PostLoad private void restoreName(final DBObject dbObj) { GReflectionUtils.setField(AbstractItem.class, "name", this, dbObj.get("name")); }