@Test void testGenerate() { String generatedAlgorithm = categoryAlgorithmGenerator.generate( targetAttribute, singletonList(sourceAttribute), targetEntityType, sourceEntityType); String expectedAlgorithm = "$('MESHED_POTATO').map({\"1\":\"4\",\"2\":\"4\",\"3\":\"4\",\"4\":\"3\",\"5\":\"2\",\"6\":\"2\",\"7\":\"1\",\"8\":\"1\"}, null, null).value();"; assertEquals(expectedAlgorithm, generatedAlgorithm); }
@Override public String generate( Attribute targetAttribute, List<Attribute> sourceAttributes, EntityType targetEntityType, EntityType sourceEntityType) { String mapAlgorithm = null; if (!sourceAttributes.isEmpty()) { Attribute firstSourceAttribute = sourceAttributes.get(0); List<Category> targetCategories = convertToCategory(targetAttribute); List<Category> sourceCategories = convertToCategory(firstSourceAttribute); if (isFrequencyCategory(targetCategories) && isFrequencyCategory(sourceCategories)) { mapAlgorithm = mapCategories( firstSourceAttribute, targetCategories, sourceCategories, frequencyCategoryMapper); } else { mapAlgorithm = mapCategories( firstSourceAttribute, targetCategories, sourceCategories, lexicalCategoryMapper); } } return mapAlgorithm; }
OneToOneCategoryAlgorithmGenerator extends AbstractCategoryAlgorithmGenerator { @Override public String generate( Attribute targetAttribute, List<Attribute> sourceAttributes, EntityType targetEntityType, EntityType sourceEntityType) { String mapAlgorithm = null; if (!sourceAttributes.isEmpty()) { Attribute firstSourceAttribute = sourceAttributes.get(0); List<Category> targetCategories = convertToCategory(targetAttribute); List<Category> sourceCategories = convertToCategory(firstSourceAttribute); if (isFrequencyCategory(targetCategories) && isFrequencyCategory(sourceCategories)) { mapAlgorithm = mapCategories( firstSourceAttribute, targetCategories, sourceCategories, frequencyCategoryMapper); } else { mapAlgorithm = mapCategories( firstSourceAttribute, targetCategories, sourceCategories, lexicalCategoryMapper); } } return mapAlgorithm; } }
OneToOneCategoryAlgorithmGenerator extends AbstractCategoryAlgorithmGenerator { @Override public String generate( Attribute targetAttribute, List<Attribute> sourceAttributes, EntityType targetEntityType, EntityType sourceEntityType) { String mapAlgorithm = null; if (!sourceAttributes.isEmpty()) { Attribute firstSourceAttribute = sourceAttributes.get(0); List<Category> targetCategories = convertToCategory(targetAttribute); List<Category> sourceCategories = convertToCategory(firstSourceAttribute); if (isFrequencyCategory(targetCategories) && isFrequencyCategory(sourceCategories)) { mapAlgorithm = mapCategories( firstSourceAttribute, targetCategories, sourceCategories, frequencyCategoryMapper); } else { mapAlgorithm = mapCategories( firstSourceAttribute, targetCategories, sourceCategories, lexicalCategoryMapper); } } return mapAlgorithm; } OneToOneCategoryAlgorithmGenerator(DataService dataService); }
OneToOneCategoryAlgorithmGenerator extends AbstractCategoryAlgorithmGenerator { @Override public String generate( Attribute targetAttribute, List<Attribute> sourceAttributes, EntityType targetEntityType, EntityType sourceEntityType) { String mapAlgorithm = null; if (!sourceAttributes.isEmpty()) { Attribute firstSourceAttribute = sourceAttributes.get(0); List<Category> targetCategories = convertToCategory(targetAttribute); List<Category> sourceCategories = convertToCategory(firstSourceAttribute); if (isFrequencyCategory(targetCategories) && isFrequencyCategory(sourceCategories)) { mapAlgorithm = mapCategories( firstSourceAttribute, targetCategories, sourceCategories, frequencyCategoryMapper); } else { mapAlgorithm = mapCategories( firstSourceAttribute, targetCategories, sourceCategories, lexicalCategoryMapper); } } return mapAlgorithm; } OneToOneCategoryAlgorithmGenerator(DataService dataService); @Override boolean isSuitable(Attribute targetAttribute, List<Attribute> sourceAttributes); @Override String generate(
      Attribute targetAttribute,
      List<Attribute> sourceAttributes,
      EntityType targetEntityType,
      EntityType sourceEntityType); }
OneToOneCategoryAlgorithmGenerator extends AbstractCategoryAlgorithmGenerator { @Override public String generate( Attribute targetAttribute, List<Attribute> sourceAttributes, EntityType targetEntityType, EntityType sourceEntityType) { String mapAlgorithm = null; if (!sourceAttributes.isEmpty()) { Attribute firstSourceAttribute = sourceAttributes.get(0); List<Category> targetCategories = convertToCategory(targetAttribute); List<Category> sourceCategories = convertToCategory(firstSourceAttribute); if (isFrequencyCategory(targetCategories) && isFrequencyCategory(sourceCategories)) { mapAlgorithm = mapCategories( firstSourceAttribute, targetCategories, sourceCategories, frequencyCategoryMapper); } else { mapAlgorithm = mapCategories( firstSourceAttribute, targetCategories, sourceCategories, lexicalCategoryMapper); } } return mapAlgorithm; } OneToOneCategoryAlgorithmGenerator(DataService dataService); @Override boolean isSuitable(Attribute targetAttribute, List<Attribute> sourceAttributes); @Override String generate(
      Attribute targetAttribute,
      List<Attribute> sourceAttributes,
      EntityType targetEntityType,
      EntityType sourceEntityType);  }