use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.LimitedProcessInfoType in project carbon-business-process by wso2.
the class AdminServiceUtils method createLimitedProcessInfoObject.
public static LimitedProcessInfoType createLimitedProcessInfoObject(ProcessConf processConf) {
LimitedProcessInfoType processInfoObject = new LimitedProcessInfoType();
processInfoObject.setPid(processConf.getProcessId().toString());
processInfoObject.setDeployedDate(toCalendar(processConf.getDeployDate()));
processInfoObject.setVersion(processConf.getVersion());
if (processConf.getState() == ProcessState.RETIRED) {
processInfoObject.setStatus(ProcessStatus.RETIRED);
} else if (processConf.getState() == ProcessState.DISABLED) {
processInfoObject.setStatus(ProcessStatus.DISABLED);
} else {
processInfoObject.setStatus(ProcessStatus.ACTIVE);
}
// check and set the olderVersion of the process
if (processConf.getState() == ProcessState.RETIRED) {
processInfoObject.setStatus(ProcessStatus.RETIRED);
processInfoObject.setOlderVersion(isOlderVersion(processConf, getTenantProcessStore()));
} else if (processConf.getState() == ProcessState.DISABLED) {
processInfoObject.setStatus(ProcessStatus.DISABLED);
processInfoObject.setOlderVersion(0);
} else {
processInfoObject.setStatus(ProcessStatus.ACTIVE);
processInfoObject.setOlderVersion(0);
}
processInfoObject.setPackageName(processConf.getPackage());
return processInfoObject;
}
use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.LimitedProcessInfoType in project carbon-business-process by wso2.
the class BPELApplicationAdmin method getBPELAppData.
/**
* Gives a BPELAppMetadata object with all bpel packages deployed through the
* given app.
*
* @param appName - input app name
* @return - BPELAppMetadata object with found artifact info
* @throws Exception - error on retrieving metadata
*/
public BPELAppMetadata getBPELAppData(String appName) throws Exception {
BPELAppMetadata data = new BPELAppMetadata();
String tenantId = AppDeployerUtils.getTenantIdString(getAxisConfig());
// Check whether there is an application in the system from the given name
ArrayList<CarbonApplication> appList = BPELAppMgtServiceComponent.getAppManager().getCarbonApps(tenantId);
CarbonApplication currentApplication = null;
for (CarbonApplication application : appList) {
if (appName.equals(application.getAppNameWithVersion())) {
currentApplication = application;
break;
}
}
// If the app not found, throw an exception
if (currentApplication == null) {
String msg = "No Carbon Application found of the name : " + appName;
log.error(msg);
throw new Exception(msg);
}
// get all dependent artifacts of the cApp
List<Artifact.Dependency> deps = currentApplication.getAppConfig().getApplicationArtifact().getDependencies();
// we use the bpel backend admin service to get processes from a bpel package
BPELPackageManagementServiceSkeleton bpelAdmin = new BPELPackageManagementServiceSkeleton();
// package list to return
List<PackageMetadata> packageList = new ArrayList<PackageMetadata>();
String packageName;
String versionLessPackageName;
Artifact artifact;
for (Artifact.Dependency dep : deps) {
artifact = dep.getArtifact();
versionLessPackageName = artifact.getName() + "-" + artifact.getVersion();
packageName = versionLessPackageName + "-" + bpelAdmin.getLatestVersionInPackage(versionLessPackageName);
if (packageName == null) {
continue;
}
if (BPELAppDeployer.BPEL_TYPE.equals(artifact.getType())) {
PackageMetadata packageMetadata = new PackageMetadata();
packageMetadata.setPackageName(packageName);
// get the list of processes
List<String> processList = new ArrayList<String>();
PackageType packageType = bpelAdmin.listProcessesInPackage(packageName);
for (Version_type0 packageVersion : packageType.getVersions().getVersion()) {
if (packageVersion.getName().equals(packageName)) {
for (LimitedProcessInfoType process : packageVersion.getProcesses().getProcess()) {
processList.add(process.getPid());
}
}
}
String[] processes = new String[processList.size()];
packageMetadata.setProcessList(processList.toArray(processes));
packageList.add(packageMetadata);
}
}
// convert the List into an array
data.setPackages(packageList.toArray(new PackageMetadata[packageList.size()]));
return data;
}
Aggregations