use of org.apache.camel.PollingConsumer in project syncope by apache.
the class CamelGroupProvisioningManager method create.
@Override
@SuppressWarnings("unchecked")
public Pair<String, List<PropagationStatus>> create(final GroupTO groupTO, final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:createGroupPort");
Map<String, Object> props = new HashMap<>();
props.put("excludedResources", Collections.<String>emptySet());
props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:createGroup", groupTO, props);
Exchange exchange = pollingConsumer.receive();
if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
return exchange.getIn().getBody(Pair.class);
}
use of org.apache.camel.PollingConsumer in project syncope by apache.
the class CamelGroupProvisioningManager method link.
@Override
public String link(final GroupPatch groupPatch) {
PollingConsumer pollingConsumer = getConsumer("direct:linkGroupPort");
sendMessage("direct:linkGroup", groupPatch);
Exchange exchange = pollingConsumer.receive();
if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
return exchange.getIn().getBody(GroupPatch.class).getKey();
}
use of org.apache.camel.PollingConsumer in project syncope by apache.
the class CamelGroupProvisioningManager method deprovision.
@Override
@SuppressWarnings("unchecked")
public List<PropagationStatus> deprovision(final String key, final Collection<String> resources, final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:deprovisionGroupPort");
Map<String, Object> props = new HashMap<>();
props.put("resources", resources);
props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:deprovisionGroup", key, props);
Exchange exchange = pollingConsumer.receive();
if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
return exchange.getIn().getBody(List.class);
}
use of org.apache.camel.PollingConsumer in project syncope by apache.
the class CamelGroupProvisioningManager method delete.
@Transactional(propagation = Propagation.REQUIRES_NEW)
@Override
@SuppressWarnings("unchecked")
public List<PropagationStatus> delete(final String key, final Set<String> excludedResources, final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:deleteGroupPort");
Map<String, Object> props = new HashMap<>();
props.put("excludedResources", excludedResources);
props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:deleteGroup", key, props);
Exchange exchange = pollingConsumer.receive();
if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
return exchange.getIn().getBody(List.class);
}
use of org.apache.camel.PollingConsumer in project syncope by apache.
the class CamelUserProvisioningManager method provision.
@Override
@SuppressWarnings("unchecked")
public List<PropagationStatus> provision(final String key, final boolean changePwd, final String password, final Collection<String> resources, final boolean nullPriorityAsync) {
PollingConsumer pollingConsumer = getConsumer("direct:provisionPort");
Map<String, Object> props = new HashMap<>();
props.put("key", key);
props.put("changePwd", changePwd);
props.put("password", password);
props.put("resources", resources);
props.put("nullPriorityAsync", nullPriorityAsync);
sendMessage("direct:provisionUser", key, props);
Exchange exchange = pollingConsumer.receive();
if (exchange.getProperty(Exchange.EXCEPTION_CAUGHT) != null) {
throw (RuntimeException) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
}
return exchange.getIn().getBody(List.class);
}
Aggregations