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

com.dottydingo.hyperion.client.builder.CreateCollectionRequestBuilder Maven / Gradle / Ivy

The newest version!
package com.dottydingo.hyperion.client.builder;

import com.dottydingo.hyperion.api.ApiObject;
import com.dottydingo.hyperion.api.EntityList;
import com.dottydingo.hyperion.client.HeaderFactory;
import com.dottydingo.hyperion.client.HyperionClient;
import com.dottydingo.hyperion.client.ParameterFactory;

import java.io.Serializable;
import java.util.List;

/**
 * A request builder for creating multiple items
 */
public class CreateCollectionRequestBuilder,ID extends Serializable>  extends CreateRequestBuilder
{
    /**
     * Create the request builder using the specified parameters
     * @param version The entity version
     * @param objectType The API type
     * @param entityName The entity name
     * @param entries The entries to create
     */
    public CreateCollectionRequestBuilder(int version, Class objectType, String entityName, List entries)
    {
        super(version, objectType, entityName, entries);
    }

    @Override
    public CreateCollectionRequestBuilder returnFields(String... fields)
    {
        super.returnFields(fields);
        return this;
    }

    @Override
    public CreateCollectionRequestBuilder addParameter(String name, String value)
    {
        super.addParameter(name, value);
        return this;
    }

    @Override
    public CreateCollectionRequestBuilder setParameter(String name, String value)
    {
        super.setParameter(name, value);
        return this;
    }

    @Override
    public CreateCollectionRequestBuilder addHeader(String name, String value)
    {
        super.addHeader(name, value);
        return this;
    }

    @Override
    public CreateCollectionRequestBuilder setHeader(String name, String value)
    {
        super.setHeader(name, value);
        return this;
    }

    @Override
    public CreateCollectionRequestBuilder withHeaderFactory(HeaderFactory headerFactory)
    {
        super.withHeaderFactory(headerFactory);
        return this;
    }

    @Override
    public CreateCollectionRequestBuilder withParameterFactory(ParameterFactory parameterFactory)
    {
        super.withParameterFactory(parameterFactory);
        return this;
    }

    /**
     * Execute the request using the supplied client
     * @param client the client
     * @return The request
     */
    public List execute(HyperionClient client)
    {
        EntityList response = client.create(build());
        return response.getEntries();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy