use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class SCIMConfManager method set.
@PreAuthorize("hasRole('" + SCIMEntitlement.SCIM_CONF_SET + "')")
public void set(final SCIMConf conf) {
try {
schemaLogic.read(SchemaType.PLAIN, SCIMConf.KEY);
} catch (NotFoundException e) {
PlainSchemaTO scimConf = new PlainSchemaTO();
scimConf.setKey(SCIMConf.KEY);
scimConf.setType(AttrSchemaType.Binary);
scimConf.setMimeType(MediaType.APPLICATION_JSON);
schemaLogic.create(SchemaType.PLAIN, scimConf);
}
conf.setLastChangeDate(new Date());
configurationLogic.set(new AttrTO.Builder().schema(SCIMConf.KEY).value(Base64.encode(POJOHelper.serialize(conf).getBytes())).build());
}
use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class ConnIdBundleManagerImpl method getConfigurationProperties.
@Override
public ConfigurationProperties getConfigurationProperties(final ConnectorInfo info) {
if (info == null) {
throw new NotFoundException("Invalid: connector info is null");
}
// create default configuration
APIConfiguration apiConfig = info.createDefaultAPIConfiguration();
// retrieve the ConfigurationProperties.
ConfigurationProperties properties = apiConfig.getConfigurationProperties();
if (properties == null) {
throw new NotFoundException("Configuration properties");
}
if (LOG.isDebugEnabled()) {
properties.getPropertyNames().forEach(propName -> {
LOG.debug("Property Name: {}" + "\nProperty Type: {}", properties.getProperty(propName).getName(), properties.getProperty(propName).getType());
});
}
return properties;
}
use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class ConnIdBundleManagerImpl method initRemote.
private void initRemote(final URI location) {
// 1. Extract conf params for remote connection from given URI
String host = location.getHost();
int port = location.getPort();
GuardedString key = new GuardedString(location.getUserInfo().toCharArray());
boolean useSSL = location.getScheme().equals("connids");
List<TrustManager> trustManagers = new ArrayList<>();
String[] params = StringUtils.isBlank(location.getQuery()) ? null : location.getQuery().split("&");
if (params != null && params.length > 0) {
final String[] trustAllCerts = params[0].split("=");
if (trustAllCerts != null && trustAllCerts.length > 1 && "trustAllCerts".equalsIgnoreCase(trustAllCerts[0]) && "true".equalsIgnoreCase(trustAllCerts[1])) {
trustManagers.add(new X509TrustManager() {
@Override
public void checkClientTrusted(final X509Certificate[] chain, final String authType) throws CertificateException {
// no checks, trust all
}
@Override
public void checkServerTrusted(final X509Certificate[] chain, final String authType) throws CertificateException {
// no checks, trust all
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
});
}
}
LOG.debug("Configuring remote connector server:" + "\n\tHost: {}" + "\n\tPort: {}" + "\n\tKey: {}" + "\n\tUseSSL: {}" + "\n\tTrustAllCerts: {}", host, port, key, useSSL, !trustManagers.isEmpty());
RemoteFrameworkConnectionInfo info = new RemoteFrameworkConnectionInfo(host, port, key, useSSL, trustManagers, 60 * 1000);
LOG.debug("Remote connection info: {}", info);
// 2. Get connector info manager
ConnectorInfoManager manager = ConnectorInfoManagerFactory.getInstance().getRemoteManager(info);
if (manager == null) {
throw new NotFoundException("Remote ConnectorInfoManager");
}
connInfoManagers.put(location, manager);
}
use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class TaskDataBinderImpl method createSchedTask.
@Override
public SchedTask createSchedTask(final SchedTaskTO taskTO, final TaskUtils taskUtils) {
Class<? extends TaskTO> taskTOClass = taskUtils.taskTOClass();
if (taskTOClass == null || !taskTOClass.equals(taskTO.getClass())) {
throw new IllegalArgumentException(String.format("Expected %s, found %s", taskTOClass, taskTO.getClass()));
}
SchedTask task = taskUtils.newTask();
task.setStartAt(taskTO.getStartAt());
task.setCronExpression(taskTO.getCronExpression());
task.setName(taskTO.getName());
task.setDescription(taskTO.getDescription());
task.setActive(taskTO.isActive());
if (taskUtils.getType() == TaskType.SCHEDULED) {
Implementation implementation = implementationDAO.find(taskTO.getJobDelegate());
if (implementation == null) {
throw new NotFoundException("Implementation " + taskTO.getJobDelegate());
}
task.setJobDelegate(implementation);
} else if (taskTO instanceof ProvisioningTaskTO) {
ProvisioningTaskTO provisioningTaskTO = (ProvisioningTaskTO) taskTO;
ExternalResource resource = resourceDAO.find(provisioningTaskTO.getResource());
if (resource == null) {
throw new NotFoundException("Resource " + provisioningTaskTO.getResource());
}
((ProvisioningTask) task).setResource(resource);
fill((ProvisioningTask) task, provisioningTaskTO);
}
return task;
}
use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class FlowableUserWorkflowAdapter method exportDiagram.
@Override
public void exportDiagram(final String key, final OutputStream os) {
ProcessDefinition procDef = getProcessDefinitionByKey(key);
if (procDef == null) {
throw new NotFoundException("Workflow process definition for " + key);
}
exportProcessResource(procDef.getDeploymentId(), procDef.getDiagramResourceName(), os);
}
Aggregations