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

Examples of org.apache.syncope.core.persistence.beans.user.UMapping


        resource.setRandomPwdIfNotProvided(resourceTO.isRandomPwdIfNotProvided());

        resource.setPropagationMode(resourceTO.getPropagationMode());

        if (resourceTO.getUmapping() != null) {
            UMapping mapping = new UMapping();
            mapping.setResource(resource);
            resource.setUmapping(mapping);
            populateMapping(resourceTO.getUmapping(), mapping, new UMappingItem());
        }
        if (resourceTO.getRmapping() != null) {
            RMapping mapping = new RMapping();
            mapping.setResource(resource);
            resource.setRmapping(mapping);
            populateMapping(resourceTO.getRmapping(), mapping, new RMappingItem());
        }

        resource.setCreateTraceLevel(resourceTO.getCreateTraceLevel());
View Full Code Here


        ConnInstance connector = connInstanceDAO.find(100L);
        assertNotNull("connector not found", connector);

        resource.setConnector(connector);

        UMapping mapping = new UMapping();
        mapping.setResource(resource);
        resource.setUmapping(mapping);

        // specify mappings
        for (int i = 0; i < 3; i++) {
            UMappingItem item = new UMappingItem();
            item.setExtAttrName("test" + i);
            item.setIntAttrName("nonexistent" + i);
            item.setIntMappingType(IntMappingType.UserSchema);
            item.setMandatoryCondition("false");
            item.setPurpose(MappingPurpose.SYNCHRONIZATION);
            mapping.addItem(item);
            item.setMapping(mapping);
        }
        UMappingItem accountId = new UMappingItem();
        accountId.setExtAttrName("username");
        accountId.setIntAttrName("username");
        accountId.setIntMappingType(IntMappingType.UserId);
        accountId.setPurpose(MappingPurpose.PROPAGATION);
        mapping.setAccountIdItem(accountId);
        accountId.setMapping(mapping);

        // map a derived attribute
        UMappingItem derived = new UMappingItem();
        derived.setAccountid(false);
        derived.setExtAttrName("fullname");
        derived.setIntAttrName("cn");
        derived.setIntMappingType(IntMappingType.UserDerivedSchema);
        derived.setPurpose(MappingPurpose.PROPAGATION);
        mapping.addItem(derived);
        derived.setMapping(mapping);

        // save the resource
        ExternalResource actual = resourceDAO.save(resource);
        assertNotNull(actual);
View Full Code Here

                    syncTask.getResource(), syncTask.getResource().getConnector());

            throw new JobExecutionException(msg, e);
        }

        UMapping uMapping = syncTask.getResource().getUmapping();
        if (uMapping != null && uMapping.getAccountIdItem() == null) {
            throw new JobExecutionException("Invalid user account id mapping for resource " + syncTask.getResource());
        }
        RMapping rMapping = syncTask.getResource().getRmapping();
        if (rMapping != null && rMapping.getAccountIdItem() == null) {
            throw new JobExecutionException("Invalid role account id mapping for resource " + syncTask.getResource());
        }
        if (uMapping == null && rMapping == null) {
            return "No mapping configured for both users and roles: aborting...";
        }

        LOG.debug("Execute synchronization with token {}", syncTask.getResource().getUsyncToken());

        final List<SyncResult> results = new ArrayList<SyncResult>();

        final SyncPolicy syncPolicy = syncTask.getResource().getSyncPolicy();
        final ConflictResolutionAction resAct = syncPolicy == null || syncPolicy.getSpecification() == null
                ? ConflictResolutionAction.IGNORE
                : ((SyncPolicySpec) syncPolicy.getSpecification()).getConflictResolutionAction();

        // Prepare handler for SyncDelta objects
        final SyncopeSyncResultHandler handler =
                (SyncopeSyncResultHandler) ((DefaultListableBeanFactory) ApplicationContextProvider.
                getApplicationContext().getBeanFactory()).createBean(
                SyncopeSyncResultHandler.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
        handler.setConnector(connector);
        handler.setActions(actions);
        handler.setDryRun(dryRun);
        handler.setResAct(resAct);
        handler.setResults(results);
        handler.setSyncTask(syncTask);

        actions.beforeAll(handler);
        try {
            if (syncTask.isFullReconciliation()) {
                if (uMapping != null) {
                    connector.getAllObjects(ObjectClass.ACCOUNT, handler,
                            connector.getOperationOptions(uMapping.getItems()));
                }
                if (rMapping != null) {
                    connector.getAllObjects(ObjectClass.GROUP, handler,
                            connector.getOperationOptions(rMapping.getItems()));
                }
            } else {
                if (uMapping != null) {
                    connector.sync(ObjectClass.ACCOUNT, syncTask.getResource().getUsyncToken(), handler,
                            connector.getOperationOptions(uMapping.getItems()));
                }
                if (rMapping != null) {
                    connector.sync(ObjectClass.GROUP, syncTask.getResource().getRsyncToken(), handler,
                            connector.getOperationOptions(rMapping.getItems()));
                }
View Full Code Here

        ExternalResource resource = new ExternalResource();
        resource.setName("ws-target-resource-basic-save");
        resource.setPropagationPriority(2);
        resource.setPropagationPrimary(true);

        UMapping mapping = new UMapping();
        resource.setUmapping(mapping);

        UMappingItem accountId = new UMappingItem();
        accountId.setExtAttrName("username");
        accountId.setIntAttrName("fullname");
        accountId.setIntMappingType(IntMappingType.UserId);
        accountId.setPurpose(MappingPurpose.BOTH);
        mapping.setAccountIdItem(accountId);

        ConnInstance connector = resourceDAO.find("ws-target-resource-1").getConnector();
        resource.setConnector(connector);

        // save the resource
View Full Code Here

        resource.setName("ws-target-resource-basic-save-invalid");

        ConnInstance connector = resourceDAO.find("ws-target-resource-1").getConnector();
        resource.setConnector(connector);

        UMapping mapping = new UMapping();
        resource.setUmapping(mapping);

        UMappingItem accountId = new UMappingItem();
        accountId.setAccountid(true);
        accountId.setIntMappingType(IntMappingType.UserSchema);
        mapping.addItem(accountId);

        // save the resource
        ExternalResource actual = resourceDAO.save(resource);
        assertNotNull(actual);
    }
View Full Code Here

        resource.setName("ws-target-resource-basic-save-invalid");

        ConnInstance connector = resourceDAO.find("ws-target-resource-1").getConnector();
        resource.setConnector(connector);

        UMapping mapping = new UMapping();
        resource.setUmapping(mapping);

        UMappingItem accountId = new UMappingItem();
        accountId.setAccountid(true);
        accountId.setIntMappingType(IntMappingType.UserVirtualSchema);
        mapping.setAccountIdItem(accountId);

        // save the resource
        ExternalResource actual = resourceDAO.save(resource);
        assertNotNull(actual);
    }
View Full Code Here

        resource.setName("ws-target-resource-basic-save-invalid");

        ConnInstance connector = resourceDAO.find("ws-target-resource-1").getConnector();
        resource.setConnector(connector);

        UMapping mapping = new UMapping();
        resource.setUmapping(mapping);

        UMappingItem item = new UMappingItem();
        item.setAccountid(true);
        item.setIntAttrName("fullname");
        item.setIntMappingType(IntMappingType.UserSchema);
        mapping.addItem(item);

        item = new UMappingItem();
        item.setIntAttrName("userId");
        item.setIntMappingType(IntMappingType.UserSchema);
        mapping.addItem(item);

        ExternalResource actual = resourceDAO.save(resource);
        assertNotNull(actual);
    }
