private void locationChanged(Item item, String oldFullName, String newFullName) { // update BuildTrigger of other projects that point to this object. // can't we generalize this? for( Project<?,?> p : Jenkins.getInstance().allItems(Project.class) ) { BuildTrigger t = p.getPublishersList().get(BuildTrigger.class); if(t!=null) { String cp2 = Items.computeRelativeNamesAfterRenaming(oldFullName, newFullName, t.childProjects, p.getParent()); if (!cp2.equals(t.childProjects)) { t.childProjects = cp2; try { p.save(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from "+oldFullName+" to "+newFullName,e); } } } } } }
/** * This method serializes this object to offline storage. The default * implementation of Jenkins is XML-File based, but that can be * overridden herein. Of course, if you override the saving method, * you will also have to override the loading method from * {@link InheritanceProject.DescriptorImpl}. */ @Override public synchronized void save() throws IOException { //Checking if we're marked as transient; which causes no saving to occur if (this.isTransient) { return; } //Invoking the super constructor to save use super.save(); //TODO: Save the version store to disk here }
/** * This method serializes this object to offline storage. The default * implementation of Jenkins is XML-File based, but that can be * overridden herein. Of course, if you override the saving method, * you will also have to override the loading method from * {@link InheritanceProject.DescriptorImpl}. */ @Override public synchronized void save() throws IOException { //Checking if we're marked as transient; which causes no saving to occur if (this.isTransient) { return; } //Invoking the super constructor to save use super.save(); //TODO: Save the version store to disk here }
@Override public final boolean setValues(Project<?, ?> project, List<String> list) { if (list.isEmpty()) { return false; } for (SonarRunnerBuilder builder : getSonarRunnerBuilders(project)) { doSetValue(builder, list.iterator().next()); } try { project.save(); } catch (IOException e) { Logger.LOG.throwing(this.getClass().getName(), "setValues", e); return false; } return true; }
@Override public void onRenamed(final Item item, final String oldName, final String newName) { for (final Project<?, ?> p : Jenkins.getInstance().getAllItems(Project.class)) { final BuildPipelineTrigger bpTrigger = p.getPublishersList().get(BuildPipelineTrigger.class); if (bpTrigger != null) { boolean changed = false; changed = bpTrigger.onDownstreamProjectRenamed(oldName, newName); if (changed) { try { p.save(); } catch (final IOException e) { Logger.getLogger(ItemListenerImpl.class.getName()).log(Level.SEVERE, String.format(Strings.getString("BuildPipelineTrigger.FailedPersistDuringRename_FMT"), //$NON-NLS-1$ oldName, newName), e); } } } } }
@Override public void onRenamed(Item item, String oldName, String newName) { // update DownstreamTrigger of other projects that point to this object. // can't we generalize this? for( Project<?,?> p : Hudson.getInstance().getProjects() ) { DownstreamTrigger t = p.getPublishersList().get(DownstreamTrigger.class); if(t!=null) { if(t.onJobRenamed(oldName,newName)) { try { p.save(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from "+oldName+" to "+newName,e); } } } } }
private void locationChanged(Item item, String oldFullName, String newFullName) { // update BuildTrigger of other projects that point to this object. // can't we generalize this? for( Project<?,?> p : Jenkins.getInstance().allItems(Project.class) ) { BuildTrigger t = p.getPublishersList().get(BuildTrigger.class); if(t!=null) { String cp2 = Items.computeRelativeNamesAfterRenaming(oldFullName, newFullName, t.childProjects, p.getParent()); if (!cp2.equals(t.childProjects)) { t.childProjects = cp2; try { p.save(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from "+oldFullName+" to "+newFullName,e); } } } } } }
@Override public void onRenamed(Item item, String oldName, String newName) { // update BuildTrigger of other projects that point to this object. // can't we generalize this? for (Project<?, ?> p : Hudson.getInstance().getProjects()) { BuildTrigger t = p.getPublishersList().get(BuildTrigger.class); if (t != null) { if (t.onJobRenamed(oldName, newName)) { try { p.save(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from " + oldName + " to " + newName, e); } } } } } }
@Override public void onRenamed(Item item, String oldName, String newName) { // update BuildTrigger of other projects that point to this object. // can't we generalize this? for( Project<?,?> p : Hudson.getInstance().getProjects() ) { BuildTrigger t = p.getPublishersList().get(BuildTrigger.class); if(t!=null) { if(t.onJobRenamed(oldName,newName)) { try { p.save(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from "+oldName+" to "+newName,e); } } } } } }
@Override public void onRenamed(Item item, String oldName, String newName) { // update BuildTrigger of other projects that point to this object. // can't we generalize this? for( Project<?,?> p : Hudson.getInstance().getProjects() ) { BuildTrigger t = p.getPublishersList().get(BuildTrigger.class); if(t!=null) { if(t.onJobRenamed(oldName,newName)) { try { p.save(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from "+oldName+" to "+newName,e); } } } } } }
@Override public void onRenamed(Item item, String oldName, String newName) { // update BuildTrigger of other projects that point to this object. // can't we generalize this? for( Project<?,?> p : Hudson.getInstance().getProjects() ) { BuildTrigger t = p.getPublishersList().get(BuildTrigger.class); if(t!=null) { if(t.onJobRenamed(oldName,newName)) { try { p.save(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to persist project setting during rename from "+oldName+" to "+newName,e); } } } } } }
p.getBuildersList().remove(tb); p.save(); } catch (IOException e) { Logger.getLogger(RenameListener.class.getName()).log(Level.WARNING,
@Override public void onRenamed(Item item, String oldName, String newName) { for (Project<?,?> p : Hudson.getInstance().getProjects()) { boolean changed = false; //iterate over post build triggers BuildTrigger bt = p.getPublishersList().get(BuildTrigger.class); if (bt != null) { for (BuildTriggerConfig c : bt.getConfigs()){ changed |= c.onJobRenamed(oldName, newName); } } //iterate over build step triggers TriggerBuilder tb = p.getBuildersList().get(TriggerBuilder.class); if (tb != null) { for (BuildTriggerConfig co : tb.getConfigs()){ changed |= co.onJobRenamed(oldName, newName); } } //if something changed, save the project if (changed){ try { p.save(); } catch (IOException e) { Logger.getLogger(RenameListener.class.getName()).log(Level.WARNING, "Failed to persist project setting during rename from "+oldName+" to "+newName, e); } } } }
p.getBuildersList().remove(tb); p.save(); } catch (IOException e) { Logger.getLogger(RenameListener.class.getName()).log(Level.WARNING,
p.save(); } catch (IOException e) { Logger.getLogger(RenameListener.class.getName()).log(Level.WARNING,