Search in sources :

Example 11 with Activate

use of org.wso2.carbon.humantask.core.engine.commands.Activate in project carbon-business-process by wso2.

the class BPMNInstanceService method activateProcessInstance.

/**
 * Activate a process instance by passing the instance id
 *
 * @param instanceId
 * @throws BPSFault
 */
public void activateProcessInstance(String instanceId) throws BPSFault {
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    RuntimeService runtimeService = BPMNServerHolder.getInstance().getEngine().getRuntimeService();
    List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery().processInstanceTenantId(tenantId.toString()).processInstanceId(instanceId).list();
    if (processInstances.isEmpty()) {
        String msg = "No process instances with the ID: " + instanceId;
        log.error(msg);
        throw new BPSFault(msg);
    }
    runtimeService.activateProcessInstanceById(instanceId);
}
Also used : RuntimeService(org.activiti.engine.RuntimeService) BPSFault(org.wso2.carbon.bpmn.core.BPSFault) HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) ProcessInstance(org.activiti.engine.runtime.ProcessInstance)

Example 12 with Activate

use of org.wso2.carbon.humantask.core.engine.commands.Activate in project carbon-business-process by wso2.

the class TaskOperationsImpl method activate.

/**
 * Activate the task, i.e. set the task to status Ready (Administrative Operations)
 * @param taskIdURI : task identifier
 * @throws IllegalStateFault
 * @throws IllegalOperationFault
 * @throws IllegalArgumentFault
 * @throws IllegalAccessFault
 */
public void activate(URI taskIdURI) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
    try {
        final Long taskID = validateTaskId(taskIdURI);
        HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {

            public Object call() throws Exception {
                Activate activateCommand = new Activate(getCaller(), taskID);
                activateCommand.execute();
                return null;
            }
        });
    } catch (Exception ex) {
        handleException(ex);
    }
}
Also used : Activate(org.wso2.carbon.humantask.core.engine.commands.Activate) HumanTaskIllegalArgumentException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) HumanTaskIllegalStateException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException) HumanTaskIllegalOperationException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) HumanTaskException(org.wso2.carbon.humantask.core.engine.HumanTaskException) HumanTaskIllegalAccessException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException) HumanTaskRuntimeException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)

Example 13 with Activate

use of org.wso2.carbon.humantask.core.engine.commands.Activate in project product-iots by wso2.

the class ServiceComponent method activate.

protected void activate(ComponentContext ctx) {
    if (log.isDebugEnabled()) {
        log.debug("Activating b Management Service Component");
    }
    try {
        DeviceTypeManagerService deviceTypeManagerService = new DeviceTypeManagerService();
        BundleContext bundleContext = ctx.getBundleContext();
        serviceRegistration = bundleContext.registerService(DeviceManagementService.class.getName(), deviceTypeManagerService, null);
        String setupOption = System.getProperty("setup");
        if (setupOption != null) {
            if (log.isDebugEnabled()) {
                log.debug("-Dsetup is enabled. Iot Device management repository schema " + "initialization is about to begin");
            }
            try {
                DeviceTypeUtils.setupDeviceManagementSchema();
            } catch (DeviceMgtPluginException e) {
                log.error("Exception occurred while initializing device management database " + "schema", e);
            }
        }
        if (log.isDebugEnabled()) {
            log.debug("b Management Service Component has been successfully activated");
        }
    } catch (Throwable e) {
        log.error("Error occurred while activating Current Sensor Management Service " + "Component", e);
    }
}
Also used : DeviceMgtPluginException(org.wso2.iot.sampledevice.plugin.exception.DeviceMgtPluginException) DeviceTypeManagerService(org.wso2.iot.sampledevice.plugin.impl.DeviceTypeManagerService) BundleContext(org.osgi.framework.BundleContext)

Example 14 with Activate

use of org.wso2.carbon.humantask.core.engine.commands.Activate in project identity-outbound-auth-sms-otp by wso2-extensions.

the class SMSOTPAuthenticatorServiceComponent method activate.

protected void activate(ComponentContext ctxt) {
    try {
        SMSOTPAuthenticator authenticator = new SMSOTPAuthenticator();
        Hashtable<String, String> props = new Hashtable<String, String>();
        ctxt.getBundleContext().registerService(ApplicationAuthenticator.class.getName(), authenticator, props);
        if (log.isDebugEnabled()) {
            log.debug("SMSOTP authenticator is activated");
        }
    } catch (Throwable e) {
        log.fatal("Error while activating the SMSOTP authenticator ", e);
    }
}
Also used : SMSOTPAuthenticator(org.wso2.carbon.identity.authenticator.smsotp.SMSOTPAuthenticator) ApplicationAuthenticator(org.wso2.carbon.identity.application.authentication.framework.ApplicationAuthenticator) Hashtable(java.util.Hashtable)

Aggregations

BundleContext (org.osgi.framework.BundleContext)4 InputStream (java.io.InputStream)3 URL (java.net.URL)3 StAXOMBuilder (org.apache.axiom.om.impl.builder.StAXOMBuilder)3 ServerStartupObserver (org.wso2.carbon.core.ServerStartupObserver)2 HikariDataSource (com.zaxxer.hikari.HikariDataSource)1 Hashtable (java.util.Hashtable)1 Context (javax.naming.Context)1 NamingException (javax.naming.NamingException)1 RuntimeService (org.activiti.engine.RuntimeService)1 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)1 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)1 AxisFault (org.apache.axis2.AxisFault)1 ContextException (org.apache.ode.bpel.iapi.ContextException)1 ProcessConf (org.apache.ode.bpel.iapi.ProcessConf)1 ProcessStore (org.apache.ode.bpel.iapi.ProcessStore)1 Activate (org.osgi.service.component.annotations.Activate)1 Broker (org.wso2.carbon.apimgt.core.api.Broker)1 DataSource (org.wso2.carbon.apimgt.core.dao.impl.DataSource)1 DataSourceImpl (org.wso2.carbon.apimgt.core.dao.impl.DataSourceImpl)1