Search in sources :

Example 41 with ConnInstanceTO

use of org.apache.syncope.common.lib.to.ConnInstanceTO in project syncope by apache.

the class TopologyTogglePanel method onEvent.

@Override
public void onEvent(final IEvent<?> event) {
    super.onEvent(event);
    if (event.getPayload() instanceof AjaxWizard.NewItemFinishEvent) {
        final AjaxWizard.NewItemFinishEvent item = AjaxWizard.NewItemFinishEvent.class.cast(event.getPayload());
        final Serializable result = item.getResult();
        final AjaxRequestTarget target = item.getTarget();
        if (result != null && result instanceof ConnInstanceTO) {
            // update Toggle Panel header
            ConnInstanceTO conn = ConnInstanceTO.class.cast(result);
            setHeader(target, StringUtils.abbreviate(conn.getDisplayName(), HEADER_FIRST_ABBREVIATION));
        }
    }
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Serializable(java.io.Serializable) AjaxWizard(org.apache.syncope.client.console.wizards.AjaxWizard) ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO)

Example 42 with ConnInstanceTO

use of org.apache.syncope.common.lib.to.ConnInstanceTO in project syncope by apache.

the class ConnectorLogic method readByResource.

@PreAuthorize("hasRole('" + StandardEntitlement.CONNECTOR_READ + "')")
@Transactional(readOnly = true)
public ConnInstanceTO readByResource(final String resourceName, final String lang) {
    CurrentLocale.set(StringUtils.isBlank(lang) ? Locale.ENGLISH : new Locale(lang));
    ExternalResource resource = resourceDAO.find(resourceName);
    if (resource == null) {
        throw new NotFoundException("Resource '" + resourceName + "'");
    }
    ConnInstanceTO connInstance = binder.getConnInstanceTO(connFactory.getConnector(resource).getConnInstance());
    connInstance.setKey(resource.getConnector().getKey());
    return connInstance;
}
Also used : Locale(java.util.Locale) CurrentLocale(org.identityconnectors.common.l10n.CurrentLocale) ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO) NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException) ExternalResource(org.apache.syncope.core.persistence.api.entity.resource.ExternalResource) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) Transactional(org.springframework.transaction.annotation.Transactional)

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