Example usage for com.google.common.collect ImmutableList containsAll

List of usage examples for com.google.common.collect ImmutableList containsAll

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableList containsAll.

Prototype

boolean containsAll(Collection<?> c);

Source Link

Document

Returns true if this list contains all of the elements of the specified collection.

Usage

From source file:com.spectralogic.ds3autogen.java.generators.responseparser.HeadObjectParserGenerator.java

/**
 * Gets the non-error response codes required to generate this response
 *///w  w  w .j av  a  2s.c  o m
@Override
public ImmutableList<ResponseCode> toResponseCodeList(final ImmutableList<Ds3ResponseCode> ds3ResponseCodes,
        final String responseName, final boolean hasPaginationHeaders) {
    //Verify that the expected status codes are present
    final ImmutableList<Integer> codes = getResponseCodes(ds3ResponseCodes);
    if (!codes.containsAll(EXPECTED_RESPONSE_CODES)) {
        throw new IllegalArgumentException(
                "Does not contain expected response codes: " + EXPECTED_RESPONSE_CODES.toString());
    }

    final ResponseCode code200 = new ResponseCode(200, toReturnCode(responseName, "EXISTS"));
    final ResponseCode code404 = new ResponseCode(404, toReturnCode(responseName, "DOESNTEXIST"));

    return ImmutableList.of(code200, code404);
}

From source file:com.spectralogic.ds3autogen.java.generators.responseparser.HeadBucketParserGenerator.java

/**
 * Gets the non-error response codes required to generate this response
 */// www .  j a  v  a 2 s . c om
@Override
public ImmutableList<ResponseCode> toResponseCodeList(final ImmutableList<Ds3ResponseCode> ds3ResponseCodes,
        final String responseName, final boolean hasPaginationHeaders) {
    //Verify that the expected status codes are present
    final ImmutableList<Integer> codes = getResponseCodes(ds3ResponseCodes);
    if (!codes.containsAll(EXPECTED_RESPONSE_CODES)) {
        throw new IllegalArgumentException(
                "Does not contain expected response codes: " + EXPECTED_RESPONSE_CODES.toString());
    }

    final ResponseCode code200 = new ResponseCode(200, toReturnCode(responseName, "EXISTS"));
    final ResponseCode code403 = new ResponseCode(403, toReturnCode(responseName, "NOTAUTHORIZED"));
    final ResponseCode code404 = new ResponseCode(404, toReturnCode(responseName, "DOESNTEXIST"));

    return ImmutableList.of(code200, code403, code404);
}

From source file:com.spectralogic.ds3autogen.java.generators.responseparser.GetJobChunksReadyParserGenerator.java

/**
 * Gets the non-error response codes required to generate this response
 *//*from w  w  w .j av a2  s .c  o m*/
@Override
public ImmutableList<ResponseCode> toResponseCodeList(final ImmutableList<Ds3ResponseCode> ds3ResponseCodes,
        final String responseName, final boolean hasPaginationHeaders) {
    //Verify that the expected status codes are present
    final ImmutableList<Integer> codes = getResponseCodes(ds3ResponseCodes);
    if (!codes.containsAll(EXPECTED_RESPONSE_CODES)) {
        throw new IllegalArgumentException(
                "Does not contain expected response codes: " + EXPECTED_RESPONSE_CODES.toString());
    }

    final Ds3ResponseCode ds3ResponseCode = getDs3ResponseCode(ds3ResponseCodes, 200);
    final ResponseCode code200 = new ResponseCode(200, toParsePayloadCode(ds3ResponseCode, responseName));

    return ImmutableList.of(code200);
}

From source file:com.spectralogic.ds3autogen.java.generators.responseparser.GetObjectParserGenerator.java

/**
 * Gets the expected response codes with no java code values since they are
 * only being used to determine the expected response codes within the template
 *//*from  w  ww  . jav  a 2s.co m*/
@Override
public ImmutableList<ResponseCode> toResponseCodeList(final ImmutableList<Ds3ResponseCode> ds3ResponseCodes,
        final String responseName, final boolean hasPaginationHeaders) {
    final ImmutableList<Integer> codes = getResponseCodes(ds3ResponseCodes);
    if (!codes.containsAll(EXPECTED_RESPONSE_CODES)) {
        throw new IllegalArgumentException(
                "Does not contain expected response codes: " + EXPECTED_RESPONSE_CODES.toString());
    }

    final ResponseCode code200 = new ResponseCode(200, "");
    final ResponseCode code206 = new ResponseCode(206, "");

    return ImmutableList.of(code200, code206);
}

From source file:com.spectralogic.ds3autogen.java.generators.responseparser.AllocateJobChunkParserGenerator.java

/**
 * Gets the non-error response codes required to generate this response
 *//*from   ww w  .  j a  v a 2  s .co  m*/
@Override
public ImmutableList<ResponseCode> toResponseCodeList(final ImmutableList<Ds3ResponseCode> ds3ResponseCodes,
        final String responseName, final boolean hasPaginationHeaders) {
    //Verify that the expected status codes are present
    final ImmutableList<Integer> codes = getResponseCodes(ds3ResponseCodes);
    if (!codes.containsAll(EXPECTED_RESPONSE_CODES)) {
        throw new IllegalArgumentException(
                "Does not contain expected response codes: " + EXPECTED_RESPONSE_CODES.toString());
    }

    final ResponseCode code200 = new ResponseCode(200,
            toParsePayloadCode(getDs3ResponseCode(ds3ResponseCodes, 200), responseName));

    // The switch case for 307 should fall through to the 503 handling
    final ResponseCode code307 = new ResponseCode(307, "");

    final ResponseCode code503 = new ResponseCode(503, toRetryLaterCode(responseName));

    return ImmutableList.of(code200, code307, code503);
}