All Downloads are FREE. Search and download functionalities are using the official Maven repository.

internal.sdmxdl.cli.WebConceptOptions Maven / Gradle / Ivy

The newest version!
package internal.sdmxdl.cli;

import picocli.CommandLine;
import sdmxdl.Component;
import sdmxdl.Structure;
import sdmxdl.web.SdmxWebManager;

import java.io.IOException;
import java.util.stream.Stream;

@lombok.Getter
@lombok.Setter
public class WebConceptOptions extends WebFlowOptions {

    @CommandLine.Parameters(
            index = "2",
            paramLabel = "",
            descriptionKey = "cli.sdmx.concept"
    )
    private String concept;

    public Component loadComponent(SdmxWebManager manager) throws IOException {
        Structure dsd = loadStructure(manager);
        return Stream.concat(dsd.getDimensions().stream(), dsd.getAttributes().stream())
                .filter(component -> component.getId().equals(getConcept()))
                .findFirst()
                .orElseThrow(() -> new IOException("Cannot find concept '" + getConcept() + "'"));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy