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

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


    public ConnInstanceTO create(final HttpServletResponse response, @RequestBody final ConnInstanceTO connectorTO)
            throws SyncopeClientCompositeErrorException, NotFoundException {

        LOG.debug("ConnInstance create called with configuration {}", connectorTO);

        ConnInstance connInstance = binder.getConnInstance(connectorTO);

        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: " + connectorTO.getDisplayName(), e);

            SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
View Full Code Here


    public ConnInstanceTO update(@RequestBody final ConnInstanceTO connectorTO)
            throws SyncopeClientCompositeErrorException, NotFoundException {

        LOG.debug("Connector update called with configuration {}", connectorTO);

        ConnInstance connInstance = binder.updateConnInstance(connectorTO.getId(), connectorTO);

        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: " + connectorTO.getDisplayName(), e);

            SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
View Full Code Here

    @PreAuthorize("hasRole('CONNECTOR_DELETE')")
    @RequestMapping(method = RequestMethod.GET, value = "/delete/{connectorId}")
    public ConnInstanceTO delete(@PathVariable("connectorId") Long connectorId)
            throws NotFoundException {

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

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

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

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

    @RequestMapping(method = RequestMethod.GET, value = "/read/{connectorId}")
    @Transactional(readOnly = true)
    public ConnInstanceTO read(@PathVariable("connectorId") Long connectorId)
            throws NotFoundException {

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

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

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

    public List<String> getSchemaNames(final HttpServletResponse response,
            @RequestBody final ConnInstanceTO connectorTO,
            @RequestParam(required = false, value = "showall", defaultValue = "false") final boolean showall)
            throws NotFoundException {

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

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

        // We cannot use Spring bean because this method could be used during
        // resource definition or modification: bean couldn't exist or bean
        // 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>(connLoader.createConnectorBean(connInstance, conf).getSchema(
                showall));

        Collections.sort(result);

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

        return result;
    }
View Full Code Here

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

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

        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

        List<ExternalResource> resources;

        if (connInstanceId == null) {
            resources = resourceDAO.findAll();
        } else {
            ConnInstance connInstance = connInstanceDAO.find(connInstanceId);
            resources = connInstance.getResources();
        }

        List<ResourceTO> result = binder.getResourceTOs(resources);

        auditManager.audit(Category.resource, ResourceSubCategory.list, Result.success,
View Full Code Here

    @PreAuthorize("hasRole('CONNECTOR_READ')")
    @RequestMapping(method = RequestMethod.POST, value = "/check")
    @Transactional(readOnly = true)
    public ModelAndView check(@RequestBody final ResourceTO resourceTO) {
        final ConnInstance connInstance = binder.getConnInstance(resourceTO);

        final Connector connector = connFactory.createConnector(connInstance, connInstance.getConfiguration());

        boolean result;
        try {
            connector.test();
            result = true;
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

    @RequestMapping(method = RequestMethod.POST, value = "/schema/list")
    @Transactional(readOnly = true)
    public List<String> getSchemaNames(@RequestBody final ConnInstanceTO connInstanceTO,
            @RequestParam(required = false, value = "showall", defaultValue = "false") final boolean showall) {

        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).getSchema(showall));
        Collections.sort(result);

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

        return result;
    }
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.