Search in sources :

Example 31 with org.wso2.carbon.humantask.client.api.types

use of org.wso2.carbon.humantask.client.api.types in project carbon-business-process by wso2.

the class HumanTaskServiceComponent method registerMBeans.

/**
 * to register all the MBeans.
 *
 * @throws Exception
 * @throws MBeanRegistrationException
 * @throws InstanceAlreadyExistsException
 * @throws NotCompliantMBeanException
 */
public void registerMBeans() throws Exception, MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException {
    log.info("Registering HT related MBeans");
    HTTaskStatusMonitor taskStatusMonitor = new HTTaskStatusMonitor();
    DeployedTasks deployedTasks = new DeployedTasks();
    MBeanRegistrar.registerMBean(taskStatusMonitor, "org.wso2.carbon.humantask.core.integration.jmx:type=HTTaskStatusMonitorMXBean");
    MBeanRegistrar.registerMBean(deployedTasks, "org.wso2.carbon.humantask.core.integration.jmx:type=DeployedTasksMXBean");
    log.info("MXBean for Human tasks registered successfully");
}
Also used : DeployedTasks(org.wso2.carbon.humantask.core.integration.jmx.DeployedTasks) HTTaskStatusMonitor(org.wso2.carbon.humantask.core.integration.jmx.HTTaskStatusMonitor)

Example 32 with org.wso2.carbon.humantask.client.api.types

use of org.wso2.carbon.humantask.client.api.types in project carbon-business-process by wso2.

the class HTCoordinationDAOConnectionImpl method createCoordinatedTask.

/**
 * @see org.wso2.carbon.bpel.b4p.coordination.dao.HTCoordinationDAOConnection#createCoordinatedTask(String,
 * String, String, String)
 */
@Override
public HTProtocolHandlerDAO createCoordinatedTask(String messageID, String htProtocolHandlerURL, String processInstanceID, String taskID) {
    HTProtocolHandlerDAO protocolHandlerDAO = new HTProtocolHandler();
    protocolHandlerDAO.setMessageID(messageID);
    protocolHandlerDAO.setProcessInstanceID(processInstanceID);
    protocolHandlerDAO.setTaskID(taskID);
    protocolHandlerDAO.setHumanTaskProtocolHandlerURL(htProtocolHandlerURL);
    entityManager.persist(protocolHandlerDAO);
    return protocolHandlerDAO;
}
Also used : HTProtocolHandler(org.wso2.carbon.bpel.b4p.coordination.dao.jpa.openjpa.entity.HTProtocolHandler) HTProtocolHandlerDAO(org.wso2.carbon.bpel.b4p.coordination.dao.HTProtocolHandlerDAO)

Example 33 with org.wso2.carbon.humantask.client.api.types

use of org.wso2.carbon.humantask.client.api.types in project carbon-business-process by wso2.

the class HTCoordinationDAOConnectionImpl method createCoordinatedTask.

/**
 * @see org.wso2.carbon.bpel.b4p.coordination.dao.HTCoordinationDAOConnection#createCoordinatedTask(String,
 * String, String, String)
 */
@Override
public HTProtocolHandlerDAO createCoordinatedTask(String messageID, String htProtocolHandlerURL, String processInstanceID, String taskID) {
    HTProtocolHandlerDAO protocolHandlerDAO = new HTProtocolHandler();
    protocolHandlerDAO.setMessageID(messageID);
    protocolHandlerDAO.setProcessInstanceID(processInstanceID);
    protocolHandlerDAO.setTaskID(taskID);
    protocolHandlerDAO.setHumanTaskProtocolHandlerURL(htProtocolHandlerURL);
    entityManager.persist(protocolHandlerDAO);
    return protocolHandlerDAO;
}
Also used : HTProtocolHandler(org.wso2.carbon.bpel.b4p.coordination.dao.jpa.openjpa.entity.HTProtocolHandler) HTProtocolHandlerDAO(org.wso2.carbon.bpel.b4p.coordination.dao.HTProtocolHandlerDAO)

Example 34 with org.wso2.carbon.humantask.client.api.types

use of org.wso2.carbon.humantask.client.api.types in project carbon-business-process by wso2.

the class BPSUserIdentityManager method checkPassword.

