use of org.wso2.carbon.user.api.Tenant in project carbon-business-process by wso2.
the class HTQueryBuildHelperImpl method getAllDeployedTasks.
/**
* @param ltenantID
* @return all the deployed tasks for the given tenant
*/
public List<HumanTaskBaseConfiguration> getAllDeployedTasks(long ltenantID) {
int tenantID = (int) ltenantID;
HumanTaskStore humanTaskStore = HumanTaskServiceComponent.getHumanTaskServer().getTaskStoreManager().getHumanTaskStore(tenantID);
List<HumanTaskBaseConfiguration> humanTaskConfigurations = humanTaskStore.getTaskConfigurations();
return humanTaskConfigurations;
}
use of org.wso2.carbon.user.api.Tenant in project carbon-business-process by wso2.
the class HumanTaskDeployer method init.
public void init(ConfigurationContext configurationContext) {
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
log.info("Initializing HumanTask Deployer for tenant " + tenantId + ".");
try {
HumanTaskDeployerServiceComponent.getTenantRegistryLoader().loadTenantRegistry(tenantId);
createHumanTaskRepository(configurationContext);
HumanTaskServer humantaskServer = HumanTaskDeployerServiceComponent.getHumanTaskServer();
humanTaskStore = humantaskServer.getTaskStoreManager().createHumanTaskStoreForTenant(tenantId, configurationContext);
} catch (DeploymentException e) {
log.warn(String.format("Human Task Repository creation failed for tenant id [%d]", tenantId), e);
} catch (RegistryException e) {
log.warn("Initializing HumanTask Deployer failed for tenant " + tenantId, e);
}
}
use of org.wso2.carbon.user.api.Tenant in project carbon-business-process by wso2.
the class TaskOperationsImpl method getUserListForRole.
private TUser[] getUserListForRole(String roleName, int tenantId, String actualOwnerUserName) throws RegistryException, UserStoreException {
TUser[] userList = new TUser[0];
RegistryService registryService = HumanTaskServiceComponent.getRegistryService();
if (registryService != null && registryService.getUserRealm(tenantId) != null) {
UserRealm userRealm = registryService.getUserRealm(tenantId);
String[] assignableUserNameList = userRealm.getUserStoreManager().getUserListOfRole(roleName);
if (assignableUserNameList != null) {
userList = new TUser[assignableUserNameList.length];
for (int i = 0; i < assignableUserNameList.length; i++) {
TUser user = new TUser();
user.setTUser(assignableUserNameList[i]);
if (StringUtils.isEmpty(actualOwnerUserName)) {
userList[i] = user;
} else if (StringUtils.isNotEmpty(actualOwnerUserName) && !actualOwnerUserName.equals(assignableUserNameList[i])) {
userList[i] = user;
}
}
}
} else {
log.warn("Cannot load User Realm for Tenant Id: " + tenantId);
}
return userList;
}
use of org.wso2.carbon.user.api.Tenant in project carbon-business-process by wso2.
the class AnalyticsServerProfileBuilder method build.
/**
* Creates AnalyticsServerProfile for given tenant and Analytic profile.
*
* @return AnalyticsServerProfile instance
*/
public AnalyticsServerProfile build() {
AnalyticsServerProfile analyticsServerProfile = new AnalyticsServerProfile();
Registry registry;
String location;
if (profileLocation.startsWith(UnifiedEndpointConstants.VIRTUAL_CONF_REG)) {
try {
registry = BPELServiceComponent.getRegistryService().getConfigSystemRegistry(tenantId);
location = profileLocation.substring(profileLocation.indexOf(UnifiedEndpointConstants.VIRTUAL_CONF_REG) + UnifiedEndpointConstants.VIRTUAL_CONF_REG.length());
loadAnalyticsProfileFromRegistry(analyticsServerProfile, registry, location);
} catch (RegistryException re) {
String errMsg = "Error while loading Analytic profile from config registry.";
handleError(errMsg, re);
}
} else if (profileLocation.startsWith(UnifiedEndpointConstants.VIRTUAL_GOV_REG)) {
try {
registry = BPELServiceComponent.getRegistryService().getGovernanceSystemRegistry(tenantId);
location = profileLocation.substring(profileLocation.indexOf(UnifiedEndpointConstants.VIRTUAL_GOV_REG) + UnifiedEndpointConstants.VIRTUAL_GOV_REG.length());
loadAnalyticsProfileFromRegistry(analyticsServerProfile, registry, location);
} catch (RegistryException re) {
String errMsg = "Error while loading Analytic profile from governance registry.";
handleError(errMsg, re);
}
} else if (profileLocation.startsWith(UnifiedEndpointConstants.VIRTUAL_REG)) {
try {
registry = BPELServiceComponent.getRegistryService().getLocalRepository(tenantId);
location = profileLocation.substring(profileLocation.indexOf(UnifiedEndpointConstants.VIRTUAL_REG) + UnifiedEndpointConstants.VIRTUAL_REG.length());
loadAnalyticsProfileFromRegistry(analyticsServerProfile, registry, location);
} catch (RegistryException re) {
String errMsg = "Error while loading Analytic profile from local registry";
handleError(errMsg, re);
}
} else if (profileLocation.startsWith(UnifiedEndpointConstants.VIRTUAL_FILE)) {
location = profileLocation.substring(profileLocation.indexOf(UnifiedEndpointConstants.VIRTUAL_FILE) + UnifiedEndpointConstants.VIRTUAL_FILE.length());
loadAnalyticsProfileFromFileSystem(analyticsServerProfile, location);
} else {
String errMsg = "Invalid analytics profile location: " + profileLocation;
handleError(errMsg);
}
return analyticsServerProfile;
}
use of org.wso2.carbon.user.api.Tenant in project carbon-business-process by wso2.
the class HumanTaskStore method createAxisService.
// Creates the AxisService object from the provided ServiceBuilder object.
private AxisService createAxisService(WSDL11ToAxisServiceBuilder serviceBuilder, HumanTaskBaseConfiguration config) throws AxisFault {
AxisService axisService;
axisService = serviceBuilder.populateService();
axisService.setParent(getTenantAxisConfig());
axisService.setWsdlFound(true);
axisService.setCustomWsdl(true);
// axisService.setFileName(new URL(taskConfig.getWsdlDefLocation()));
axisService.setClassLoader(getTenantAxisConfig().getServiceClassLoader());
Utils.setEndpointsToAllUsedBindings(axisService);
axisService.addParameter(new Parameter("modifyUserWSDLPortAddress", "true"));
/* Setting service type to use in service management*/
axisService.addParameter(ServerConstants.SERVICE_TYPE, "humantask");
/* Fix for losing of security configuration when updating human-task package*/
axisService.addParameter(new Parameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM, "true"));
Iterator operations = axisService.getOperations();
AxisHumanTaskMessageReceiver msgReceiver = new AxisHumanTaskMessageReceiver();
msgReceiver.setHumanTaskEngine(HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine());
// Setting the task configuration to the message receiver. Hence no need to search for task configuration, when
// the actual task invocation happens, we will already have the task configuration attached to the message receiver
// itself
msgReceiver.setTaskBaseConfiguration(config);
while (operations.hasNext()) {
AxisOperation operation = (AxisOperation) operations.next();
// Setting Message Receiver even if operation has a message receiver specified.
// This is to fix the issue when build service configuration using services.xml(Always RPCMessageReceiver
// is set to operations).
operation.setMessageReceiver(msgReceiver);
getTenantAxisConfig().getPhasesInfo().setOperationPhases(operation);
}
Set<String> exposedTransports = getTenantAxisConfig().getTransportsIn().keySet();
// Add the transports to axis2 service by reading from the tenant transport config
for (String transport : exposedTransports) {
axisService.addExposedTransport(transport);
}
if (HumanTaskServiceComponent.getHumanTaskServer().getServerConfig().isHtCoordinationEnabled() && HumanTaskServiceComponent.getHumanTaskServer().getServerConfig().isTaskRegistrationEnabled() && config.getConfigurationType() == HumanTaskBaseConfiguration.ConfigurationType.TASK) {
// Only Engage coordination module in-case of Tasks. Coordination module is not required for notifications
axisService.engageModule(getConfigContext().getAxisConfiguration().getModule("htcoordination"));
}
return axisService;
}
Aggregations