use of com.spectralogic.ds3autogen.java.models.QueryParam in project ds3_autogen by SpectraLogic.
the class BaseRequestGenerator_Test method modifyQueryParamType_FullList_Test.
@Test
public void modifyQueryParamType_FullList_Test() {
final ImmutableList<QueryParam> params = ImmutableList.of(new QueryParam("CurType", "Name"));
final ImmutableList<QueryParam> result = modifyQueryParamType(params, "CurType", "NewType");
assertThat(result.size(), is(1));
assertThat(result.get(0).getName(), is("Name"));
assertThat(result.get(0).getType(), is("NewType"));
}
use of com.spectralogic.ds3autogen.java.models.QueryParam in project ds3_autogen by SpectraLogic.
the class CreateObjectRequestGenerator method toConstructorList.
/**
* Gets the list of constructor models from a Ds3Request. This includes the
* Create Object deprecated constructor, a constructor that uses the parameter
* Channel, and a constructor that has an InputStream parameter
*/
@Override
public ImmutableList<RequestConstructor> toConstructorList(final Ds3Request ds3Request, final String requestName, final Ds3DocSpec docSpec) {
final ImmutableList<Arguments> constructorArgs = toConstructorArgumentsList(ds3Request);
final ImmutableList<Arguments> optionalArgs = toArgumentsList(ds3Request.getOptionalQueryParams());
final ImmutableList<QueryParam> queryParams = toQueryParamsList(ds3Request);
final RequestConstructor depreciatedConstructor = createDeprecatedConstructor(constructorArgs, requestName, docSpec);
final RequestConstructor channelConstructor = getChannelConstructor(constructorArgs, optionalArgs, queryParams, requestName, docSpec);
final RequestConstructor inputStreamConstructor = getInputStreamConstructor(constructorArgs, optionalArgs, queryParams, requestName, docSpec);
return ImmutableList.of(depreciatedConstructor, channelConstructor, inputStreamConstructor);
}
use of com.spectralogic.ds3autogen.java.models.QueryParam in project ds3_autogen by SpectraLogic.
the class GetObjectRequestGenerator method createOutputStreamConstructor.
/**
* Creates the constructor for the get object request that uses OutputStream
*/
protected static RequestConstructor createOutputStreamConstructor(final ImmutableList<Arguments> constructorArgs, final ImmutableList<Arguments> optionalArgs, final ImmutableList<QueryParam> queryParams, final String requestName, final Ds3DocSpec docSpec) {
final ImmutableList.Builder<Arguments> constructorArgBuilder = ImmutableList.builder();
constructorArgBuilder.addAll(constructorArgs);
constructorArgBuilder.addAll(optionalArgs);
constructorArgBuilder.add(new Arguments("OutputStream", "Stream"));
final ImmutableList.Builder<QueryParam> queryParamsBuilder = ImmutableList.builder();
queryParamsBuilder.addAll(queryParams);
queryParamsBuilder.addAll(argsToQueryParams(optionalArgs));
final ImmutableList.Builder<Arguments> assignmentsBuilder = ImmutableList.builder();
assignmentsBuilder.addAll(constructorArgs);
assignmentsBuilder.addAll(optionalArgs);
final ImmutableList<Arguments> updatedConstructorArgs = constructorArgBuilder.build();
final ImmutableList<String> argNames = updatedConstructorArgs.stream().map(Arguments::getName).collect(GuavaCollectors.immutableList());
final ImmutableList<String> additionalLines = ImmutableList.of("this.channel = Channels.newChannel(stream);");
return new RequestConstructor(false, additionalLines, updatedConstructorArgs, assignmentsBuilder.build(), queryParamsBuilder.build(), toConstructorDocs(requestName, argNames, docSpec, 1));
}
Aggregations