Search in sources :

Example 1 with ConnectorRestClient

use of org.apache.syncope.client.console.rest.ConnectorRestClient in project syncope by apache.

the class HistoryConfDetails method addCurrentInstanceConf.

@SuppressWarnings("unchecked")
private void addCurrentInstanceConf() {
    T conf = null;
    if (selectedHistoryConfTO instanceof ConnInstanceHistoryConfTO) {
        ConnInstanceTO current = new ConnectorRestClient().read(ConnInstanceHistoryConfTO.class.cast(selectedHistoryConfTO).getConnInstanceTO().getKey());
        conf = (T) new ConnInstanceHistoryConfTO();
        ((ConnInstanceHistoryConfTO) conf).setConnInstanceTO(current);
    } else if (selectedHistoryConfTO instanceof ResourceHistoryConfTO) {
        ResourceTO current = new ResourceRestClient().read(ResourceHistoryConfTO.class.cast(selectedHistoryConfTO).getResourceTO().getKey());
        conf = (T) new ResourceHistoryConfTO();
        ((ResourceHistoryConfTO) conf).setResourceTO(current);
    }
    if (conf != null) {
        conf.setCreator(selectedHistoryConfTO.getCreator());
        conf.setKey("current");
        availableHistoryConfTOs.add(conf);
    }
}
Also used : ConnectorRestClient(org.apache.syncope.client.console.rest.ConnectorRestClient) ResourceHistoryConfTO(org.apache.syncope.common.lib.to.ResourceHistoryConfTO) ResourceTO(org.apache.syncope.common.lib.to.ResourceTO) ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO) ConnInstanceHistoryConfTO(org.apache.syncope.common.lib.to.ConnInstanceHistoryConfTO) ResourceRestClient(org.apache.syncope.client.console.rest.ResourceRestClient)

Example 2 with ConnectorRestClient

use of org.apache.syncope.client.console.rest.ConnectorRestClient 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

ConnectorRestClient (org.apache.syncope.client.console.rest.ConnectorRestClient)2 ConnInstanceTO (org.apache.syncope.common.lib.to.ConnInstanceTO)2 ResourceRestClient (org.apache.syncope.client.console.rest.ResourceRestClient)1 UpdateEvent (org.apache.syncope.client.console.topology.TopologyTogglePanel.UpdateEvent)1 ConnInstanceHistoryConfTO (org.apache.syncope.common.lib.to.ConnInstanceHistoryConfTO)1 ResourceHistoryConfTO (org.apache.syncope.common.lib.to.ResourceHistoryConfTO)1 ResourceTO (org.apache.syncope.common.lib.to.ResourceTO)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1