Package org.switchyard.component.bpm.config.model.v1

Examples of org.switchyard.component.bpm.config.model.v1.V1UserGroupCallbackModel


                    bpmNamespace = value;
                    break;
                }
            }
        }
        BPMComponentImplementationModel componentImplementationModel = new V1BPMComponentImplementationModel(bpmNamespace.uri());
        boolean persistent = bpm.persistent();
        if (persistent) {
            componentImplementationModel.setPersistent(persistent);
        }
        String processId = bpm.processId();
        if (UNDEFINED.equals(processId)) {
            processId = bpmName;
        }
        componentImplementationModel.setProcessId(processId);
        OperationsModel operationsModel = new V1OperationsModel(bpmNamespace.uri());
        JavaService javaService = JavaService.fromClass(bpmInterface);
        for (Method method : bpmClass.getDeclaredMethods()) {
            BPMOperationType operationType = null;
            String eventId = null;
            Global[] globalMappingAnnotations = null;
            Input[] inputMappingAnnotations = null;
            Output[] outputMappingAnnotations = null;
            Fault[] faultMappingAnnotations = null;
            if (START_PROCESS_FILTER.matches(method)) {
                operationType = BPMOperationType.START_PROCESS;
                StartProcess startProcessAnnotation = method.getAnnotation(StartProcess.class);
                globalMappingAnnotations = startProcessAnnotation.globals();
                inputMappingAnnotations = startProcessAnnotation.inputs();
                outputMappingAnnotations = startProcessAnnotation.outputs();
                faultMappingAnnotations = startProcessAnnotation.faults();
            } else if (SIGNAL_EVENT_FILTER.matches(method)) {
                operationType = BPMOperationType.SIGNAL_EVENT;
                SignalEvent signalEventAnnotation = method.getAnnotation(SignalEvent.class);
                eventId = Strings.trimToNull(signalEventAnnotation.eventId());
                globalMappingAnnotations = signalEventAnnotation.globals();
                inputMappingAnnotations = signalEventAnnotation.inputs();
                outputMappingAnnotations = signalEventAnnotation.outputs();
                faultMappingAnnotations = signalEventAnnotation.faults();
            } else if (SIGNAL_EVENT_ALL_FILTER.matches(method)) {
                operationType = BPMOperationType.SIGNAL_EVENT_ALL;
                SignalEventAll signalEventAllAnnotation = method.getAnnotation(SignalEventAll.class);
                eventId = Strings.trimToNull(signalEventAllAnnotation.eventId());
                globalMappingAnnotations = signalEventAllAnnotation.globals();
                inputMappingAnnotations = signalEventAllAnnotation.inputs();
                outputMappingAnnotations = signalEventAllAnnotation.outputs();
                faultMappingAnnotations = signalEventAllAnnotation.faults();
            } else if (ABORT_PROCESS_INSTANCE_FILTER.matches(method)) {
                operationType = BPMOperationType.ABORT_PROCESS_INSTANCE;
                AbortProcessInstance abortProcessInstanceAnnotation = method.getAnnotation(AbortProcessInstance.class);
                globalMappingAnnotations = new Global[]{};
                inputMappingAnnotations = new Input[]{};
                outputMappingAnnotations = abortProcessInstanceAnnotation.outputs();
                faultMappingAnnotations = abortProcessInstanceAnnotation.faults();
            }
            if (operationType != null) {
                ServiceOperation serviceOperation = javaService.getOperation(method.getName());
                if (serviceOperation != null) {
                    OperationModel operationModel = new V1BPMOperationModel(bpmNamespace.uri());
                    operationModel.setEventId(eventId);
                    operationModel.setName(serviceOperation.getName());
                    operationModel.setType(operationType);
                    operationModel.setGlobals(toGlobalsModel(globalMappingAnnotations, bpmNamespace));
                    operationModel.setInputs(toInputsModel(inputMappingAnnotations, bpmNamespace));
                    operationModel.setOutputs(toOutputsModel(outputMappingAnnotations, bpmNamespace));
                    operationModel.setFaults(toFaultsModel(faultMappingAnnotations, bpmNamespace));
                    operationsModel.addOperation(operationModel);
                }
            }
        }
        if (!operationsModel.getOperations().isEmpty()) {
            componentImplementationModel.setOperations(operationsModel);
        }
        componentImplementationModel.setChannels(toChannelsModel(bpm.channels(), bpmNamespace, componentModel, switchyardNamespace));
        componentImplementationModel.setListeners(toListenersModel(bpm.listeners(), bpmNamespace));
        componentImplementationModel.setLoggers(toLoggersModel(bpm.loggers(), bpmNamespace));
        componentImplementationModel.setManifest(toManifestModel(bpm.manifest(), bpmNamespace));
        componentImplementationModel.setProperties(toPropertiesModel(bpm.properties(), bpmNamespace));
        componentImplementationModel.setUserGroupCallback(toUserGroupCallbackModel(bpm.userGroupCallback(), bpmNamespace));
        componentImplementationModel.setWorkItemHandlers(toWorkItemHandlersModel(bpm.workItemHandlers(), bpmNamespace));
        componentModel.setImplementation(componentImplementationModel);
        ComponentServiceModel componentServiceModel = new V1ComponentServiceModel(switchyardNamespace.uri());
        InterfaceModel interfaceModel = new V1InterfaceModel(InterfaceModel.JAVA);
        interfaceModel.setInterface(bpmInterface.getName());
        componentServiceModel.setInterface(interfaceModel);
