Search in sources :

Example 1 with AsyncExecutionResult

use of org.talend.dataprep.async.AsyncExecutionResult in project data-prep by Talend.

the class PrepMetadataGetContentUrlGenerator method generateResultUrl.

@Override
public AsyncExecutionResult generateResultUrl(Object... args) {
    // check pre-condition
    Validate.notNull(args);
    Validate.isTrue(args.length == 2);
    Validate.isInstanceOf(String.class, args[0]);
    Validate.isInstanceOf(String.class, args[1]);
    String preparationId = (String) args[0];
    String headId = (String) args[1];
    URIBuilder builder = new URIBuilder();
    builder.setPath("/api/preparations/" + preparationId + "/metadata");
    if (StringUtils.isNotEmpty(headId)) {
        builder.setParameter("version", headId);
    }
    return new AsyncExecutionResult(builder.toString());
}
Also used : AsyncExecutionResult(org.talend.dataprep.async.AsyncExecutionResult) URIBuilder(org.apache.http.client.utils.URIBuilder)

Example 2 with AsyncExecutionResult

use of org.talend.dataprep.async.AsyncExecutionResult in project data-prep by Talend.

the class PreparationGetContentUrlGenerator method generateResultUrl.

@Override
public AsyncExecutionResult generateResultUrl(Object... args) {
    // check pre-condition
    Validate.notNull(args);
    Validate.isTrue(args.length == 1);
    Validate.isInstanceOf(ExportParameters.class, args[0]);
    ExportParameters param = (ExportParameters) args[0];
    URIBuilder builder = new URIBuilder();
    builder.setPath("/api/preparations/" + param.getPreparationId() + "/content");
    if (StringUtils.isNotEmpty(param.getStepId())) {
        builder.setParameter("version", param.getStepId());
    }
    if (param.getFrom() != null) {
        builder.setParameter("from", param.getFrom().name());
    }
    return new AsyncExecutionResult(builder.toString());
}
Also used : AsyncExecutionResult(org.talend.dataprep.async.AsyncExecutionResult) ExportParameters(org.talend.dataprep.api.export.ExportParameters) URIBuilder(org.apache.http.client.utils.URIBuilder)

Aggregations

URIBuilder (org.apache.http.client.utils.URIBuilder)2 AsyncExecutionResult (org.talend.dataprep.async.AsyncExecutionResult)2 ExportParameters (org.talend.dataprep.api.export.ExportParameters)1