@Test void testAddEntityMapping() { String mappingProjectId = "MyMappingProjectId"; MappingProject mappingProject = mock(MappingProject.class); when(mappingService.getMappingProject(mappingProjectId)).thenReturn(mappingProject); String targetEntityTypeId = "MyTargetEntityTypeId"; String sourceEntityTypeId = "MySourceEntityTypeId"; EntityType targetEntityType = mock(EntityType.class); EntityType sourceEntityType = mock(EntityType.class); doReturn(targetEntityType).when(dataService).getEntityType(targetEntityTypeId); doReturn(sourceEntityType).when(dataService).getEntityType(sourceEntityTypeId); MappingTarget mappingTarget = mock(MappingTarget.class); EntityMapping entityMapping = mock(EntityMapping.class); when(mappingTarget.addSource(sourceEntityType)).thenReturn(entityMapping); when(mappingProject.getMappingTarget(targetEntityTypeId)).thenReturn(mappingTarget); controller.addEntityMapping(mappingProjectId, targetEntityTypeId, sourceEntityTypeId, null); verify(mappingTarget).addSource(sourceEntityType); verify(algorithmService) .autoGenerateAlgorithm(sourceEntityType, targetEntityType, entityMapping); verify(mappingService, times(2)).updateMappingProject(mappingProject); }
@PostMapping("/addEntityMapping") public String addEntityMapping( @RequestParam String mappingProjectId, String target, String source, String algorithmSource) { EntityType sourceEntityType = dataService.getEntityType(source); EntityType algorithmSourceEntityType = !StringUtils.isBlank(algorithmSource) ? dataService.getEntityType(algorithmSource) : null; EntityType targetEntityType = dataService.getEntityType(target); MappingProject project = mappingService.getMappingProject(mappingProjectId); EntityMapping mapping = project.getMappingTarget(target).addSource(sourceEntityType); mappingService.updateMappingProject(project); if (algorithmSourceEntityType == null) { autoGenerateAlgorithms(mapping, sourceEntityType, targetEntityType, project); } else { EntityMapping copySourceEntityMapping = project.getMappingTarget(target).getMappingForSource(algorithmSource); copyAlgorithms(project, mapping, copySourceEntityMapping); } return "redirect:" + getMappingServiceMenuUrl() + "/mappingproject/" + mappingProjectId; }
MappingServiceController extends PluginController { @PostMapping("/addEntityMapping") public String addEntityMapping( @RequestParam String mappingProjectId, String target, String source, String algorithmSource) { EntityType sourceEntityType = dataService.getEntityType(source); EntityType algorithmSourceEntityType = !StringUtils.isBlank(algorithmSource) ? dataService.getEntityType(algorithmSource) : null; EntityType targetEntityType = dataService.getEntityType(target); MappingProject project = mappingService.getMappingProject(mappingProjectId); EntityMapping mapping = project.getMappingTarget(target).addSource(sourceEntityType); mappingService.updateMappingProject(project); if (algorithmSourceEntityType == null) { autoGenerateAlgorithms(mapping, sourceEntityType, targetEntityType, project); } else { EntityMapping copySourceEntityMapping = project.getMappingTarget(target).getMappingForSource(algorithmSource); copyAlgorithms(project, mapping, copySourceEntityMapping); } return "redirect:" + getMappingServiceMenuUrl() + "/mappingproject/" + mappingProjectId; } }
MappingServiceController extends PluginController { @PostMapping("/addEntityMapping") public String addEntityMapping( @RequestParam String mappingProjectId, String target, String source, String algorithmSource) { EntityType sourceEntityType = dataService.getEntityType(source); EntityType algorithmSourceEntityType = !StringUtils.isBlank(algorithmSource) ? dataService.getEntityType(algorithmSource) : null; EntityType targetEntityType = dataService.getEntityType(target); MappingProject project = mappingService.getMappingProject(mappingProjectId); EntityMapping mapping = project.getMappingTarget(target).addSource(sourceEntityType); mappingService.updateMappingProject(project); if (algorithmSourceEntityType == null) { autoGenerateAlgorithms(mapping, sourceEntityType, targetEntityType, project); } else { EntityMapping copySourceEntityMapping = project.getMappingTarget(target).getMappingForSource(algorithmSource); copyAlgorithms(project, mapping, copySourceEntityMapping); } return "redirect:" + getMappingServiceMenuUrl() + "/mappingproject/" + mappingProjectId; } MappingServiceController(
      AlgorithmService algorithmService,
      MappingService mappingService,
      DataService dataService,
      OntologyTagService ontologyTagService,
      SemanticSearchService semanticSearchService,
      MenuReaderService menuReaderService,
      MappingJobExecutionFactory mappingJobExecutionFactory,
      JobExecutor jobExecutor,
      JobsController jobsController); }
