Search in sources :

Example 36 with ConnInstanceTO

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;
}
Also used : ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO) ConnectorService(org.apache.syncope.common.rest.api.service.ConnectorService)

Example 37 with ConnInstanceTO

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<>();
}
Also used : SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) Collection(java.util.Collection) SyncopeConsoleSession(org.apache.syncope.client.console.SyncopeConsoleSession) ConnIdObjectClassTO(org.apache.syncope.common.lib.to.ConnIdObjectClassTO) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) ConnConfProperty(org.apache.syncope.common.lib.types.ConnConfProperty) List(java.util.List) Response(javax.ws.rs.core.Response) Pair(org.apache.commons.lang3.tuple.Pair) Optional(java.util.Optional) ConnectorService(org.apache.syncope.common.rest.api.service.ConnectorService) ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO) Collections(java.util.Collections) ConnBundleTO(org.apache.syncope.common.lib.to.ConnBundleTO) BeanUtils(org.springframework.beans.BeanUtils) ConnIdObjectClassTO(org.apache.syncope.common.lib.to.ConnIdObjectClassTO) ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO)

Example 38 with ConnInstanceTO

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);
}
Also used : ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO) ConnectorService(org.apache.syncope.common.rest.api.service.ConnectorService) SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException)

Example 39 with ConnInstanceTO

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;
}
Also used : ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO) ArrayList(java.util.ArrayList) ConnectorService(org.apache.syncope.common.rest.api.service.ConnectorService)

Example 40 with ConnInstanceTO

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);
        }
    }
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ConnectorRestClient(org.apache.syncope.client.console.rest.ConnectorRestClient) ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO) UpdateEvent(org.apache.syncope.client.console.topology.TopologyTogglePanel.UpdateEvent)

Aggregations

ConnInstanceTO (org.apache.syncope.common.lib.to.ConnInstanceTO)42 Test (org.junit.jupiter.api.Test)21 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)15 ResourceTO (org.apache.syncope.common.lib.to.ResourceTO)14 ConnConfProperty (org.apache.syncope.common.lib.types.ConnConfProperty)14 ConnectorService (org.apache.syncope.common.rest.api.service.ConnectorService)11 Response (javax.ws.rs.core.Response)10 HashSet (java.util.HashSet)8 ConnConfPropSchema (org.apache.syncope.common.lib.types.ConnConfPropSchema)8 GuardedString (org.identityconnectors.common.security.GuardedString)8 IOException (java.io.IOException)7 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)7 List (java.util.List)6 Collectors (java.util.stream.Collectors)6 ConnBundleTO (org.apache.syncope.common.lib.to.ConnBundleTO)6 ConnPoolConfTO (org.apache.syncope.common.lib.to.ConnPoolConfTO)6 ItemTO (org.apache.syncope.common.lib.to.ItemTO)6 ProvisionTO (org.apache.syncope.common.lib.to.ProvisionTO)6 Locale (java.util.Locale)5 Properties (java.util.Properties)5