Package org.apache.syncope.core.persistence.beans

Examples of org.apache.syncope.core.persistence.beans.ConnInstance


        return getConnInstance(connInstanceClone, resource.getConnInstanceConfiguration());
    }

    public ConnInstance getConnInstance(final ResourceTO resourceTO) {
        ConnInstance connInstance = connInstanceDAO.find(resourceTO.getConnectorId());
        if (connInstance == null) {
            throw new NotFoundException("Connector '" + resourceTO.getConnectorId() + "'");
        }

        final ConnInstance connInstanceClone = (ConnInstance) SerializationUtils.clone(connInstance);
        return getConnInstance(connInstanceClone, resourceTO.getConnConfProperties());
    }
View Full Code Here


        // set the resource name
        resourceTO.setName(resource.getName());

        // set the connector instance
        ConnInstance connector = resource.getConnector();

        resourceTO.setConnectorId(connector == null ? null : connector.getId());
        resourceTO.setConnectorDisplayName(connector == null ? null : connector.getDisplayName());

        // set the mappings
        if (resource.getUmapping() != null) {
            MappingTO mappingTO = new MappingTO();
            resourceTO.setUmapping(mappingTO);
View Full Code Here

    @PreAuthorize("hasRole('CONNECTOR_CREATE')")
    @RequestMapping(method = RequestMethod.POST, value = "/create")
    public ConnInstanceTO create(final HttpServletResponse response, @RequestBody final ConnInstanceTO connInstanceTO) {
        LOG.debug("ConnInstance create called with configuration {}", connInstanceTO);

        ConnInstance connInstance = binder.getConnInstance(connInstanceTO);
        try {
            connInstance = connInstanceDAO.save(connInstance);
            auditManager.audit(Category.connector, ConnectorSubCategory.create, Result.success,
                    "Successfully created connector instance: " + connInstance.getDisplayName());
        } catch (Exception e) {
            auditManager.audit(Category.connector, ConnectorSubCategory.create, Result.failure,
                    "Could not create connector instance: " + connInstanceTO.getDisplayName(), e);

            SyncopeClientCompositeErrorException scce =
View Full Code Here

    @PreAuthorize("hasRole('CONNECTOR_UPDATE')")
    @RequestMapping(method = RequestMethod.POST, value = "/update")
    public ConnInstanceTO update(@RequestBody final ConnInstanceTO connInstanceTO) {
        LOG.debug("Connector update called with configuration {}", connInstanceTO);

        ConnInstance connInstance = binder.updateConnInstance(connInstanceTO.getId(), connInstanceTO);
        try {
            connInstance = connInstanceDAO.save(connInstance);
            auditManager.audit(Category.connector, ConnectorSubCategory.update, Result.success,
                    "Successfully update connector instance: " + connInstance.getDisplayName());
        } catch (Exception e) {
            auditManager.audit(Category.connector, ConnectorSubCategory.create, Result.failure,
                    "Could not update connector instance: " + connInstanceTO.getDisplayName(), e);

            SyncopeClientCompositeErrorException scce =
View Full Code Here

    }

    @PreAuthorize("hasRole('CONNECTOR_DELETE')")
    @RequestMapping(method = RequestMethod.GET, value = "/delete/{connInstanceId}")
    public ConnInstanceTO delete(@PathVariable("connInstanceId") final Long connInstanceId) {
        ConnInstance connInstance = connInstanceDAO.find(connInstanceId);
        if (connInstance == null) {
            throw new NotFoundException("Connector '" + connInstanceId + "'");
        }

        if (!connInstance.getResources().isEmpty()) {
            SyncopeClientCompositeErrorException scce =
                    new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);

            SyncopeClientException associatedResources =
                    new SyncopeClientException(SyncopeClientExceptionType.AssociatedResources);
            for (ExternalResource resource : connInstance.getResources()) {
                associatedResources.addElement(resource.getName());
            }

            scce.addException(associatedResources);
            throw scce;
View Full Code Here

    @PreAuthorize("hasRole('CONNECTOR_READ')")
    @RequestMapping(method = RequestMethod.GET, value = "/read/{connInstanceId}")
    @Transactional(readOnly = true)
    public ConnInstanceTO read(@PathVariable("connInstanceId") final Long connInstanceId) {
        ConnInstance connInstance = connInstanceDAO.find(connInstanceId);
        if (connInstance == null) {
            throw new NotFoundException("Connector '" + connInstanceId + "'");
        }

        auditManager.audit(Category.connector, ConnectorSubCategory.read, Result.success,
                "Successfully read connector: " + connInstance.getDisplayName());

        return binder.getConnInstanceTO(connInstance);
    }
View Full Code Here

    @Transactional(readOnly = true)
    public List<String> getSchemaNames(@RequestBody final ConnInstanceTO connInstanceTO,
            @RequestParam(required = false, value = "includeSpecial", defaultValue = "false")
            final boolean includeSpecial) {

        final ConnInstance connInstance = connInstanceDAO.find(connInstanceTO.getId());
        if (connInstance == null) {
            throw new NotFoundException("Connector '" + connInstanceTO.getId() + "'");
        }

        // consider the possibility to receive overridden properties only
        final Set<ConnConfProperty> conf = binder.mergeConnConfProperties(connInstanceTO.getConfiguration(),
                connInstance.getConfiguration());

        // We cannot use Spring bean because this method could be used during resource definition or modification:
        // bean couldn't exist or couldn't be updated.
        // This is the reason why we should take a "not mature" connector facade proxy to ask for schema names.
        final List<String> result =
                new ArrayList<String>(connFactory.createConnector(connInstance, conf).getSchemaNames(includeSpecial));

        auditManager.audit(Category.connector, ConnectorSubCategory.getSchemaNames, Result.success,
                "Successfully listed " + (includeSpecial ? "all " : "") + "schema names (" + result.size() + ") "
                + "for connector " + connInstance.getDisplayName());

        return result;
    }
View Full Code Here

    @PreAuthorize("hasRole('CONNECTOR_READ')")
    @RequestMapping(method = RequestMethod.POST, value = "/supportedObjectClasses/list")
    @Transactional(readOnly = true)
    public List<String> getSupportedObjectClasses(@RequestBody final ConnInstanceTO connInstanceTO) {
        final ConnInstance connInstance = connInstanceDAO.find(connInstanceTO.getId());
        if (connInstance == null) {
            throw new NotFoundException("Connector '" + connInstanceTO.getId() + "'");
        }

        // consider the possibility to receive overridden properties only
        final Set<ConnConfProperty> conf = binder.mergeConnConfProperties(connInstanceTO.getConfiguration(),
                connInstance.getConfiguration());

        // We cannot use Spring bean because this method could be used during resource definition or modification:
        // bean couldn't exist or couldn't be updated.
        // This is the reason why we should take a "not mature" connector facade proxy to ask for object classes.
        Set<ObjectClass> objectClasses = connFactory.createConnector(connInstance, conf).getSupportedObjectClasses();

        List<String> result = new ArrayList<String>(objectClasses.size());
        for (ObjectClass objectClass : objectClasses) {
            result.add(objectClass.getObjectClassValue());
        }

        auditManager.audit(Category.connector, ConnectorSubCategory.getSupportedObjectClasses, Result.success,
                "Successfully listed supported object classes (" + result.size() + ") "
                + "for connector " + connInstance.getDisplayName());

        return result;
    }
View Full Code Here

    @RequestMapping(method = RequestMethod.GET, value = "/{connInstanceId}/configurationProperty/list")
    @Transactional(readOnly = true)
    public List<ConnConfProperty> getConfigurationProperties(
            @PathVariable("connInstanceId") final Long connInstanceId) {

        final ConnInstance connInstance = connInstanceDAO.find(connInstanceId);
        if (connInstance == null) {
            throw new NotFoundException("Connector '" + connInstanceId + "'");
        }

        List<ConnConfProperty> result = new ArrayList<ConnConfProperty>(connInstance.getConfiguration());

        auditManager.audit(Category.connector, ConnectorSubCategory.getConfigurationProperties, Result.success,
                "Successfully listed all conf properties (" + result.size() + ") for connector "
                + connInstance.getDisplayName());

        return result;
    }
View Full Code Here

     *
     * @param connector A Connector instance to query for the groupMemberAttribute property name
     * @return the name of the attribute used to keep track of group memberships
     */
    protected String getGroupMembershipAttrName(final Connector connector) {
        ConnInstance connInstance = connector.getActiveConnInstance();
        Iterator<ConnConfProperty> propertyIterator = connInstance.getConfiguration().iterator();
        String groupMembershipName = "uniquemember";
        while (propertyIterator.hasNext()) {
            ConnConfProperty property = propertyIterator.next();
            if ("groupMemberAttribute".equals(property.getSchema().getName())
                    && property.getValues() != null && !property.getValues().isEmpty()) {
View Full Code Here

TOP

Related Classes of org.apache.syncope.core.persistence.beans.ConnInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.