String packageIdToUpload = (versionStr != null && !versionStr.isEmpty()) ? packageId : null;
workflowManager.processUpload(packageIdToUpload, packageXpdl);
// load package
versionStr = workflowManager.getCurrentPackageVersion(packageId);
WorkflowPackage workflowPackage = workflowManager.getPackage(packageId, versionStr);
// create app from package if not specified
if (appDef == null) {
appDef = new AppDefinition();
appDef.setAppId(packageId);
appDef.setName(workflowPackage.getPackageName());
appDef.setVersion(new Long(1));
createAppDefinition(appDef);
}
// get package definition