@Test void testViewMappingProject() { when(mappingService.getMappingProject("hop hop hop")).thenReturn(mappingProject); when(dataService.getEntityTypeIds()).thenReturn(Stream.of("LifeLines", "entity1", "entity2")); when(mappingService.getCompatibleEntityTypes(hop)) .thenReturn(Stream.of(lifeLines, target1, target2)); when(dataService.getEntityType("HOP")).thenReturn(hop); OntologyTerm ontologyTermAge = OntologyTerm.create("iri1", "label1"); OntologyTerm ontologyTermDateOfBirth = OntologyTerm.create("iri2", "label2"); when(ontologyTagService.getTagsForAttribute(hop, ageAttr)) .thenReturn(ImmutableMultimap.of(isAssociatedWith, ontologyTermAge)); when(ontologyTagService.getTagsForAttribute(hop, dobAttr)) .thenReturn(ImmutableMultimap.of(isAssociatedWith, ontologyTermDateOfBirth)); when(dataService.getMeta()).thenReturn(metaDataService); when(metaDataService.getPackages()).thenReturn(asList(system, base)); when(system.getId()).thenReturn(PACKAGE_SYSTEM); when(base.getId()).thenReturn("base"); when(dataService.getEntityType("entity1")).thenReturn(target1); when(dataService.getEntityType("entity2")).thenReturn(target2); String view = controller.viewMappingProject("hop hop hop", model); assertEquals("view-single-mapping-project", view); verify(model).addAttribute("entityTypes", asList(target1, target2)); verify(model).addAttribute("packages", singletonList(base)); verify(model).addAttribute("compatibleTargetEntities", asList(lifeLines, target1, target2)); verify(model).addAttribute("selectedTarget", "HOP"); verify(model).addAttribute("mappingProject", mappingProject); verify(model) .addAttribute( "attributeTagMap", ImmutableMap.of( "dob", singletonList(ontologyTermDateOfBirth), "age", singletonList(ontologyTermAge))); }
@GetMapping("/mappingproject/{id}") public String viewMappingProject(@PathVariable("id") String identifier, Model model) { MappingProject project = mappingService.getMappingProject(identifier); MappingTarget mappingTarget = project.getMappingTargets().get(0); String target = mappingTarget.getName(); model.addAttribute("entityTypes", getNewSources(mappingTarget)); model.addAttribute( "compatibleTargetEntities", mappingService.getCompatibleEntityTypes(mappingTarget.getTarget()).collect(toList())); model.addAttribute("selectedTarget", target); model.addAttribute("mappingProject", project); model.addAttribute("attributeTagMap", getTagsForAttribute(target, project)); model.addAttribute( "packages", dataService.getMeta().getPackages().stream() .filter(p -> !isSystemPackage(p)) .collect(toList())); return VIEW_SINGLE_MAPPING_PROJECT; }
MappingServiceController extends PluginController { @GetMapping("/mappingproject/{id}") public String viewMappingProject(@PathVariable("id") String identifier, Model model) { MappingProject project = mappingService.getMappingProject(identifier); MappingTarget mappingTarget = project.getMappingTargets().get(0); String target = mappingTarget.getName(); model.addAttribute("entityTypes", getNewSources(mappingTarget)); model.addAttribute( "compatibleTargetEntities", mappingService.getCompatibleEntityTypes(mappingTarget.getTarget()).collect(toList())); model.addAttribute("selectedTarget", target); model.addAttribute("mappingProject", project); model.addAttribute("attributeTagMap", getTagsForAttribute(target, project)); model.addAttribute( "packages", dataService.getMeta().getPackages().stream() .filter(p -> !isSystemPackage(p)) .collect(toList())); return VIEW_SINGLE_MAPPING_PROJECT; } }
MappingServiceController extends PluginController { @GetMapping("/mappingproject/{id}") public String viewMappingProject(@PathVariable("id") String identifier, Model model) { MappingProject project = mappingService.getMappingProject(identifier); MappingTarget mappingTarget = project.getMappingTargets().get(0); String target = mappingTarget.getName(); model.addAttribute("entityTypes", getNewSources(mappingTarget)); model.addAttribute( "compatibleTargetEntities", mappingService.getCompatibleEntityTypes(mappingTarget.getTarget()).collect(toList())); model.addAttribute("selectedTarget", target); model.addAttribute("mappingProject", project); model.addAttribute("attributeTagMap", getTagsForAttribute(target, project)); model.addAttribute( "packages", dataService.getMeta().getPackages().stream() .filter(p -> !isSystemPackage(p)) .collect(toList())); return VIEW_SINGLE_MAPPING_PROJECT; } MappingServiceController(
      AlgorithmService algorithmService,
      MappingService mappingService,
      DataService dataService,
      OntologyTagService ontologyTagService,
      SemanticSearchService semanticSearchService,
      MenuReaderService menuReaderService,
      MappingJobExecutionFactory mappingJobExecutionFactory,
      JobExecutor jobExecutor,
      JobsController jobsController); }
MappingServiceController extends PluginController { @GetMapping("/mappingproject/{id}") public String viewMappingProject(@PathVariable("id") String identifier, Model model) { MappingProject project = mappingService.getMappingProject(identifier); MappingTarget mappingTarget = project.getMappingTargets().get(0); String target = mappingTarget.getName(); model.addAttribute("entityTypes", getNewSources(mappingTarget)); model.addAttribute( "compatibleTargetEntities", mappingService.getCompatibleEntityTypes(mappingTarget.getTarget()).collect(toList())); model.addAttribute("selectedTarget", target); model.addAttribute("mappingProject", project); model.addAttribute("attributeTagMap", getTagsForAttribute(target, project)); model.addAttribute( "packages", dataService.getMeta().getPackages().stream() .filter(p -> !isSystemPackage(p)) .collect(toList())); return VIEW_SINGLE_MAPPING_PROJECT; } 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 { @GetMapping("/mappingproject/{id}") public String viewMappingProject(@PathVariable("id") String identifier, Model model) { MappingProject project = mappingService.getMappingProject(identifier); MappingTarget mappingTarget = project.getMappingTargets().get(0); String target = mappingTarget.getName(); model.addAttribute("entityTypes", getNewSources(mappingTarget)); model.addAttribute( "compatibleTargetEntities", mappingService.getCompatibleEntityTypes(mappingTarget.getTarget()).collect(toList())); model.addAttribute("selectedTarget", target); model.addAttribute("mappingProject", project); model.addAttribute("attributeTagMap", getTagsForAttribute(target, project)); model.addAttribute( "packages", dataService.getMeta().getPackages().stream() .filter(p -> !isSystemPackage(p)) .collect(toList())); return VIEW_SINGLE_MAPPING_PROJECT; } 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; }