View Full Code Here

        resource.setName("ws-target-resource-basic-save-invalid");

        ConnInstance connector = resourceDAO.find("ws-target-resource-1").getConnector();
        resource.setConnector(connector);

        UMapping mapping = new UMapping();
        resource.setUmapping(mapping);

        UMappingItem item = new UMappingItem();
        item.setIntAttrName("fullname");
        item.setIntMappingType(IntMappingType.UserSchema);
        item.setPurpose(MappingPurpose.BOTH);
        mapping.setAccountIdItem(item);

        item = new UMappingItem();
        item.setIntAttrName("icon");
        item.setExtAttrName("icon");
        item.setIntMappingType(IntMappingType.RoleSchema);
        item.setPurpose(MappingPurpose.BOTH);
        mapping.addItem(item);

        item = new UMappingItem();
        item.setIntAttrName("mderiveddata");
        item.setExtAttrName("mderiveddata");
        item.setIntMappingType(IntMappingType.MembershipDerivedSchema);
        item.setPurpose(MappingPurpose.BOTH);
        mapping.addItem(item);

        // save the resource
        ExternalResource actual = resourceDAO.save(resource);
        assertNotNull(actual);
View Full Code Here

        resource.setPropagationMode(resourceTO.getPropagationMode());

        if (resourceTO.getUmapping() == null || resourceTO.getUmapping().getItems().isEmpty()) {
            resource.setUmapping(null);
        } else {
            UMapping mapping = new UMapping();
            mapping.setResource(resource);
            resource.setUmapping(mapping);
            populateMapping(resourceTO.getUmapping(), mapping, new UMappingItem());
        }
        if (resourceTO.getRmapping() == null || resourceTO.getRmapping().getItems().isEmpty()) {
            resource.setRmapping(null);
        } else {
            RMapping mapping = new RMapping();
            mapping.setResource(resource);
            resource.setRmapping(mapping);
            populateMapping(resourceTO.getRmapping(), mapping, new RMappingItem());
        }

        resource.setCreateTraceLevel(resourceTO.getCreateTraceLevel());
View Full Code Here

        resource.setPropagationMode(resourceTO.getPropagationMode());

        if (resourceTO.getUmapping() == null || resourceTO.getUmapping().getItems().isEmpty()) {
            resource.setUmapping(null);
        } else {
            UMapping mapping = new UMapping();
            mapping.setResource(resource);
            resource.setUmapping(mapping);
            populateMapping(resourceTO.getUmapping(), mapping, new UMappingItem());
        }
        if (resourceTO.getRmapping() == null || resourceTO.getRmapping().getItems().isEmpty()) {
            resource.setRmapping(null);
        } else {
            RMapping mapping = new RMapping();
            mapping.setResource(resource);
            resource.setRmapping(mapping);
            populateMapping(resourceTO.getRmapping(), mapping, new RMappingItem());
        }

        resource.setCreateTraceLevel(resourceTO.getCreateTraceLevel());
View Full Code Here

TOP

Related Classes of org.apache.syncope.core.persistence.beans.user.UMapping

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.