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

com.mastercard.api.directoryservices.Mapping Maven / Gradle / Ivy

/*
 * Copyright 2016 MasterCard International.
 *
 * Redistribution and use in source and binary forms, with or without modification, are 
 * permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list of 
 * conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * Neither the name of the MasterCard International Incorporated nor the names of its 
 * contributors may be used to endorse or promote products derived from this software 
 * without specific prior written permission.
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
 * SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
 * SUCH DAMAGE.
 *
 */

package com.mastercard.api.directoryservices;

import com.mastercard.api.core.exception.*;
import com.mastercard.api.core.model.*;
import com.mastercard.api.core.security.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Mapping extends BaseObject  {

    private static Map operationConfigs;

    static {
        operationConfigs = new HashMap();
        operationConfigs.put("80df297d-555c-4679-9555-1e25d29f45bc", new OperationConfig("/send/#env/v1/partners/{partnerId}/mappings", Action.create, Arrays.asList(""), Arrays.asList("x-oaep-hashing-algorithm","x-encrypted-key","x-public-key-fingerprint","x-iv")));
        operationConfigs.put("b2aa6e91-1b2c-4dbd-92ad-c4b90269eb28", new OperationConfig("/send/#env/v1/partners/{partnerId}/mappings/{mappingId}", Action.delete, Arrays.asList(""), Arrays.asList("")));
        operationConfigs.put("697701da-a952-4ee2-a222-6ca9dde6f97c", new OperationConfig("/send/#env/v1/partners/{partnerId}/mappings/{mappingId}", Action.read, Arrays.asList(""), Arrays.asList("")));
        operationConfigs.put("3185db18-5078-4fa3-b12c-d609b5510985", new OperationConfig("/send/#env/v1/partners/{partnerId}/mappings", Action.query, Arrays.asList("ref","customer_identifier"), Arrays.asList("")));
        operationConfigs.put("6e31f654-1bbf-4bdc-9f57-bd31ae50c7b5", new OperationConfig("/send/#env/v1/partners/{partnerId}/mappings/{mappingId}", Action.update, Arrays.asList(""), Arrays.asList("x-oaep-hashing-algorithm","x-encrypted-key","x-public-key-fingerprint","x-iv")));
    }

    public Mapping() {
    }

    public Mapping(BaseObject o) {
        putAll(o);
    }

    public Mapping(RequestMap requestMap) {
        putAll(requestMap);
    }

    @Override protected final OperationConfig getOperationConfig(String operationUUID) throws IllegalArgumentException{
        OperationConfig operationConfig = operationConfigs.get(operationUUID);

        if(operationConfig == null) {
            throw new IllegalArgumentException("Invalid operationUUID supplied: " + operationUUID);
        }

        return operationConfig;
    }

    @Override protected OperationMetadata getOperationMetadata() throws IllegalArgumentException {
        return new OperationMetadata(ResourceConfig.getInstance().getVersion(), ResourceConfig.getInstance().getHost(), ResourceConfig.getInstance().getContext(), ResourceConfig.getInstance().getJsonNative(), ResourceConfig.getInstance().getContentTypeOverride());
    }

  /**
   * Creates a Mapping object
   *
   * @param map a map of parameters to create a Mapping object
   *
   * @return a Mapping object.
   *
   * @throws ApiException - which encapsulates the http status code and the error return by the server
   */
  public static Mapping createMapping(RequestMap map)
    throws ApiException {

    return createMapping(null, map);
  }

  /**
   * Creates a Mapping object
   *
   * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
   * @param map a map of parameters to create a Mapping object
   *
   * @return a Mapping object.
   *
   * @throws ApiException - which encapsulates the http status code and the error return by the server
   */
  public static Mapping createMapping(Authentication auth, RequestMap map)
    throws ApiException {

    return new Mapping(BaseObject.executeOperation(auth, "80df297d-555c-4679-9555-1e25d29f45bc", new Mapping(map)));
  }









    /**
     * Deletes a Mapping object.
     *
     * @return a Mapping object.
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public Mapping deleteMapping()
        throws ApiException {

        BaseObject object = BaseObject.executeOperation(null, "b2aa6e91-1b2c-4dbd-92ad-c4b90269eb28", this);
        this.clear();
        this.putAll(object);
        return this;
    }

    /**
     * Deletes a Mapping object.
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     *
     * @return a Mapping object.
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public Mapping deleteMapping(Authentication auth)
        throws ApiException {

        BaseObject object = BaseObject.executeOperation(auth, "b2aa6e91-1b2c-4dbd-92ad-c4b90269eb28", this);
        this.clear();
        this.putAll(object);
        return this;
    }

    /**
     * Deletes a Mapping object.
     *
     * @param id the id of the object to delete
     *
     * @return a Mapping object.
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Mapping deleteMapping(String id)
        throws ApiException {

        return deleteMapping(null, id);
    }

    /**
     * Deletes a Mapping object
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     * @param id  the id of the object to delete
     *
     * @return a Mapping object.
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Mapping deleteMapping(Authentication auth, String id)
        throws ApiException {

        Mapping object = new Mapping(new RequestMap("id", id));
        return object.deleteMapping(auth);
    }

    /**
     * Deletes a Mapping object
     *
     * @param id the id of the object to delete
     * @param map a map of additional parameters
     *
     * @return a Mapping object.
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Mapping deleteMapping(String id, RequestMap map)
        throws ApiException {

        return deleteMapping(null, id, map);
    }

    /**
     * Deletes a Mapping object
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     * @param id  the id of the object to delete
     * @param map a map of additional parameters
     *
     * @return a Mapping object.
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Mapping deleteMapping(Authentication auth, String id, RequestMap map)
        throws ApiException {

        Mapping object = new Mapping(new RequestMap("id", id));
        if (map != null)  object.putAll(map);
        return object.deleteMapping(auth);
    }







    /**
     * Retrieve a Mapping object
     *
     * @param id the id of the Mapping object to retrieve
     *
     * @return a Mapping object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Mapping readByMappingId(String id)
        throws ApiException {

        return readByMappingId(null, id, null);
    }

    /**
     * Retrieve a Mapping object
     *
     * @param id the id of the Mapping object to retrieve
     * @param map a map of additional parameters
     *
     * @return a Mapping object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Mapping readByMappingId(String id, RequestMap map)
        throws ApiException {

        return readByMappingId(null, id, map);
    }

    /**
     * Retrieve a Mapping object
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     * @param id the id of the Mapping object to retrieve
     *
     * @return a Mapping object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Mapping readByMappingId(Authentication auth, String id)
        throws ApiException {

        return readByMappingId(auth, id, null);
    }

    /**
     * Retrieve a Mapping object
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     * @param id the id of the Mapping object to retrieve
     * @param map a map of additional parameters
     *
     * @return a Mapping object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Mapping readByMappingId(Authentication auth, String id, RequestMap map)
        throws ApiException {

        Mapping val = new Mapping();
        if (id != null) val.put("id", id);
        if (map != null)  val.putAll(map);
        return new Mapping(BaseObject.executeOperation(auth, "697701da-a952-4ee2-a222-6ca9dde6f97c", val));
    }






    /**
     * Query / Retrieve a Mapping object
     *
     * @param query a map of query parameters
     *
     * @return a Mapping object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Mapping listByReferenceOrCustomerIdentifier(RequestMap query)
        throws ApiException {

        return listByReferenceOrCustomerIdentifier(null, query);
    }

    /**
     * Query / Retrieve a Mapping object
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     * @param query a map of query parameters
     *
     * @return a Mapping object
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public static Mapping listByReferenceOrCustomerIdentifier(Authentication auth, RequestMap query)
        throws ApiException {

        Mapping val = new Mapping();
        if (query != null)  val.putAll(query);
        return new Mapping(BaseObject.executeOperation(auth, "3185db18-5078-4fa3-b12c-d609b5510985", val));
    }

    /**
     * Update a Mapping object.
     *
     * @return a Mapping object.
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public Mapping updateMapping()
        throws ApiException {

        BaseObject object = BaseObject.executeOperation(null, "6e31f654-1bbf-4bdc-9f57-bd31ae50c7b5", this);
        this.putAll(object);
        return this;
    }

    /**
     * Update a Mapping object.
     *
     * @param auth Authentication object overriding ApiConfig.setAuthentication(authentication)
     *
     * @return a Mapping object.
     *
     * @throws ApiException - which encapsulates the http status code and the error return by the server
     */
    public Mapping updateMapping(Authentication auth)
        throws ApiException {

        BaseObject object = BaseObject.executeOperation(auth, "6e31f654-1bbf-4bdc-9f57-bd31ae50c7b5", this);
        this.putAll(object);
        return this;
    }




}






© 2015 - 2025 Weber Informatics LLC | Privacy Policy