Created
August 2, 2016 09:25
-
-
Save Genzer/b10ea3dd2100f4839e567c3d91d38d1e to your computer and use it in GitHub Desktop.
Obtain all CMSes from RELEASED `IProcessModelVersion`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoadAllReachableCmsesCommand implements Callable<Set<IContentManagementSystem>> { | |
@Override | |
public Set<IContentManagementSystem> call() throws Exception { | |
Set<IContentManagementSystem> cmses = new HashSet<>(); | |
for (IProcessModelVersion pmv : allReachablePmvs()) { | |
IContentManagementSystem cms = Ivy.cms() | |
.getContentManagement().findCms(pmv); | |
if (cms != null) { | |
cmses.add(cms); | |
} | |
} | |
return cmses; | |
} | |
private List<IProcessModelVersion> allReachablePmvs() { | |
List<IProcessModelVersion> pmvs = new ArrayList<>(); | |
for (IProcessModel pm : Ivy.wf().getApplication().getProcessModels()) { | |
IProcessModelVersion releasedPmv = pm.getReleasedProcessModelVersion(); | |
if (releasedPmv != null) { | |
pmvs.add(releasedPmv); | |
} | |
} | |
return pmvs; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment