Examples of SchemaMapping


Examples of com.cloudera.recordbreaker.schemadict.SchemaMapping

       
            double scores[] = new double[mappings.size()];
            boolean foundGoal = false;
            for (DictionaryMapping mapping: mappings) {
              SchemaDictionaryEntry dictEntry = mapping.getDictEntry();
              SchemaMapping smap = mapping.getMapping();
              scores[rank-1] = smap.getDist();

              // Did the query database match one of the returned results?
              System.err.println("  " + rank + ".  (" + smap.getDist() + ") " + mapping.getDictEntry().getInfo() + " (size=" + mapping.getDictEntry().getSchema().getFields().size() + ")");

              if (dictEntry.getInfo().equals(testName)) {
                // If so, find the max rank of any object that had the match's score.
                // (This is necessary because multiple objects can have the same match score.
                //   The current match's rank isn't necessarily the one to use.)
                System.err.println("Found mapping: " + smap.toString());             

                double currentScore = smap.getDist();
                int correctRank = rank;
                for (int j = 0; j < rank; j++) {
                  if (scores[j] == currentScore) {
                    correctRank = j+1;
                    break;
View Full Code Here

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

            }
        } else {
            final SyncopeUser found;
            List<SyncopeUser> users;

            final SchemaMapping accountIdMap = SchemaMappingUtil.getAccountIdMapping(syncTask.getResource()
                    .getMappings());

            switch (accountIdMap.getIntMappingType()) {
                case Username:
                    found = userDAO.find(uid);
                    if (found != null) {
                        result.add(found.getId());
                    }
                    break;

                case SyncopeUserId:
                    found = userDAO.find(Long.parseLong(uid));
                    if (found != null) {
                        result.add(found.getId());
                    }
                    break;

                case UserSchema:
                    final UAttrValue value = new UAttrValue();
                    value.setStringValue(uid);
                    users = userDAO.findByAttrValue(accountIdMap.getIntAttrName(), value);
                    for (SyncopeUser user : users) {
                        result.add(user.getId());
                    }
                    break;

                case UserDerivedSchema:
                    try {
                        users = userDAO.findByDerAttrValue(accountIdMap.getIntAttrName(), uid);
                        for (SyncopeUser user : users) {
                            result.add(user.getId());
                        }
                    } catch (InvalidSearchConditionException e) {
                        LOG.error("Could not search for matching users", e);
                    }
                    break;

                default:
                    LOG.error("Invalid accountId type '{}'", accountIdMap.getIntMappingType());
            }
        }

        return result;
    }
View Full Code Here

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

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

            throw new JobExecutionException(msg, e);
        }

        final SchemaMapping accountIdMap = SchemaMappingUtil.getAccountIdMapping(syncTask.getResource().getMappings());

        if (accountIdMap == null) {
            throw new JobExecutionException("Invalid account id mapping for resource " + syncTask.getResource());
        }
View Full Code Here

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

        boolean result = false;

        for (Iterator<SchemaMapping> itor = resource.getMappings(intAttrName, attributableUtil.intMappingType()).
                iterator(); itor.hasNext() && !result;) {

            SchemaMapping mapping = itor.next();
            result |= evaluateMandatoryCondition(mapping.getMandatoryCondition(), attributes);
        }

        return result;
    }
View Full Code Here

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

            return null;
        }

        final Set<SchemaMapping> schemaMappings = new HashSet<SchemaMapping>();

        SchemaMapping schemaMapping;
        for (SchemaMappingTO mapping : mappings) {
            schemaMapping = getSchemaMapping(resource, mapping);
            if (schemaMapping != null) {
                schemaMappings.add(schemaMapping);
            }
View Full Code Here

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

        if (compositeErrorException.hasExceptions()) {
            throw compositeErrorException;
        }

        SchemaMapping mapping = new SchemaMapping();

        BeanUtils.copyProperties(mappingTO, mapping, MAPPING_IGNORE_PROPERTIES);

        mapping.setResource(resource);

        return mapping;
    }
View Full Code Here

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

            }
        } else {
            final SyncopeUser found;
            List<SyncopeUser> users;

            final SchemaMapping accountIdMap = SchemaMappingUtil.getAccountIdMapping(syncTask.getResource()
                    .getMappings());

            switch (accountIdMap.getIntMappingType()) {
                case Username:
                    found = userDAO.find(uid);
                    if (found != null) {
                        result.add(found.getId());
                    }
                    break;

                case SyncopeUserId:
                    found = userDAO.find(Long.parseLong(uid));
                    if (found != null) {
                        result.add(found.getId());
                    }
                    break;

                case UserSchema:
                    final UAttrValue value = new UAttrValue();

                    USchema schema = schemaDAO.find(accountIdMap.getIntAttrName(), USchema.class);
                    if (schema == null) {
                        value.setStringValue(uid);
                    } else {
                        try {
                            value.parseValue(schema, uid);
                        } catch (ParsingValidationException e) {
                            LOG.error("While parsing provided __UID__ {}", uid, e);
                            value.setStringValue(uid);
                        }
                    }

                    users = userDAO.findByAttrValue(accountIdMap.getIntAttrName(), value);
                    for (SyncopeUser user : users) {
                        result.add(user.getId());
                    }
                    break;

                case UserDerivedSchema:
                    try {
                        users = userDAO.findByDerAttrValue(accountIdMap.getIntAttrName(), uid);
                        for (SyncopeUser user : users) {
                            result.add(user.getId());
                        }
                    } catch (InvalidSearchConditionException e) {
                        LOG.error("Could not search for matching users", e);
                    }
                    break;

                default:
                    LOG.error("Invalid accountId type '{}'", accountIdMap.getIntMappingType());
            }
        }

        return result;
    }
View Full Code Here

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

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

            throw new JobExecutionException(msg, e);
        }

        final SchemaMapping accountIdMap = SchemaMappingUtil.getAccountIdMapping(syncTask.getResource().getMappings());

        if (accountIdMap == null) {
            throw new JobExecutionException("Invalid account id mapping for resource " + syncTask.getResource());
        }
View Full Code Here

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

        assertFalse(resources.isEmpty());
    }

    @Test
    public void getAccountId() {
        SchemaMapping mapping = resourceDAO.getMappingForAccountId("ws-target-resource-2");
        assertEquals("fullname", SchemaMappingUtil.getIntAttrName(mapping));
    }
View Full Code Here

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

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

        SchemaMapping accountId = new SchemaMapping();
        accountId.setResource(resource);
        accountId.setAccountid(true);
        accountId.setExtAttrName("username");
        accountId.setIntAttrName("fullname");
        accountId.setIntMappingType(IntMappingType.SyncopeUserId);

        resource.addMapping(accountId);

        ConnInstance connector = resourceDAO.find("ws-target-resource-1").getConnector();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.