Search in sources :

Example 21 with Parameter

use of org.talend.dataprep.parameters.Parameter in project data-prep by Talend.

the class LookupTest method shouldAdapt.

@Test
public void shouldAdapt() {
    // given
    final DataSetMetadata ds = new DataSetMetadata("ds#123", "great dataset", "", 0, 0, new RowMetadata(), "1.0.0");
    // when
    final Lookup actual = action.adapt(ds);
    // when
    final List<Parameter> parameters = actual.getParameters(Locale.US);
    assertEquals("great dataset", getParamValue(parameters, "lookup_ds_name"));
    assertEquals("ds#123", getParamValue(parameters, "lookup_ds_id"));
}
Also used : RowMetadata(org.talend.dataprep.api.dataset.RowMetadata) Parameter(org.talend.dataprep.parameters.Parameter) DataSetMetadata(org.talend.dataprep.api.dataset.DataSetMetadata) Test(org.junit.Test) AbstractMetadataBaseTest(org.talend.dataprep.transformation.actions.AbstractMetadataBaseTest)

Example 22 with Parameter

use of org.talend.dataprep.parameters.Parameter in project data-prep by Talend.

the class RemoveRepeatedCharsTest method testGetParameters.

@Test
public void testGetParameters() throws Exception {
    final List<Parameter> parameters = action.getParameters(Locale.US);
    assertEquals(6, parameters.size());
    final SelectParameter parameter4 = (SelectParameter) parameters.get(5);
    assertEquals(2, parameter4.getItems().size());
    assertEquals("Whitespace", parameter4.getItems().get(0).getLabel());
    assertEquals("Other", parameter4.getItems().get(1).getLabel());
}
Also used : SelectParameter(org.talend.dataprep.parameters.SelectParameter) Parameter(org.talend.dataprep.parameters.Parameter) SelectParameter(org.talend.dataprep.parameters.SelectParameter) Test(org.junit.Test) AbstractMetadataBaseTest(org.talend.dataprep.transformation.actions.AbstractMetadataBaseTest)

Example 23 with Parameter

use of org.talend.dataprep.parameters.Parameter in project data-prep by Talend.

the class DurationConverter method getParameters.

@Override
public List<Parameter> getParameters(Locale locale) {
    final List<Parameter> parameters = super.getParameters(locale);
    parameters.add(ActionsUtils.getColumnCreationParameter(locale, CREATE_NEW_COLUMN_DEFAULT));
    // @formatter:off
    SelectParameterBuilder builder = selectParameter(locale).item(YEARS.name(), YEARS.toString()).item(MONTHS.name(), MONTHS.toString()).item(WEEKS.name(), WEEKS.toString()).item(DAYS.name(), DAYS.toString()).item(HOURS.name(), HOURS.toString()).item(MINUTES.name(), MINUTES.toString()).item(SECONDS.name(), SECONDS.toString()).item(MILLIS.name(), MILLIS.toString()).canBeBlank(false);
    parameters.add(builder.name(FROM_UNIT_PARAMETER).defaultValue(DAYS.name()).build(this));
    builder.setDescription(null).setLabel(null);
    parameters.add(builder.name(TO_UNIT_PARAMETER).defaultValue(HOURS.name()).build(this));
    parameters.add(parameter(locale).setName(TARGET_PRECISION).setType(INTEGER).setDefaultValue("1").setPlaceHolder("precision").build(this));
    // @formatter:on
    return parameters;
}
Also used : SelectParameterBuilder(org.talend.dataprep.parameters.SelectParameter.SelectParameterBuilder) Parameter(org.talend.dataprep.parameters.Parameter) SelectParameter.selectParameter(org.talend.dataprep.parameters.SelectParameter.selectParameter)

Example 24 with Parameter

use of org.talend.dataprep.parameters.Parameter in project data-prep by Talend.

the class StandardizeInvalid method getParameters.

@Override
public List<Parameter> getParameters(Locale locale) {
    final List<Parameter> parameters = super.getParameters(locale);
    Parameter startParameter = selectParameter(locale).name(MATCH_THRESHOLD_PARAMETER).item(MatchThresholdEnum.HIGH.name(), MatchThresholdEnum.HIGH.getLabel()).item(MatchThresholdEnum.DEFAULT.name(), MatchThresholdEnum.DEFAULT.getLabel()).item(MatchThresholdEnum.NONE.name(), MatchThresholdEnum.NONE.getLabel()).defaultValue(MatchThresholdEnum.DEFAULT.name()).build(this);
    parameters.add(startParameter);
    return parameters;
}
Also used : Parameter(org.talend.dataprep.parameters.Parameter) SelectParameter.selectParameter(org.talend.dataprep.parameters.SelectParameter.selectParameter)

