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

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


                break;

            case GLOBAL_SYNC:

                // just one GLOBAL_SYNC policy
                final SyncPolicy syncPolicy = policyDAO.getGlobalSyncPolicy();

                if (syncPolicy != null && !syncPolicy.getId().equals(object.getId())) {

                    context.buildConstraintViolationWithTemplate("Global Sync policy already exists").addNode(
                            EntityViolationType.InvalidSyncPolicy.name()).addConstraintViolation();

                    return false;
View Full Code Here


    public SyncPolicyTO create(final HttpServletResponse response, @RequestBody final SyncPolicyTO policyTO)
            throws SyncopeClientCompositeErrorException {

        LOG.debug("Creating policy " + policyTO);

        final SyncPolicy policy = binder.getPolicy(null, policyTO);

        auditManager.audit(Category.policy, PolicySubCategory.create, Result.success,
                "Successfully created sync policy: " + policy.getId());

        return binder.getPolicyTO(policyDAO.save(policy));
    }
View Full Code Here

    @RequestMapping(method = RequestMethod.GET, value = "/sync/global/read")
    public SyncPolicyTO getGlobalSyncPolicy() throws NotFoundException {

        LOG.debug("Reading global sync policy");

        SyncPolicy policy = policyDAO.getGlobalSyncPolicy();
        if (policy == null) {
            throw new NotFoundException("No sync policy found");
        }

        auditManager.audit(Category.policy, PolicySubCategory.read, Result.success,
                "Successfully read global sync policy: " + policy.getId());

        return (SyncPolicyTO) binder.getPolicyTO(policy);
    }
View Full Code Here

    public void saveInvalidPolicy() {
        PasswordPolicySpec passwordPolicy = new PasswordPolicySpec();
        passwordPolicy.setMaxLength(8);
        passwordPolicy.setMinLength(6);

        SyncPolicy policy = new SyncPolicy();
        policy.setSpecification(passwordPolicy);
        policy.setDescription("sync policy");

        policyDAO.save(policy);
    }
View Full Code Here

        policyDAO.save(policy);
    }

    @Test
    public void create() {
        SyncPolicy policy = new SyncPolicy();
        policy.setSpecification(new SyncPolicySpec());
        policy.setDescription("Sync policy");

        policy = policyDAO.save(policy);

        assertNotNull(policy);
        assertEquals(PolicyType.SYNC, policy.getType());
    }
View Full Code Here

    private SyncPolicySpec getSyncPolicySpec(final AbstractSyncTask syncTask) {
        SyncPolicySpec syncPolicySpec;

        if (syncTask instanceof SyncTask) {
            final SyncPolicy syncPolicy = syncTask.getResource().getSyncPolicy() == null
                    ? policyDAO.getGlobalSyncPolicy()
                    : syncTask.getResource().getSyncPolicy();

            syncPolicySpec = syncPolicy == null ? null : syncPolicy.getSpecification(SyncPolicySpec.class);
        } else {
            syncPolicySpec = null;
        }

        // step required because the call <policy>.getSpecification() could return a null value
View Full Code Here

            final ExternalResource resource,
            final AttributableUtil attrUtil) {

        SyncPolicySpec syncPolicySpec = null;
        if (resource.getSyncPolicy() == null) {
            SyncPolicy globalSP = policyDAO.getGlobalSyncPolicy();
            if (globalSP != null) {
                syncPolicySpec = globalSP.getSpecification(SyncPolicySpec.class);
            }
        } else {
            syncPolicySpec = resource.getSyncPolicy().getSpecification(SyncPolicySpec.class);
        }
View Full Code Here

        return (AccountPolicyTO) binder.getPolicyTO(policy);
    }

    @PreAuthorize("hasRole('POLICY_READ')")
    public SyncPolicyTO getGlobalSyncPolicy() {
        SyncPolicy policy = policyDAO.getGlobalSyncPolicy();
        if (policy == null) {
            throw new NotFoundException("No sync policy found");
        }

        return (SyncPolicyTO) binder.getPolicyTO(policy);
View Full Code Here

    public void saveInvalidPolicy() {
        PasswordPolicySpec passwordPolicy = new PasswordPolicySpec();
        passwordPolicy.setMaxLength(8);
        passwordPolicy.setMinLength(6);

        SyncPolicy policy = new SyncPolicy();
        policy.setSpecification(passwordPolicy);
        policy.setDescription("sync policy");

        policyDAO.save(policy);
    }
View Full Code Here

        policyDAO.save(policy);
    }

    @Test
    public void create() {
        SyncPolicy policy = new SyncPolicy();

        final String syncURuleName = "net.tirasa.sync.correlation.TirasaURule";
        final String syncRRuleName = "net.tirasa.sync.correlation.TirasaRRule";

        SyncPolicySpec syncPolicySpec = new SyncPolicySpec();
        syncPolicySpec.setUserJavaRule(syncURuleName);
        syncPolicySpec.setRoleJavaRule(syncRRuleName);

        policy.setSpecification(syncPolicySpec);
        policy.setDescription("Sync policy");

        policy = policyDAO.save(policy);

        assertNotNull(policy);
        assertEquals(PolicyType.SYNC, policy.getType());
        assertEquals(syncURuleName, (policy.getSpecification(SyncPolicySpec.class)).getUserJavaRule());
        assertEquals(syncRRuleName, (policy.getSpecification(SyncPolicySpec.class)).getRoleJavaRule());
    }
View Full Code Here

TOP

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

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.