Skip to content
Permalink
Browse files

Merge pull request #11 from jenkinsci/jenkins-37816

[JENKINS-37816] Upgrade folders plugin dependency to 5.0 and restore API compatability
  • Loading branch information...
stephenc committed Aug 30, 2016
2 parents 220567d + c4eda05 commit d1e211fa3c479690b03597cd6e8b8bd8aec89387
Showing with 13 additions and 7 deletions.
  1. +1 −1 pom.xml
  2. +12 −6 src/main/java/org/jenkinsci/plugins/uniqueid/impl/FolderIdStore.java
@@ -46,7 +46,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>cloudbees-folder</artifactId>
<version>4.0</version>
<version>5.0</version>
<optional>true</optional>
</dependency>
<dependency>
@@ -1,5 +1,8 @@
package org.jenkinsci.plugins.uniqueid.impl;

import com.cloudbees.hudson.plugins.folder.AbstractFolder;
import com.cloudbees.hudson.plugins.folder.AbstractFolderProperty;
import com.cloudbees.hudson.plugins.folder.AbstractFolderPropertyDescriptor;
import hudson.Extension;
import hudson.model.Action;
import hudson.model.Actionable;
@@ -32,16 +35,19 @@ public FolderIdStore() {

@Override
public void remove(Folder folder) throws IOException {
DescribableList<FolderProperty<?>,FolderPropertyDescriptor> properties = folder.getProperties();

for (Iterator<FolderProperty<?>> itr = properties.iterator(); itr.hasNext(); ) {
FolderProperty<?> prop = itr.next();
DescribableList<AbstractFolderProperty<?>,AbstractFolderPropertyDescriptor> properties = folder.getProperties();
boolean needSave = false;
for (Iterator<AbstractFolderProperty<?>> itr = properties.iterator(); itr.hasNext(); ) {
AbstractFolderProperty<?> prop = itr.next();

if (prop instanceof FolderIdProperty) {
itr.remove();
needSave = true;
}
}
folder.save();
if (needSave) {
folder.save();
}
}

@Override
@@ -77,7 +83,7 @@ public String getDisplayName() {
}

@Override
public boolean isApplicable(Class<? extends Folder> containerType) {
public boolean isApplicable(Class<? extends AbstractFolder> containerType) {
return false;
}
}

0 comments on commit d1e211f

Please sign in to comment.
You can’t perform that action at this time.