use of org.wso2.carbon.humantask.client.api.types in project core-util by WSO2Telco.
the class UserAuthorizationValidator method isAuthorizedRole.
public boolean isAuthorizedRole(String userName, Set<String> allowedRolesSet) {
PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
RealmService realmService = (RealmService) carbonContext.getOSGiService(RealmService.class, null);
try {
RealmConfiguration realmConfiguration = new RealmConfiguration();
String[] currentUserRoles = realmService.getUserRealm(realmConfiguration).getUserStoreManager().getRoleListOfUser(userName);
List<String> currentUserRolesList = Arrays.asList(currentUserRoles);
Iterator<String> iterator = allowedRolesSet.iterator();
while (iterator.hasNext()) {
String allowedRole = iterator.next();
if (currentUserRolesList.contains(allowedRole)) {
return true;
}
}
} catch (org.wso2.carbon.user.api.UserStoreException e) {
log.error("authorization failed for user : " + userName, e);
return false;
}
log.error("authorization failed for user : " + userName);
return false;
}
use of org.wso2.carbon.humantask.client.api.types in project carbon-business-process by wso2.
the class AttachmentManagerService method add.
/**
* {@inheritDoc}
*/
@Override
public String add(final TAttachment attachment) throws AttachmentMgtException {
if (log.isDebugEnabled() && attachment != null) {
log.debug("Saving the attachment with id " + attachment.getId());
}
try {
Attachment att = TransformerUtil.convertAttachment(attachment);
// 1. get Att-Mgt DAO Conn factory
// 2. get Att-Mgt DAO Connection
// 3. addAttachment
// getDaoConnectionFactory().getDAOConnection().addAttachment(att);
AttachmentDAO daoImpl = getDaoConnectionFactory().getDAOConnection().getAttachmentMgtDAOFactory().addAttachment(att);
return daoImpl.getID().toString();
} catch (org.wso2.carbon.attachment.mgt.core.exceptions.AttachmentMgtException ex) {
String errMsg = "org.wso2.carbon.attachment.mgt.core.service.AttachmentManagerService.add " + "operation failed. Reason:" + ex.getLocalizedMessage();
log.error(errMsg, ex);
throw new AttachmentMgtException(errMsg, ex);
}
}
use of org.wso2.carbon.humantask.client.api.types in project carbon-business-process by wso2.
the class Database method createActivitiMetaDataTable.
/**
* during the start up of the server this method will create BPS_BPMN_DEPLOYMENT_METADATA table
* if it doesn't exist in the activiti database.
*
* @throws org.wso2.carbon.bpmn.core.exception.BPMNMetaDataTableCreationException
*/
private void createActivitiMetaDataTable() throws BPMNMetaDataTableCreationException {
BPMNDatabaseCreator bpmnDatabaseCreator = new BPMNDatabaseCreator(getDataSource());
String bpmnDeploymentMetaDataQuery = "SELECT * FROM " + BPMNConstants.BPS_BPMN_DEPLOYMENT_METADATA_TABLE;
if (!bpmnDatabaseCreator.isDatabaseStructureCreated(bpmnDeploymentMetaDataQuery)) {
try {
bpmnDatabaseCreator.createRegistryDatabase();
} catch (Exception e) {
String errMsg = "Error creating BPS_BPMN_DEPLOYMENT_METADATA table";
throw new BPMNMetaDataTableCreationException(errMsg, e);
}
} else {
if (log.isDebugEnabled()) {
log.debug("BPS_BPMN_DEPLOYMENT_METADATA table already exists. Using the old table.");
}
}
}
use of org.wso2.carbon.humantask.client.api.types in project carbon-business-process by wso2.
the class BPELServerImpl method registerMBeans.
public void registerMBeans() throws Exception, MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException {
log.info("Registering MBeans");
Processes processMBean = new Processes();
Instance instanceMBean = new Instance();
InstanceStatusMonitor statusMonitorMBean = InstanceStatusMonitor.getInstanceStatusMonitor();
// ObjectName instanceStatusObjectName= new ObjectName("org.wso2.carbon.bpel.core.ode.integration
// .jmx:type=InstanceStatusMonitor");
// ObjectName processObjectName= new ObjectName("org.wso2.carbon.bpel.core.ode.integration.jmx:type=Process");
// ObjectName instanceObjectName= new ObjectName("org.wso2.carbon.bpel.core.ode.integration.jmx:type=Instance");
MBeanRegistrar.registerMBean(processMBean, "org.wso2.carbon.bpel.core.ode.integration.jmx:type=Process");
MBeanRegistrar.registerMBean(instanceMBean, "org.wso2.carbon.bpel.core.ode.integration.jmx:type=Instance");
MBeanRegistrar.registerMBean(statusMonitorMBean, "org.wso2.carbon.bpel.core.ode.integration" + ".jmx:type=InstanceStatusMonitor");
}
use of org.wso2.carbon.humantask.client.api.types in project carbon-business-process by wso2.
the class TenantProcessStoreImpl method reloadExistingVersionsOfBPELPackage.
/**
* Reload old versions of BPEL package. This is used to handle restart of BPS server.
* At restart based on the last modified time of the BPEL archives we'll reload all the versions
* of that BPEL archive.
*
* @param deploymentContext information about current deployment
* @throws RegistryException on error loading
* resources from registry.
* @throws org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.ProcessManagementException
*/
private void reloadExistingVersionsOfBPELPackage(BPELDeploymentContext deploymentContext) throws RegistryException, ProcessManagementException {
BPELPackageInfo bpelPackage = repository.getBPELPackageInfo(deploymentContext);
String lastActivePackageName = null;
for (String packageName : bpelPackage.getAvailableVersions()) {
if (deploymentUnits.containsKey(packageName)) {
lastActivePackageName = packageName;
} else {
// version of the package
if (null != lastActivePackageName && isConfigRegistryReadOnly()) {
loadExistingBPELPackage(lastActivePackageName);
}
loadExistingBPELPackage(packageName);
}
}
}
Aggregations