/** * This code was auto-generated by a Codezu. * * Changes to this file may cause incorrect behavior and will be lost if * the code is regenerated. */ package com.mozu.api.resources.commerce.catalog.admin; import com.mozu.api.ApiContext; import java.util.List; import java.util.ArrayList; import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl; import com.mozu.api.Headers; import org.joda.time.DateTime; import com.mozu.api.security.AuthTicket; import org.apache.commons.lang.StringUtils; /** <summary> * The Soft Allocations resource allows you to temporarily hold a product from inventory while a shopper is filling out payment information. You create a product reservation when a shopper proceeds to check out and then release the reservation when the order process is complete. * </summary> */ public class SoftAllocationResource { /// /// <see cref="Mozu.Api.ApiContext"/> /// private ApiContext _apiContext; public SoftAllocationResource(ApiContext apiContext) { _apiContext = apiContext; } /** * Retrieves a list of sof allocations according to any specified filter criteria and sort options. * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * SoftAllocationCollection softAllocationCollection = softallocation.getSoftAllocations(); * </code></pre></p> * @param dataViewMode DataViewMode * @return com.mozu.api.contracts.productadmin.SoftAllocationCollection * @see com.mozu.api.contracts.productadmin.SoftAllocationCollection */ public com.mozu.api.contracts.productadmin.SoftAllocationCollection getSoftAllocations() throws Exception { return getSoftAllocations( null, null, null, null, null); } /** * Retrieves a list of sof allocations according to any specified filter criteria and sort options. * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * SoftAllocationCollection softAllocationCollection = softallocation.getSoftAllocations( startIndex, pageSize, sortBy, filter, responseFields); * </code></pre></p> * @param filter A set of filter expressions representing the search parameters for a query. This parameter is optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for a list of supported filters. * @param pageSize When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with this parameter set to 25, to get the 51st through the 75th items, set startIndex to 50. * @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. * @param sortBy The element to sort the results by and the channel in which the results appear. Either ascending (a-z) or descending (z-a) channel. Optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for more information. * @param startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with pageSize set to 25, to get the 51st through the 75th items, set this parameter to 50. * @param dataViewMode DataViewMode * @return com.mozu.api.contracts.productadmin.SoftAllocationCollection * @see com.mozu.api.contracts.productadmin.SoftAllocationCollection */ public com.mozu.api.contracts.productadmin.SoftAllocationCollection getSoftAllocations(Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields) throws Exception { MozuClient<com.mozu.api.contracts.productadmin.SoftAllocationCollection> client = com.mozu.api.clients.commerce.catalog.admin.SoftAllocationClient.getSoftAllocationsClient( startIndex, pageSize, sortBy, filter, responseFields); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Retrieves the details of a soft allocation. * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * SoftAllocation softAllocation = softallocation.getSoftAllocation( softAllocationId); * </code></pre></p> * @param softAllocationId The unique identifier of the soft allocation. * @param dataViewMode DataViewMode * @return com.mozu.api.contracts.productadmin.SoftAllocation * @see com.mozu.api.contracts.productadmin.SoftAllocation */ public com.mozu.api.contracts.productadmin.SoftAllocation getSoftAllocation(Integer softAllocationId) throws Exception { return getSoftAllocation( softAllocationId, null); } /** * Retrieves the details of a soft allocation. * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * SoftAllocation softAllocation = softallocation.getSoftAllocation( softAllocationId, responseFields); * </code></pre></p> * @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. * @param softAllocationId The unique identifier of the soft allocation. * @param dataViewMode DataViewMode * @return com.mozu.api.contracts.productadmin.SoftAllocation * @see com.mozu.api.contracts.productadmin.SoftAllocation */ public com.mozu.api.contracts.productadmin.SoftAllocation getSoftAllocation(Integer softAllocationId, String responseFields) throws Exception { MozuClient<com.mozu.api.contracts.productadmin.SoftAllocation> client = com.mozu.api.clients.commerce.catalog.admin.SoftAllocationClient.getSoftAllocationClient( softAllocationId, responseFields); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Creates a new soft allocation for a product. This places a hold on the product inventory for the quantity specified during the ordering process. * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * SoftAllocation softAllocation = softallocation.addSoftAllocations( softAllocationsIn); * </code></pre></p> * @param dataViewMode DataViewMode * @param softAllocationsIn The details of the new soft allocation. * @return List<com.mozu.api.contracts.productadmin.SoftAllocation> * @see com.mozu.api.contracts.productadmin.SoftAllocation * @see com.mozu.api.contracts.productadmin.SoftAllocation */ public List<com.mozu.api.contracts.productadmin.SoftAllocation> addSoftAllocations(List<com.mozu.api.contracts.productadmin.SoftAllocation> softAllocationsIn) throws Exception { MozuClient<List<com.mozu.api.contracts.productadmin.SoftAllocation>> client = com.mozu.api.clients.commerce.catalog.admin.SoftAllocationClient.addSoftAllocationsClient( softAllocationsIn); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Converts a set of existing soft product allocations into product reservations. * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * ProductReservation productReservation = softallocation.convertToProductReservation( softAllocations); * </code></pre></p> * @param dataViewMode DataViewMode * @param softAllocations The details of the soft allocation which you want to convert into product reservations. * @return List<com.mozu.api.contracts.productadmin.ProductReservation> * @see com.mozu.api.contracts.productadmin.ProductReservation * @see com.mozu.api.contracts.productadmin.SoftAllocation */ public List<com.mozu.api.contracts.productadmin.ProductReservation> convertToProductReservation(List<com.mozu.api.contracts.productadmin.SoftAllocation> softAllocations) throws Exception { MozuClient<List<com.mozu.api.contracts.productadmin.ProductReservation>> client = com.mozu.api.clients.commerce.catalog.admin.SoftAllocationClient.convertToProductReservationClient( softAllocations); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Updates the expiration time for a set of soft allocations in a non-transactional batch. * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * SoftAllocation softAllocation = softallocation.renewSoftAllocations( softAllocationRenew); * </code></pre></p> * @param dataViewMode DataViewMode * @param softAllocationRenew The details of the soft allocation that you want to renew. * @return List<com.mozu.api.contracts.productadmin.SoftAllocation> * @see com.mozu.api.contracts.productadmin.SoftAllocation * @see com.mozu.api.contracts.productadmin.SoftAllocationRenew */ public List<com.mozu.api.contracts.productadmin.SoftAllocation> renewSoftAllocations(com.mozu.api.contracts.productadmin.SoftAllocationRenew softAllocationRenew) throws Exception { MozuClient<List<com.mozu.api.contracts.productadmin.SoftAllocation>> client = com.mozu.api.clients.commerce.catalog.admin.SoftAllocationClient.renewSoftAllocationsClient( softAllocationRenew); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Updates a soft allocation. This updates a hold on the product inventory for the quantity specified during the ordering process. * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * SoftAllocation softAllocation = softallocation.updateSoftAllocations( softAllocations); * </code></pre></p> * @param dataViewMode DataViewMode * @param softAllocations The details of the updated soft allocations. * @return List<com.mozu.api.contracts.productadmin.SoftAllocation> * @see com.mozu.api.contracts.productadmin.SoftAllocation * @see com.mozu.api.contracts.productadmin.SoftAllocation */ public List<com.mozu.api.contracts.productadmin.SoftAllocation> updateSoftAllocations(List<com.mozu.api.contracts.productadmin.SoftAllocation> softAllocations) throws Exception { MozuClient<List<com.mozu.api.contracts.productadmin.SoftAllocation>> client = com.mozu.api.clients.commerce.catalog.admin.SoftAllocationClient.updateSoftAllocationsClient( softAllocations); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Deletes a soft allocation. You might delete a soft allocation when an order or cart is not processed in order to return the product quantity back to inventory. * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * softallocation.deleteSoftAllocation( softAllocationId); * </code></pre></p> * @param softAllocationId The unique identifier of the soft allocation. * @param dataViewMode DataViewMode * @return */ public void deleteSoftAllocation(Integer softAllocationId) throws Exception { MozuClient client = com.mozu.api.clients.commerce.catalog.admin.SoftAllocationClient.deleteSoftAllocationClient( softAllocationId); client.setContext(_apiContext); client.executeRequest(); client.cleanupHttpConnection(); } }