MappingServiceController extends PluginController { @PostMapping("/addEntityMapping") public String addEntityMapping( @RequestParam String mappingProjectId, String target, String source, String algorithmSource) { EntityType sourceEntityType = dataService.getEntityType(source); EntityType algorithmSourceEntityType = !StringUtils.isBlank(algorithmSource) ? dataService.getEntityType(algorithmSource) : null; EntityType targetEntityType = dataService.getEntityType(target); MappingProject project = mappingService.getMappingProject(mappingProjectId); EntityMapping mapping = project.getMappingTarget(target).addSource(sourceEntityType); mappingService.updateMappingProject(project); if (algorithmSourceEntityType == null) { autoGenerateAlgorithms(mapping, sourceEntityType, targetEntityType, project); } else { EntityMapping copySourceEntityMapping = project.getMappingTarget(target).getMappingForSource(algorithmSource); copyAlgorithms(project, mapping, copySourceEntityMapping); } return "redirect:" + getMappingServiceMenuUrl() + "/mappingproject/" + mappingProjectId; } MappingServiceController(
      AlgorithmService algorithmService,
      MappingService mappingService,
      DataService dataService,
      OntologyTagService ontologyTagService,
      SemanticSearchService semanticSearchService,
      MenuReaderService menuReaderService,
      MappingJobExecutionFactory mappingJobExecutionFactory,
      JobExecutor jobExecutor,
      JobsController jobsController); @GetMapping String viewMappingProjects(Model model); @PostMapping("/addMappingProject") String addMappingProject(
      @RequestParam("mapping-project-name") String name,
      @RequestParam("target-entity") String targetEntity,
      @RequestParam("depth") int depth); @PostMapping("/removeMappingProject") String deleteMappingProject(@RequestParam() String mappingProjectId); @PostMapping("/removeAttributeMapping") String removeAttributeMapping(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam() String source,
      @RequestParam() String attribute); @PostMapping("/addEntityMapping") String addEntityMapping(
      @RequestParam String mappingProjectId, String target, String source, String algorithmSource); @PostMapping("/removeEntityMapping") String removeEntityMapping(
      @RequestParam String mappingProjectId, String target, String source); @PostMapping("/validateAttrMapping") @ResponseBody AttributeMappingValidationReport validateAttributeMapping(
      @Valid @RequestBody MappingServiceRequest mappingServiceRequest); @PostMapping("/saveattributemapping") String saveAttributeMapping(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam() String source,
      @RequestParam() String targetAttribute,
      @RequestParam() String algorithm,
      @RequestParam() AlgorithmState algorithmState); @PostMapping("/firstattributemapping") @ResponseBody FirstAttributeMappingInfo getFirstAttributeMappingInfo(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam(value = "skipAlgorithmStates[]") List<AlgorithmState> skipAlgorithmStates,
      Model model); @GetMapping("/mappingproject/{id}") String viewMappingProject(@PathVariable("id") String identifier, Model model); @PostMapping("/mappingproject/clone") String cloneMappingProject(@RequestParam("mappingProjectId") String mappingProjectId); @PostMapping("/mappingproject/setDepth") String cloneMappingProject(
      @RequestParam("mappingProjectId") String mappingProjectId, @RequestParam("depth") int depth); @PostMapping(value = "/attributeMapping/semanticsearch", consumes = APPLICATION_JSON_VALUE) @ResponseBody List<ExplainedAttributeDto> getSemanticSearchAttributeMapping(
      @RequestBody Map<String, String> requestBody); @PostMapping(value = "/attributemapping/algorithm", consumes = APPLICATION_JSON_VALUE) @ResponseBody String getSuggestedAlgorithm(
      @RequestBody GenerateAlgorithmRequest generateAlgorithmRequest); @GetMapping("/isNewEntity") @ResponseBody boolean isNewEntity(@RequestParam String targetEntityTypeId); @PostMapping("/createIntegratedEntity") String createIntegratedEntity(
      @RequestParam String mappingProjectId,
      @RequestParam String targetEntityTypeId,
      @RequestParam(required = false) String label,
      @RequestParam(required = false, name = "package") String packageId,
      @RequestParam(required = false) Boolean addSourceAttribute); @PostMapping(value = "/map", produces = TEXT_PLAIN_VALUE) ResponseEntity<String> scheduleMappingJob(
      @RequestParam String mappingProjectId,
      @RequestParam String targetEntityTypeId,
      @RequestParam(required = false) String label,
      @RequestParam(required = false, name = "package") String rawPackageId,
      @RequestParam(required = false) Boolean addSourceAttribute); @PostMapping(value = "/submit", produces = TEXT_PLAIN_VALUE) ResponseEntity<String> submitMappingJob(
      @RequestParam String mappingProjectId,
      @RequestParam String targetEntityTypeId,
      @RequestParam(required = false) Boolean addSourceAttribute,
      @RequestParam(required = false, name = "package") String packageId,
      @RequestParam(required = false) String label); @GetMapping("/attributeMapping") String viewAttributeMapping(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam() String source,
      @RequestParam() String targetAttribute,
      Model model); @PostMapping("/attributemappingfeedback") String attributeMappingFeedback(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam() String source,
      @RequestParam() String targetAttribute,
      @RequestParam() String algorithm,
      Model model); @PostMapping("/advancedmappingeditor") String advancedMappingEditor(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam() String source,
      @RequestParam() String targetAttribute,
      @RequestParam() String sourceAttribute,
      @RequestParam String algorithm,
      Model model); @PostMapping("/savecategorymapping") @ResponseBody void saveCategoryMapping(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam() String source,
      @RequestParam() String targetAttribute,
      @RequestParam() String algorithm); @PostMapping( value = "/mappingattribute/testscript", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) @ResponseBody Map<String, Object> testScript(@RequestBody MappingServiceRequest mappingServiceRequest); }
MappingServiceController extends PluginController { @PostMapping("/addEntityMapping") public String addEntityMapping( @RequestParam String mappingProjectId, String target, String source, String algorithmSource) { EntityType sourceEntityType = dataService.getEntityType(source); EntityType algorithmSourceEntityType = !StringUtils.isBlank(algorithmSource) ? dataService.getEntityType(algorithmSource) : null; EntityType targetEntityType = dataService.getEntityType(target); MappingProject project = mappingService.getMappingProject(mappingProjectId); EntityMapping mapping = project.getMappingTarget(target).addSource(sourceEntityType); mappingService.updateMappingProject(project); if (algorithmSourceEntityType == null) { autoGenerateAlgorithms(mapping, sourceEntityType, targetEntityType, project); } else { EntityMapping copySourceEntityMapping = project.getMappingTarget(target).getMappingForSource(algorithmSource); copyAlgorithms(project, mapping, copySourceEntityMapping); } return "redirect:" + getMappingServiceMenuUrl() + "/mappingproject/" + mappingProjectId; } MappingServiceController(
      AlgorithmService algorithmService,
      MappingService mappingService,
      DataService dataService,
      OntologyTagService ontologyTagService,
      SemanticSearchService semanticSearchService,
      MenuReaderService menuReaderService,
      MappingJobExecutionFactory mappingJobExecutionFactory,
      JobExecutor jobExecutor,
      JobsController jobsController); @GetMapping String viewMappingProjects(Model model); @PostMapping("/addMappingProject") String addMappingProject(
      @RequestParam("mapping-project-name") String name,
      @RequestParam("target-entity") String targetEntity,
      @RequestParam("depth") int depth); @PostMapping("/removeMappingProject") String deleteMappingProject(@RequestParam() String mappingProjectId); @PostMapping("/removeAttributeMapping") String removeAttributeMapping(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam() String source,
      @RequestParam() String attribute); @PostMapping("/addEntityMapping") String addEntityMapping(
      @RequestParam String mappingProjectId, String target, String source, String algorithmSource); @PostMapping("/removeEntityMapping") String removeEntityMapping(
      @RequestParam String mappingProjectId, String target, String source); @PostMapping("/validateAttrMapping") @ResponseBody AttributeMappingValidationReport validateAttributeMapping(
      @Valid @RequestBody MappingServiceRequest mappingServiceRequest); @PostMapping("/saveattributemapping") String saveAttributeMapping(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam() String source,
      @RequestParam() String targetAttribute,
      @RequestParam() String algorithm,
      @RequestParam() AlgorithmState algorithmState); @PostMapping("/firstattributemapping") @ResponseBody FirstAttributeMappingInfo getFirstAttributeMappingInfo(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam(value = "skipAlgorithmStates[]") List<AlgorithmState> skipAlgorithmStates,
      Model model); @GetMapping("/mappingproject/{id}") String viewMappingProject(@PathVariable("id") String identifier, Model model); @PostMapping("/mappingproject/clone") String cloneMappingProject(@RequestParam("mappingProjectId") String mappingProjectId); @PostMapping("/mappingproject/setDepth") String cloneMappingProject(
      @RequestParam("mappingProjectId") String mappingProjectId, @RequestParam("depth") int depth); @PostMapping(value = "/attributeMapping/semanticsearch", consumes = APPLICATION_JSON_VALUE) @ResponseBody List<ExplainedAttributeDto> getSemanticSearchAttributeMapping(
      @RequestBody Map<String, String> requestBody); @PostMapping(value = "/attributemapping/algorithm", consumes = APPLICATION_JSON_VALUE) @ResponseBody String getSuggestedAlgorithm(
      @RequestBody GenerateAlgorithmRequest generateAlgorithmRequest); @GetMapping("/isNewEntity") @ResponseBody boolean isNewEntity(@RequestParam String targetEntityTypeId); @PostMapping("/createIntegratedEntity") String createIntegratedEntity(
      @RequestParam String mappingProjectId,
      @RequestParam String targetEntityTypeId,
      @RequestParam(required = false) String label,
      @RequestParam(required = false, name = "package") String packageId,
      @RequestParam(required = false) Boolean addSourceAttribute); @PostMapping(value = "/map", produces = TEXT_PLAIN_VALUE) ResponseEntity<String> scheduleMappingJob(
      @RequestParam String mappingProjectId,
      @RequestParam String targetEntityTypeId,
      @RequestParam(required = false) String label,
      @RequestParam(required = false, name = "package") String rawPackageId,
      @RequestParam(required = false) Boolean addSourceAttribute); @PostMapping(value = "/submit", produces = TEXT_PLAIN_VALUE) ResponseEntity<String> submitMappingJob(
      @RequestParam String mappingProjectId,
      @RequestParam String targetEntityTypeId,
      @RequestParam(required = false) Boolean addSourceAttribute,
      @RequestParam(required = false, name = "package") String packageId,
      @RequestParam(required = false) String label); @GetMapping("/attributeMapping") String viewAttributeMapping(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam() String source,
      @RequestParam() String targetAttribute,
      Model model); @PostMapping("/attributemappingfeedback") String attributeMappingFeedback(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam() String source,
      @RequestParam() String targetAttribute,
      @RequestParam() String algorithm,
      Model model); @PostMapping("/advancedmappingeditor") String advancedMappingEditor(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam() String source,
      @RequestParam() String targetAttribute,
      @RequestParam() String sourceAttribute,
      @RequestParam String algorithm,
      Model model); @PostMapping("/savecategorymapping") @ResponseBody void saveCategoryMapping(
      @RequestParam() String mappingProjectId,
      @RequestParam() String target,
      @RequestParam() String source,
      @RequestParam() String targetAttribute,
      @RequestParam() String algorithm); @PostMapping( value = "/mappingattribute/testscript", consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) @ResponseBody Map<String, Object> testScript(@RequestBody MappingServiceRequest mappingServiceRequest); static final String ID; static final String URI; }