use of org.apache.syncope.common.lib.to.ConnInstanceTO in project syncope by apache.
the class ConnectorRestClient method delete.
public ConnInstanceTO delete(final String key) {
ConnInstanceTO connectorTO = getService(ConnectorService.class).read(key, SyncopeConsoleSession.get().getLocale().toString());
getService(ConnectorService.class).delete(key);
return connectorTO;
}
use of org.apache.syncope.common.lib.to.ConnInstanceTO in project syncope by apache.
the class ConnectorRestClient method getExtAttrNames.
public List<String> getExtAttrNames(final String adminRealm, final String objectClass, final String connectorKey, final Collection<ConnConfProperty> conf) {
ConnInstanceTO connInstanceTO = new ConnInstanceTO();
connInstanceTO.setAdminRealm(adminRealm);
connInstanceTO.setKey(connectorKey);
connInstanceTO.getConf().addAll(conf);
// SYNCOPE-156: use provided info to give schema names (and type!) by ObjectClass
Optional<ConnIdObjectClassTO> connIdObjectClass = buildObjectClassInfo(connInstanceTO, false).stream().filter(object -> object.getType().equalsIgnoreCase(objectClass)).findAny();
return connIdObjectClass.isPresent() ? connIdObjectClass.get().getAttributes() : new ArrayList<>();
}
use of org.apache.syncope.common.lib.to.ConnInstanceTO in project syncope by apache.
the class ConnectorRestClient method check.
public Pair<Boolean, String> check(final ConnInstanceTO connectorTO) {
ConnInstanceTO toBeChecked = new ConnInstanceTO();
BeanUtils.copyProperties(connectorTO, toBeChecked, new String[] { "configuration", "configurationMap" });
toBeChecked.getConf().addAll(filterProperties(connectorTO.getConf()));
boolean check = false;
String errorMessage = null;
try {
getService(ConnectorService.class).check(toBeChecked);
check = true;
} catch (Exception e) {
LOG.error("While checking {}", toBeChecked, e);
errorMessage = e.getMessage();
}
return Pair.of(check, errorMessage);
}
use of org.apache.syncope.common.lib.to.ConnInstanceTO in project syncope by apache.
the class ConnectorRestClient method getObjectClasses.
public List<String> getObjectClasses(final String connectorKey) {
List<String> result = new ArrayList<>();
ConnectorService service = getService(ConnectorService.class);
ConnInstanceTO connInstance = service.read(connectorKey, SyncopeConsoleSession.get().getLocale().getLanguage());
if (connInstance != null) {
result.addAll(service.buildObjectClassInfo(connInstance, true).stream().map(input -> input.getType()).collect(Collectors.toList()));
}
return result;
}
use of org.apache.syncope.common.lib.to.ConnInstanceTO in project syncope by apache.
the class TopologyNodePanel method onEvent.
@Override
public void onEvent(final IEvent<?> event) {
if (event.getPayload() instanceof UpdateEvent) {
final UpdateEvent updateEvent = UpdateEvent.class.cast(event.getPayload());
final String key = updateEvent.getKey();
final AjaxRequestTarget target = updateEvent.getTarget();
if (node.getKind() == Kind.CONNECTOR && key.equalsIgnoreCase(node.getKey())) {
ConnInstanceTO conn = new ConnectorRestClient().read(key);
String displayName = // [SYNCOPE-1233]
StringUtils.isBlank(conn.getDisplayName()) ? conn.getBundleName() : conn.getDisplayName();
final String resourceName = displayName.length() > 14 ? displayName.subSequence(0, 10) + "..." : displayName;
label.setDefaultModelObject(resourceName);
target.add(label);
node.setDisplayName(displayName);
}
}
}
Aggregations