View Full Code Here


    @Override
    public Model read(Configuration config) {
        String name = config.getName();
        Descriptor desc = getDescriptor();
        if (IMPLEMENTATION_BPM.equals(name)) {
            return new V1BPMComponentImplementationModel(config, desc);
        } else if (OPERATION.equals(name)) {
            return new V1BPMOperationModel(config, desc);
        } else if (USER_GROUP_CALLBACK.equals(name)) {
            return new V1UserGroupCallbackModel(config, desc);
        } else if (WORK_ITEM_HANDLERS.equals(name)) {
View Full Code Here

                faultMappingAnnotations = abortProcessInstanceAnnotation.faults();
            }
            if (operationType != null) {
                ServiceOperation serviceOperation = javaService.getOperation(method.getName());
                if (serviceOperation != null) {
                    OperationModel operationModel = new V1BPMOperationModel(bpmNamespace.uri());
                    operationModel.setEventId(eventId);
                    operationModel.setName(serviceOperation.getName());
                    operationModel.setType(operationType);
                    operationModel.setGlobals(toGlobalsModel(globalMappingAnnotations, bpmNamespace));
                    operationModel.setInputs(toInputsModel(inputMappingAnnotations, bpmNamespace));
                    operationModel.setOutputs(toOutputsModel(outputMappingAnnotations, bpmNamespace));
                    operationModel.setFaults(toFaultsModel(faultMappingAnnotations, bpmNamespace));
                    operationsModel.addOperation(operationModel);
                }
            }
        }
        if (!operationsModel.getOperations().isEmpty()) {
View Full Code Here

        String name = config.getName();
        Descriptor desc = getDescriptor();
        if (IMPLEMENTATION_BPM.equals(name)) {
            return new V1BPMComponentImplementationModel(config, desc);
        } else if (OPERATION.equals(name)) {
            return new V1BPMOperationModel(config, desc);
        } else if (USER_GROUP_CALLBACK.equals(name)) {
            return new V1UserGroupCallbackModel(config, desc);
        } else if (WORK_ITEM_HANDLERS.equals(name)) {
            return new V1WorkItemHandlersModel(config, desc);
        } else if (WORK_ITEM_HANDLER.equals(name)) {
View Full Code Here

        if (userGroupCallbackAnnotations == null || userGroupCallbackAnnotations.length == 0) {
            return null;
        }
        UserGroupCallbackModel userGroupCallbackModel = null;
        for (UserGroupCallback userGroupCallbackAnnotation : userGroupCallbackAnnotations) {
            userGroupCallbackModel = new V1UserGroupCallbackModel(bpmNamespace.uri());
            // SWITCHYARD-1755: internal api usage still required (public APIs insufficient)
            Class<? extends org.kie.internal.task.api.UserGroupCallback> clazz = userGroupCallbackAnnotation.value();
            userGroupCallbackModel.setClazz(clazz);
            userGroupCallbackModel.setProperties(toPropertiesModel(userGroupCallbackAnnotation.properties(), bpmNamespace));
            break;
View Full Code Here

        if (IMPLEMENTATION_BPM.equals(name)) {
            return new V1BPMComponentImplementationModel(config, desc);
        } else if (OPERATION.equals(name)) {
            return new V1BPMOperationModel(config, desc);
        } else if (USER_GROUP_CALLBACK.equals(name)) {
            return new V1UserGroupCallbackModel(config, desc);
        } else if (WORK_ITEM_HANDLERS.equals(name)) {
            return new V1WorkItemHandlersModel(config, desc);
        } else if (WORK_ITEM_HANDLER.equals(name)) {
            return new V1WorkItemHandlerModel(config, desc);
        }
View Full Code Here

        if (workItemHandlerAnnotations == null || workItemHandlerAnnotations.length == 0) {
            return null;
        }
        WorkItemHandlersModel workItemHandlersModel = new V1WorkItemHandlersModel(bpmNamespace.uri());
        for (WorkItemHandler workItemHandlerAnnotation : workItemHandlerAnnotations) {
            WorkItemHandlerModel workItemHandlerModel = new V1WorkItemHandlerModel(bpmNamespace.uri());
            Class<? extends org.kie.api.runtime.process.WorkItemHandler> clazz = workItemHandlerAnnotation.value();
            workItemHandlerModel.setClazz(clazz);
            String name = workItemHandlerAnnotation.name();
            if (UNDEFINED.equals(name)) {
                org.kie.api.runtime.process.WorkItemHandler wih = WorkItemHandlers.newWorkItemHandler(clazz, null, null);
                if (wih instanceof SwitchYardServiceTaskHandler) {
                    SwitchYardServiceTaskHandler ssth = (SwitchYardServiceTaskHandler)wih;
                    if (ssth.getName() != null) {
                        name = ssth.getName();
                    }
                } else if (wih instanceof AbstractHTWorkItemHandler) {
                    name = "Human Task";
                }
            }
            if (UNDEFINED.equals(name)) {
                name = clazz.getSimpleName();
            }
            workItemHandlerModel.setName(name);
            workItemHandlersModel.addWorkItemHandler(workItemHandlerModel);
        }
        return workItemHandlersModel;
    }
View Full Code Here

        } else if (USER_GROUP_CALLBACK.equals(name)) {
            return new V1UserGroupCallbackModel(config, desc);
        } else if (WORK_ITEM_HANDLERS.equals(name)) {
            return new V1WorkItemHandlersModel(config, desc);
        } else if (WORK_ITEM_HANDLER.equals(name)) {
            return new V1WorkItemHandlerModel(config, desc);
        }
        return super.read(config);
    }