Example 25 with Parameter

use of org.talend.dataprep.parameters.Parameter in project data-prep by Talend.

the class DateCalendarConverter method getParameters.

@Override
public List<Parameter> getParameters(Locale locale) {
    final List<Parameter> parameters = super.getParameters(locale);
    parameters.add(ActionsUtils.getColumnCreationParameter(locale, CREATE_NEW_COLUMN_DEFAULT));
    final Parameter toJulianDayOrISOParameters = selectParameter(locale).name(TO_CALENDAR_TYPE_PARAMETER).item(ISO.name(), ISO.toString()).item(JULIAN_DAY.name(), JULIAN_DAY.toString()).item(MODIFIED_JULIAN_DAY.name(), MODIFIED_JULIAN_DAY.toString()).item(RATA_DIE.name(), RATA_DIE.toString()).item(EPOCH_DAY.name(), EPOCH_DAY.toString()).defaultValue(ISO.name()).build(this);
    final Parameter toCompleteParameters = selectParameter(locale).name(TO_CALENDAR_TYPE_PARAMETER).item(ISO.name(), ISO.toString()).item(HIJRI.name(), HIJRI.toString()).item(JAPANESE.name(), JAPANESE.toString()).item(MINGUO.name(), MINGUO.toString()).item(THAI_BUDDHIST.name(), THAI_BUDDHIST.toString()).item(JULIAN_DAY.name(), JULIAN_DAY.toString()).item(MODIFIED_JULIAN_DAY.name(), MODIFIED_JULIAN_DAY.toString()).item(RATA_DIE.name(), RATA_DIE.toString()).item(EPOCH_DAY.name(), EPOCH_DAY.toString()).defaultValue(MINGUO.name()).build(this);
    // @formatter:off
    parameters.add(selectParameter(locale).name(FROM_CALENDAR_TYPE_PARAMETER).item(ISO.name(), ISO.toString(), toCompleteParameters).item(HIJRI.name(), HIJRI.toString(), toCompleteParameters).item(JAPANESE.name(), JAPANESE.toString(), toCompleteParameters).item(MINGUO.name(), MINGUO.toString(), toCompleteParameters).item(THAI_BUDDHIST.name(), THAI_BUDDHIST.toString(), toCompleteParameters).item(JULIAN_DAY.name(), JULIAN_DAY.toString(), toJulianDayOrISOParameters).item(MODIFIED_JULIAN_DAY.name(), MODIFIED_JULIAN_DAY.toString(), toJulianDayOrISOParameters).item(RATA_DIE.name(), RATA_DIE.toString(), toJulianDayOrISOParameters).item(EPOCH_DAY.name(), EPOCH_DAY.toString(), toJulianDayOrISOParameters).defaultValue(ISO.name()).build(this));
    return parameters;
}
Also used : Parameter(org.talend.dataprep.parameters.Parameter) SelectParameter.selectParameter(org.talend.dataprep.parameters.SelectParameter.selectParameter)

Aggregations

Parameter (org.talend.dataprep.parameters.Parameter)25 Test (org.junit.Test)10 SelectParameter (org.talend.dataprep.parameters.SelectParameter)7 SelectParameter.selectParameter (org.talend.dataprep.parameters.SelectParameter.selectParameter)7 AbstractMetadataBaseTest (org.talend.dataprep.transformation.actions.AbstractMetadataBaseTest)5 ActionDefinition (org.talend.dataprep.api.action.ActionDefinition)2 ColumnMetadata (org.talend.dataprep.api.dataset.ColumnMetadata)2 ExportFormatMessage (org.talend.dataprep.format.export.ExportFormatMessage)2 SelectParameterBuilder (org.talend.dataprep.parameters.SelectParameter.SelectParameterBuilder)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 StringWriter (java.io.StringWriter)1 java.util (java.util)1 List (java.util.List)1 Predicate (java.util.function.Predicate)1 Collectors (java.util.stream.Collectors)1 Collectors.toSet (java.util.stream.Collectors.toSet)1 DataSetMetadata (org.talend.dataprep.api.dataset.DataSetMetadata)1 RowMetadata (org.talend.dataprep.api.dataset.RowMetadata)1 Action (org.talend.dataprep.api.preparation.Action)1 ParameterType (org.talend.dataprep.parameters.ParameterType)1