@Override public void save(Config config) { configs.remove(config); configs.add(config); try { getOwner().save(); } catch (IOException e) { throw new RuntimeException("failed to save config to store", e); } }
@Override public void remove(String id) { Config c = getById(id); if (c != null) { configs.remove(c); try { getOwner().save(); } catch (IOException e) { throw new RuntimeException("failed to remove config from store", e); } } }
/** * {@inheritDoc} */ @SuppressWarnings("deprecation") @Override public void onRenamed(I item, String oldName, String newName) throws IOException { items.remove(oldName); items.put(newName, item); // For compatibility with old views: for (View v : folderViews.getViews()) { v.onJobRenamed(item, oldName, newName); } save(); }
/** * {@inheritDoc} */ @SuppressWarnings("deprecation") @Override public void onRenamed(I item, String oldName, String newName) throws IOException { items.remove(oldName); items.put(newName, item); // For compatibility with old views: for (View v : folderViews.getViews()) { v.onJobRenamed(item, oldName, newName); } save(); }
/** * {@inheritDoc} */ @SuppressWarnings("deprecation") @Override public void onDeleted(I item) throws IOException { ItemListener.fireOnDeleted(item); items.remove(item.getName()); // For compatibility with old views: for (View v : folderViews.getViews()) { v.onJobRenamed(item, item.getName(), null); } save(); }
/** * {@inheritDoc} */ @SuppressWarnings("deprecation") @Override public void onDeleted(I item) throws IOException { ItemListener.fireOnDeleted(item); items.remove(item.getName()); // For compatibility with old views: for (View v : folderViews.getViews()) { v.onJobRenamed(item, item.getName(), null); } save(); }
/** * Short-cut method that redundantly checks the specified permission (to catch any typos) and then escalates * authentication in order to save the {@link CredentialsStore}. * * @param p the permissions of the operation being performed. * @throws IOException if something goes wrong. */ private void checkedSave(Permission p) throws IOException { checkPermission(p); try (ACLContext oldContext = ACL.as(ACL.SYSTEM)) { FolderCredentialsProperty property = owner.getProperties().get(FolderCredentialsProperty.class); if (property == null) { synchronized (emptyProperties) { owner.getProperties().add(this); emptyProperties.remove(owner); } } // we assume it is ourselves owner.save(); } }
/** * Short-cut method that redundantly checks the specified permission (to catch any typos) and then escalates * authentication in order to save the {@link CredentialsStore}. * * @param p the permissions of the operation being performed. * @throws IOException if something goes wrong. */ private void checkedSave(Permission p) throws IOException { checkPermission(p); SecurityContext orig = ACL.impersonate(ACL.SYSTEM); try { FolderCredentialsProperty property = owner.getProperties().get(FolderCredentialsProperty.class); if (property == null) { synchronized (emptyProperties) { owner.getProperties().add(this); emptyProperties.remove(owner); } } // we assume it is ourselves owner.save(); } finally { SecurityContextHolder.setContext(orig); } }
/** * Makes the folder disabled. Will have no effect if the folder type does not {@linkplain #supportsMakeDisabled()}. * @param disabled {@code true} if the folder should be disabled. * @throws IOException if the operation could not complete. * @since 6.1.0 */ public void makeDisabled(boolean disabled) throws IOException { if (isDisabled() == disabled) { return; // noop } if (disabled && !supportsMakeDisabled()) { return; // do nothing if the disabling is unsupported } setDisabled(disabled); if (disabled && this instanceof Queue.Task) { Jenkins.getActiveInstance().getQueue().cancel((Queue.Task)this); } save(); ItemListener.fireOnUpdated(this); }
/** * Makes the folder disabled. Will have no effect if the folder type does not {@linkplain #supportsMakeDisabled()}. * @param disabled {@code true} if the folder should be disabled. * @throws IOException if the operation could not complete. * @since 6.1.0 */ public void makeDisabled(boolean disabled) throws IOException { if (isDisabled() == disabled) { return; // noop } if (disabled && !supportsMakeDisabled()) { return; // do nothing if the disabling is unsupported } setDisabled(disabled); if (disabled && this instanceof Queue.Task) { Jenkins.get().getQueue().cancel((Queue.Task)this); } save(); ItemListener.fireOnUpdated(this); }
makeDisabled(json.optBoolean("disable")); save(); bc.commit(); } finally {
makeDisabled(json.optBoolean("disable")); save(); bc.commit(); } finally {