@Override
public Boolean checkPassword(String userId, String password) {
    String tenantDomain = MultitenantUtils.getTenantDomain(userId);
    String tenantAwareUserName = MultitenantUtils.getTenantAwareUsername(userId);
    String userNameWithTenantDomain = tenantAwareUserName + "@" + tenantDomain;
    RealmService realmService = RegistryContext.getBaseInstance().getRealmService();
    TenantManager mgr = realmService.getTenantManager();
    int tenantId = 0;
    try {
        tenantId = mgr.getTenantId(tenantDomain);
    } catch (UserStoreException e) {
        throw new BPMNAuthenticationException("Identity exception thrown while getting tenant ID for user : " + userNameWithTenantDomain, e);
    }
    // tenantId == -1, means an invalid tenant.
    if (tenantId == -1) {
        if (log.isDebugEnabled()) {
            log.debug("Basic authentication request with an invalid tenant : " + userNameWithTenantDomain);
        }
        return false;
    }
    org.wso2.carbon.user.api.UserStoreManager userStoreManager = null;
    boolean authStatus = false;
    try {
        userStoreManager = realmService.getTenantUserRealm(tenantId).getUserStoreManager();
        authStatus = userStoreManager.authenticate(tenantAwareUserName, password);
    } catch (UserStoreException e) {
        throw new BPMNAuthenticationException("User store exception thrown while authenticating user : " + userNameWithTenantDomain, e);
    }
    /* IdentityService identityService = BPMNOSGIService.getIdentityService();
        authStatus = identityService.checkPassword(userName, password);*/
    if (log.isDebugEnabled()) {
        log.debug("Basic authentication request completed. " + "Username : " + userNameWithTenantDomain + ", Authentication State : " + authStatus);
    }
    return authStatus;
}
Also used : RealmService(org.wso2.carbon.user.core.service.RealmService) UserStoreException(org.wso2.carbon.user.api.UserStoreException) BPMNAuthenticationException(org.wso2.carbon.bpmn.core.exception.BPMNAuthenticationException) TenantManager(org.wso2.carbon.user.core.tenant.TenantManager)

Example 35 with org.wso2.carbon.humantask.client.api.types

use of org.wso2.carbon.humantask.client.api.types in project carbon-business-process by wso2.

the class AttachmentMgtDAOBasicOperationsTest method createAttachment.

/**
 * Creates an attachment stub bean which is consumable by the Back-End server interface
 * {@link org.wso2.carbon.attachment.mgt.skeleton.AttachmentMgtServiceSkeletonInterface}
 *
 * @return an attachment stub bean which is consumable by the Back-End server interface
 */
private TAttachment createAttachment() {
    dummyAttachment = new TAttachment();
    dummyAttachment.setName("DummyName");
    dummyAttachment.setContentType("DummyContentType");
    dummyAttachment.setCreatedBy("DummyUser");
    DataHandler handler = new DataHandler(new FileDataSource(new File("src" + File.separator + "test" + File.separator + "resources" + File.separator + "dbConfig.xml")));
    dummyAttachment.setContent(handler);
    return dummyAttachment;
}
Also used : TAttachment(org.wso2.carbon.attachment.mgt.skeleton.types.TAttachment) FileDataSource(javax.activation.FileDataSource) DataHandler(javax.activation.DataHandler) File(java.io.File)

Aggregations

APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)18 APIMgtAdminService (org.wso2.carbon.apimgt.core.api.APIMgtAdminService)13 HashMap (java.util.HashMap)12 Query (javax.persistence.Query)9 ErrorDTO (org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO)9 ArrayList (java.util.ArrayList)8 Map (java.util.Map)8 APIMgtDAOException (org.wso2.carbon.apimgt.core.exception.APIMgtDAOException)5 TAttachment (org.wso2.carbon.attachment.mgt.skeleton.types.TAttachment)5 APIPolicy (org.wso2.carbon.apimgt.core.models.policy.APIPolicy)4 AttachmentDAO (org.wso2.carbon.attachment.mgt.core.dao.AttachmentDAO)4 AttachmentMgtException (org.wso2.carbon.attachment.mgt.core.exceptions.AttachmentMgtException)4 AttachmentMgtException (org.wso2.carbon.attachment.mgt.skeleton.AttachmentMgtException)4 Test (org.testng.annotations.Test)3 ConfigurationException (org.wso2.carbon.config.ConfigurationException)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 File (java.io.File)2 PrintStream (java.io.PrintStream)2 Connection (java.sql.Connection)2 List (java.util.List)2