use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Versions_type0 in project carbon-business-process by wso2.
the class BPELPackageManagementServiceSkeleton method getAllVersionsOfPackage.
private Versions_type0 getAllVersionsOfPackage(BPELPackageInfo packageInfo, int maxRemainingPackages) throws PackageManagementException {
Versions_type0 versionsList = new Versions_type0();
List<String> versions = packageInfo.getAvailableVersions();
Collections.reverse(versions);
int count = 0;
int startIndex = maxRemainingPackages < 0 ? versions.size() + maxRemainingPackages : 0;
int endIndex = versions.size() - 1;
for (int i = startIndex; i <= endIndex && Math.abs(maxRemainingPackages) > count; i++) {
String version = versions.get(i);
Version_type0 packageVersion = new Version_type0();
packageVersion.setName(version);
packageVersion.setProcesses(getProcessesForPackage(version));
if (version.equals(packageInfo.getName() + "-" + packageInfo.getLatestVersion())) {
packageVersion.setIsLatest(true);
} else {
packageVersion.setIsLatest(false);
}
versionsList.addVersion(packageVersion);
count++;
}
return versionsList;
}
Aggregations