@Test public void testGetPMMLDocumentModelParameterNames() { final List<PMMLDocumentMetadata> pmmlDocuments = new ArrayList<>(); pmmlDocuments.add(new PMMLDocumentMetadata("path", "document", DMNImportTypes.PMML.getDefaultNamespace(), singletonList(new PMMLModelMetadata("model", new Sets.Builder<PMMLParameterMetadata>() .add(new PMMLParameterMetadata("zParameter1")) .add(new PMMLParameterMetadata("aParameter2")) .build())))); final ServiceCallback<List<PMMLDocumentMetadata>> callback = loadPMMLIncludedDocuments(); callback.onSuccess(pmmlDocuments); final List<String> modelNames = provider.getPMMLDocumentModelParameterNames("document", "model"); assertThat(modelNames).containsSequence("aParameter2", "zParameter1"); assertThat(provider.getPMMLDocumentModelParameterNames("unknown", "unknown")).isEmpty(); }
public List<String> getPMMLDocumentModelParameterNames(final String pmmlDocumentName, final String pmmlDocumentModelName) { final List<String> pmmlDocumentModelParameterNames = new ArrayList<>(); if (pmmlDocuments.containsKey(pmmlDocumentName)) { final PMMLDocumentMetadata document = pmmlDocuments.get(pmmlDocumentName); document.getModels().stream().filter(model -> Objects.equals(pmmlDocumentModelName, model.getName())) .findFirst() .map(PMMLModelMetadata::getInputParameters) .orElse(Collections.emptySet()) .forEach(parameter -> pmmlDocumentModelParameterNames.add(parameter.getName())); pmmlDocumentModelParameterNames.sort(Comparator.naturalOrder()); } return pmmlDocumentModelParameterNames; }
PMMLDocumentMetadataProvider { public List<String> getPMMLDocumentModelParameterNames(final String pmmlDocumentName, final String pmmlDocumentModelName) { final List<String> pmmlDocumentModelParameterNames = new ArrayList<>(); if (pmmlDocuments.containsKey(pmmlDocumentName)) { final PMMLDocumentMetadata document = pmmlDocuments.get(pmmlDocumentName); document.getModels().stream().filter(model -> Objects.equals(pmmlDocumentModelName, model.getName())) .findFirst() .map(PMMLModelMetadata::getInputParameters) .orElse(Collections.emptySet()) .forEach(parameter -> pmmlDocumentModelParameterNames.add(parameter.getName())); pmmlDocumentModelParameterNames.sort(Comparator.naturalOrder()); } return pmmlDocumentModelParameterNames; } }
PMMLDocumentMetadataProvider { public List<String> getPMMLDocumentModelParameterNames(final String pmmlDocumentName, final String pmmlDocumentModelName) { final List<String> pmmlDocumentModelParameterNames = new ArrayList<>(); if (pmmlDocuments.containsKey(pmmlDocumentName)) { final PMMLDocumentMetadata document = pmmlDocuments.get(pmmlDocumentName); document.getModels().stream().filter(model -> Objects.equals(pmmlDocumentModelName, model.getName())) .findFirst() .map(PMMLModelMetadata::getInputParameters) .orElse(Collections.emptySet()) .forEach(parameter -> pmmlDocumentModelParameterNames.add(parameter.getName())); pmmlDocumentModelParameterNames.sort(Comparator.naturalOrder()); } return pmmlDocumentModelParameterNames; } PMMLDocumentMetadataProvider(); @Inject  PMMLDocumentMetadataProvider(final DMNGraphUtils graphUtils,
                                        final DMNClientServicesProxy clientServicesProxy,
                                        final IncludedModelsPageStateProviderImpl stateProvider); }
PMMLDocumentMetadataProvider { public List<String> getPMMLDocumentModelParameterNames(final String pmmlDocumentName, final String pmmlDocumentModelName) { final List<String> pmmlDocumentModelParameterNames = new ArrayList<>(); if (pmmlDocuments.containsKey(pmmlDocumentName)) { final PMMLDocumentMetadata document = pmmlDocuments.get(pmmlDocumentName); document.getModels().stream().filter(model -> Objects.equals(pmmlDocumentModelName, model.getName())) .findFirst() .map(PMMLModelMetadata::getInputParameters) .orElse(Collections.emptySet()) .forEach(parameter -> pmmlDocumentModelParameterNames.add(parameter.getName())); pmmlDocumentModelParameterNames.sort(Comparator.naturalOrder()); } return pmmlDocumentModelParameterNames; } PMMLDocumentMetadataProvider(); @Inject  PMMLDocumentMetadataProvider(final DMNGraphUtils graphUtils,
                                        final DMNClientServicesProxy clientServicesProxy,
                                        final IncludedModelsPageStateProviderImpl stateProvider); @PostConstruct void loadPMMLIncludedDocuments(); @SuppressWarnings("unused") void onRefreshDecisionComponents(final @Observes RefreshDecisionComponents events); List<String> getPMMLDocumentNames(); List<String> getPMMLDocumentModels(final String pmmlDocumentName); List<String> getPMMLDocumentModelParameterNames(final String pmmlDocumentName,
                                                           final String pmmlDocumentModelName); }
PMMLDocumentMetadataProvider { public List<String> getPMMLDocumentModelParameterNames(final String pmmlDocumentName, final String pmmlDocumentModelName) { final List<String> pmmlDocumentModelParameterNames = new ArrayList<>(); if (pmmlDocuments.containsKey(pmmlDocumentName)) { final PMMLDocumentMetadata document = pmmlDocuments.get(pmmlDocumentName); document.getModels().stream().filter(model -> Objects.equals(pmmlDocumentModelName, model.getName())) .findFirst() .map(PMMLModelMetadata::getInputParameters) .orElse(Collections.emptySet()) .forEach(parameter -> pmmlDocumentModelParameterNames.add(parameter.getName())); pmmlDocumentModelParameterNames.sort(Comparator.naturalOrder()); } return pmmlDocumentModelParameterNames; } PMMLDocumentMetadataProvider(); @Inject  PMMLDocumentMetadataProvider(final DMNGraphUtils graphUtils,
                                        final DMNClientServicesProxy clientServicesProxy,
                                        final IncludedModelsPageStateProviderImpl stateProvider); @PostConstruct void loadPMMLIncludedDocuments(); @SuppressWarnings("unused") void onRefreshDecisionComponents(final @Observes RefreshDecisionComponents events); List<String> getPMMLDocumentNames(); List<String> getPMMLDocumentModels(final String pmmlDocumentName); List<String> getPMMLDocumentModelParameterNames(final String pmmlDocumentName,
                                                           final String pmmlDocumentModelName);  }