use of org.wso2.carbon.bpel.stub.mgt.types.CleanUpType in project carbon-business-process by wso2.
the class ProcessConfigurationImpl method setProcessCleanupConfImpl.
public void setProcessCleanupConfImpl(CleanUpListType cleanUpList) {
processCleanupConfImpl.getCleanupCategories(true).clear();
processCleanupConfImpl.getCleanupCategories(false).clear();
if (cleanUpList != null) {
List<TCleanup.Category.Enum> sucessCategoryList = new ArrayList<TCleanup.Category.Enum>();
List<TCleanup.Category.Enum> failCategoryList = new ArrayList<TCleanup.Category.Enum>();
CleanUpType[] cleanUpType = cleanUpList.getCleanUp();
if (cleanUpType != null) {
for (CleanUpType cleanUp : cleanUpType) {
if (cleanUp.getOn().getValue().equalsIgnoreCase("success")) {
CategoryListType sucCategoryListType = cleanUp.getCategoryList();
if (sucCategoryListType != null && sucCategoryListType.getCategory() != null) {
for (Category_type1 categoryType1 : sucCategoryListType.getCategory()) {
sucessCategoryList.add(TCleanup.Category.Enum.forString(categoryType1.getValue()));
}
ProcessCleanupConfImpl.processACleanup(processCleanupConfImpl.getCleanupCategories(true), sucessCategoryList);
}
}
if (cleanUp.getOn().getValue().equalsIgnoreCase("failure")) {
CategoryListType failCategoryListType = cleanUp.getCategoryList();
if (failCategoryListType != null && failCategoryListType.getCategory() != null) {
for (Category_type1 categoryType1 : failCategoryListType.getCategory()) {
failCategoryList.add(TCleanup.Category.Enum.forString(categoryType1.getValue()));
}
ProcessCleanupConfImpl.processACleanup(processCleanupConfImpl.getCleanupCategories(false), failCategoryList);
}
}
}
}
}
}
use of org.wso2.carbon.bpel.stub.mgt.types.CleanUpType in project carbon-business-process by wso2.
the class BPELPackageRepositoryUtils method getFailureCleanUpType.
public static CleanUpType getFailureCleanUpType(String failureCleanupsInString) {
CleanUpType failureCleanUp = new CleanUpType();
String[] failureCategories = getStringsFromArray(failureCleanupsInString);
CategoryListType categoryList = new CategoryListType();
for (String category : failureCategories) {
Category_type1 categoryType1 = Category_type1.Factory.fromValue(category.toLowerCase());
categoryList.addCategory(categoryType1);
}
failureCleanUp.setOn(On_type1.failure);
failureCleanUp.setCategoryList(categoryList);
return failureCleanUp;
}
use of org.wso2.carbon.bpel.stub.mgt.types.CleanUpType in project carbon-business-process by wso2.
the class ProcessManagementServiceSkeleton method getProcessDeploymentInfo.
/* The methods gets data from ProcessConfigurationImpl and display the details
* @param pid
* @return processDeployDetailsList
*
*/
public ProcessDeployDetailsList_type0 getProcessDeploymentInfo(QName pid) {
/* Configuring process basic information*/
ProcessDeployDetailsList processDeployDetailsList = new ProcessDeployDetailsList();
ProcessDeployDetailsList_type0 processDeployDetailsListType = new ProcessDeployDetailsList_type0();
TenantProcessStoreImpl tenantProcessStore = AdminServiceUtils.getTenantProcessStore();
ProcessConf processConf = tenantProcessStore.getProcessConfiguration(pid);
ProcessConfigurationImpl processConfiguration = (ProcessConfigurationImpl) processConf;
QName processId = processConfiguration.getProcessId();
processDeployDetailsListType.setProcessName(processId);
ProcessStatus processStatus = ProcessStatus.Factory.fromValue(processConfiguration.getState().name());
processDeployDetailsListType.setProcessState(processStatus);
processDeployDetailsListType.setIsInMemory(processConfiguration.isTransient());
/* Configuring invoked services by the process*/
List<TInvoke> invokeList = processConfiguration.getInvokedServices();
if (invokeList != null) {
InvokeServiceListType ist = new InvokeServiceListType();
for (TInvoke invoke : invokeList) {
InvokedServiceType invokedServiceType = new InvokedServiceType();
Service_type1 service = new Service_type1();
service.setName(invoke.getService().getName());
service.setPort(invoke.getService().getPort());
invokedServiceType.setService(service);
invokedServiceType.setPartnerLink(invoke.getPartnerLink());
ist.addInvokedService(invokedServiceType);
processDeployDetailsListType.setInvokeServiceList(ist);
}
}
/* Configuring providing services by the process*/
List<TProvide> provideList = processConfiguration.getProvidedServices();
if (provideList != null) {
ProvideServiceListType pst = new ProvideServiceListType();
for (TProvide provide : provideList) {
ProvidedServiceType providedServiceType = new ProvidedServiceType();
Service_type0 service = new Service_type0();
service.setName(provide.getService().getName());
service.setPort(provide.getService().getPort());
providedServiceType.setService(service);
providedServiceType.setPartnerLink(provide.getPartnerLink());
pst.addProvidedService(providedServiceType);
}
processDeployDetailsListType.setProvideServiceList(pst);
}
/* Configuring message exchange interceptors of the process*/
MexInterpreterListType mxt = new MexInterpreterListType();
List<String> mexInterceptor = processConfiguration.getMexInterceptors();
if (mexInterceptor != null) {
for (String mexInt : mexInterceptor) {
mxt.addMexinterpreter(mexInt);
}
}
processDeployDetailsListType.setMexInterperterList(mxt);
/* Configuring process level and scope level enabled events of process*/
Map<String, Set<BpelEvent.TYPE>> eventsMap = processConfiguration.getEvents();
ProcessEventsListType processEventsListType = new ProcessEventsListType();
EnableEventListType enableEventListType = new EnableEventListType();
ScopeEventListType scopeEventListType = new ScopeEventListType();
for (Map.Entry<String, Set<BpelEvent.TYPE>> eventEntry : eventsMap.entrySet()) {
if (eventEntry.getKey() != null) {
ScopeEventType scopeEvent = new ScopeEventType();
String scopeName = eventEntry.getKey();
EnableEventListType enableEventList = new EnableEventListType();
Set<BpelEvent.TYPE> typeSetforScope = eventEntry.getValue();
for (BpelEvent.TYPE type : typeSetforScope) {
enableEventList.addEnableEvent(type.toString());
}
scopeEvent.setScope(scopeName);
scopeEvent.setEnabledEventList(enableEventList);
scopeEventListType.addScopeEvent(scopeEvent);
} else {
Set<BpelEvent.TYPE> typeSet = eventEntry.getValue();
for (BpelEvent.TYPE aTypeSet : typeSet) {
enableEventListType.addEnableEvent(aTypeSet.toString());
}
}
}
TProcessEvents.Generate.Enum genEnum = processConfiguration.getGenerateType();
if (genEnum != null) {
Generate_type1 generate = Generate_type1.Factory.fromValue(genEnum.toString());
processEventsListType.setGenerate(generate);
}
processEventsListType.setEnableEventsList(enableEventListType);
processEventsListType.setScopeEventsList(scopeEventListType);
processDeployDetailsListType.setProcessEventsList(processEventsListType);
// end of process events
/* configuring properties defined in the process */
PropertyListType propertyListType = new PropertyListType();
Map<QName, Node> propertiesMap = processConfiguration.getProcessProperties();
Set<Map.Entry<QName, Node>> entries = propertiesMap.entrySet();
for (Map.Entry entry : entries) {
ProcessProperty_type0 property = new ProcessProperty_type0();
property.setName((QName) entry.getKey());
Node node = (Node) entry.getValue();
property.setValue(DOMUtils.domToStringLevel2(node));
propertyListType.addProcessProperty(property);
}
processDeployDetailsListType.setPropertyList(propertyListType);
CleanUpListType cleanUpList = new CleanUpListType();
Set<ProcessConf.CLEANUP_CATEGORY> sucessTypeCleanups = processConfiguration.getCleanupCategories(true);
Set<ProcessConf.CLEANUP_CATEGORY> failureTypeCleanups = processConfiguration.getCleanupCategories(false);
if (sucessTypeCleanups != null) {
CleanUpType cleanUp = new CleanUpType();
On_type1 onType = On_type1.success;
cleanUp.setOn(onType);
CategoryListType categoryListType = new CategoryListType();
for (ProcessConf.CLEANUP_CATEGORY sCategory : sucessTypeCleanups) {
Category_type1 categoryType1 = Category_type1.Factory.fromValue(sCategory.name().toLowerCase());
categoryListType.addCategory(categoryType1);
}
cleanUp.setCategoryList(categoryListType);
cleanUpList.addCleanUp(cleanUp);
}
if (failureTypeCleanups != null) {
CleanUpType cleanUp = new CleanUpType();
On_type1 onType = On_type1.failure;
cleanUp.setOn(onType);
CategoryListType categoryListType = new CategoryListType();
for (ProcessConf.CLEANUP_CATEGORY fCategory : failureTypeCleanups) {
Category_type1 categoryType1 = Category_type1.Factory.fromValue(fCategory.name().toLowerCase());
categoryListType.addCategory(categoryType1);
}
cleanUp.setCategoryList(categoryListType);
cleanUpList.addCleanUp(cleanUp);
}
processDeployDetailsListType.setCleanUpList(cleanUpList);
processDeployDetailsList.setProcessDeployDetailsList(processDeployDetailsListType);
return processDeployDetailsListType;
}
use of org.wso2.carbon.bpel.stub.mgt.types.CleanUpType in project carbon-business-process by wso2.
the class BpelUIUtil method setFailureTypeCleanups.
private static String[] setFailureTypeCleanups(ProcessDeployDetailsList_type0 processDeployDetailsListType) {
List<String> failureCategories = null;
if (processDeployDetailsListType.getCleanUpList() != null && processDeployDetailsListType.getCleanUpList().getCleanUp() != null) {
failureCategories = new ArrayList<String>();
CleanUpType[] cleanUpTypes = processDeployDetailsListType.getCleanUpList().getCleanUp();
for (CleanUpType cleanUpType : cleanUpTypes) {
if (cleanUpType.getOn().getValue().equalsIgnoreCase("failure") && cleanUpType.getCategoryList() != null) {
CategoryListType categoryList = cleanUpType.getCategoryList();
if (categoryList.getCategory() != null) {
Category_type1[] categories = categoryList.getCategory();
for (Category_type1 categoryType1 : categories) {
failureCategories.add(categoryType1.getValue());
}
}
}
}
}
// Collection to array
String[] failureList = new String[0];
if (failureCategories != null) {
failureList = failureCategories.toArray(new String[failureCategories.size()]);
}
return failureList;
}
use of org.wso2.carbon.bpel.stub.mgt.types.CleanUpType in project carbon-business-process by wso2.
the class BpelUIUtil method setSuccessTypeCleanups.
private static String[] setSuccessTypeCleanups(ProcessDeployDetailsList_type0 processDeployDetailsListType) {
List<String> successCategories = null;
if (processDeployDetailsListType.getCleanUpList() != null && processDeployDetailsListType.getCleanUpList().getCleanUp() != null) {
successCategories = new ArrayList<String>();
CleanUpType[] cleanUpTypes = processDeployDetailsListType.getCleanUpList().getCleanUp();
for (CleanUpType cleanUpType : cleanUpTypes) {
if (cleanUpType.getOn().getValue().equalsIgnoreCase("success") && cleanUpType.getCategoryList() != null) {
CategoryListType categoryList = cleanUpType.getCategoryList();
if (categoryList.getCategory() != null) {
Category_type1[] categories = categoryList.getCategory();
for (Category_type1 categoryType1 : categories) {
successCategories.add(categoryType1.getValue());
}
}
}
}
}
// Collection to array
String[] successList = new String[0];
if (successCategories != null) {
successList = successCategories.toArray(new String[successCategories.size()]);
}
return successList;
}
Aggregations