View Full Code Here

    private WorkItemHandlersModel toWorkItemHandlersModel(WorkItemHandler[] workItemHandlerAnnotations, BPMNamespace bpmNamespace) {
        if (workItemHandlerAnnotations == null || workItemHandlerAnnotations.length == 0) {
            return null;
        }
        WorkItemHandlersModel workItemHandlersModel = new V1WorkItemHandlersModel(bpmNamespace.uri());
        for (WorkItemHandler workItemHandlerAnnotation : workItemHandlerAnnotations) {
            WorkItemHandlerModel workItemHandlerModel = new V1WorkItemHandlerModel(bpmNamespace.uri());
            Class<? extends org.kie.api.runtime.process.WorkItemHandler> clazz = workItemHandlerAnnotation.value();
            workItemHandlerModel.setClazz(clazz);
            String name = workItemHandlerAnnotation.name();
            if (UNDEFINED.equals(name)) {
                org.kie.api.runtime.process.WorkItemHandler wih = WorkItemHandlers.newWorkItemHandler(clazz, null, null);
                if (wih instanceof SwitchYardServiceTaskHandler) {
                    SwitchYardServiceTaskHandler ssth = (SwitchYardServiceTaskHandler)wih;
                    if (ssth.getName() != null) {
                        name = ssth.getName();
                    }
                } else if (wih instanceof AbstractHTWorkItemHandler) {
                    name = "Human Task";
                }
            }
            if (UNDEFINED.equals(name)) {
                name = clazz.getSimpleName();
            }
            workItemHandlerModel.setName(name);
            workItemHandlersModel.addWorkItemHandler(workItemHandlerModel);
        }
        return workItemHandlersModel;
    }
View Full Code Here

        } else if (OPERATION.equals(name)) {
            return new V1BPMOperationModel(config, desc);
        } else if (USER_GROUP_CALLBACK.equals(name)) {
            return new V1UserGroupCallbackModel(config, desc);
        } else if (WORK_ITEM_HANDLERS.equals(name)) {
            return new V1WorkItemHandlersModel(config, desc);
        } else if (WORK_ITEM_HANDLER.equals(name)) {
            return new V1WorkItemHandlerModel(config, desc);
        }
        return super.read(config);
    }
View Full Code Here

TOP

Related Classes of org.switchyard.component.bpm.config.model.v1.V1UserGroupCallbackModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.