/** * 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.AsyncCallback; import java.util.concurrent.CountDownLatch; import com.mozu.api.security.AuthTicket; import org.apache.commons.lang.StringUtils; /** <summary> * 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(); * CountDownLatch latch = softallocation.getSoftAllocations( callback ); * latch.await() * </code></pre></p> * @param callback callback handler for asynchronous operations * @param dataViewMode DataViewMode * @return com.mozu.api.contracts.productadmin.SoftAllocationCollection * @see com.mozu.api.contracts.productadmin.SoftAllocationCollection */ public CountDownLatch getSoftAllocationsAsync( AsyncCallback<com.mozu.api.contracts.productadmin.SoftAllocationCollection> callback) throws Exception { return getSoftAllocationsAsync( null, null, null, null, null, callback); } /** * 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/applications/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/applications/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 a list of sof allocations according to any specified filter criteria and sort options. * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * CountDownLatch latch = softallocation.getSoftAllocations( startIndex, pageSize, sortBy, filter, responseFields, callback ); * latch.await() * </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/applications/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/applications/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 callback callback handler for asynchronous operations * @param dataViewMode DataViewMode * @return com.mozu.api.contracts.productadmin.SoftAllocationCollection * @see com.mozu.api.contracts.productadmin.SoftAllocationCollection */ public CountDownLatch getSoftAllocationsAsync(Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields, AsyncCallback<com.mozu.api.contracts.productadmin.SoftAllocationCollection> callback) 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); return client.executeRequest(callback); } /** * 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(); * CountDownLatch latch = softallocation.getSoftAllocation( softAllocationId, callback ); * latch.await() * </code></pre></p> * @param softAllocationId The unique identifier of the soft allocation. * @param callback callback handler for asynchronous operations * @param dataViewMode DataViewMode * @return com.mozu.api.contracts.productadmin.SoftAllocation * @see com.mozu.api.contracts.productadmin.SoftAllocation */ public CountDownLatch getSoftAllocationAsync(Integer softAllocationId, AsyncCallback<com.mozu.api.contracts.productadmin.SoftAllocation> callback) throws Exception { return getSoftAllocationAsync( softAllocationId, null, callback); } /** * 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(); } /** * Retrieves the details of a soft allocation. * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * CountDownLatch latch = softallocation.getSoftAllocation( softAllocationId, responseFields, callback ); * latch.await() * </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 callback callback handler for asynchronous operations * @param dataViewMode DataViewMode * @return com.mozu.api.contracts.productadmin.SoftAllocation * @see com.mozu.api.contracts.productadmin.SoftAllocation */ public CountDownLatch getSoftAllocationAsync(Integer softAllocationId, String responseFields, AsyncCallback<com.mozu.api.contracts.productadmin.SoftAllocation> callback) throws Exception { MozuClient<com.mozu.api.contracts.productadmin.SoftAllocation> client = com.mozu.api.clients.commerce.catalog.admin.SoftAllocationClient.getSoftAllocationClient( softAllocationId, responseFields); client.setContext(_apiContext); return client.executeRequest(callback); } /** * Creates a new product reservation 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 Mozu.ProductAdmin.Contracts.SoftAllocation ApiType DOCUMENT_HERE * @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(); } /** * Creates a new product reservation 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(); * CountDownLatch latch = softallocation.addSoftAllocations( softAllocationsIn, callback ); * latch.await() * </code></pre></p> * @param callback callback handler for asynchronous operations * @param dataViewMode DataViewMode * @param softAllocationsIn Mozu.ProductAdmin.Contracts.SoftAllocation ApiType DOCUMENT_HERE * @return List<com.mozu.api.contracts.productadmin.SoftAllocation> * @see com.mozu.api.contracts.productadmin.SoftAllocation * @see com.mozu.api.contracts.productadmin.SoftAllocation */ public CountDownLatch addSoftAllocationsAsync(List<com.mozu.api.contracts.productadmin.SoftAllocation> softAllocationsIn, AsyncCallback<List<com.mozu.api.contracts.productadmin.SoftAllocation>> callback) throws Exception { MozuClient<List<com.mozu.api.contracts.productadmin.SoftAllocation>> client = com.mozu.api.clients.commerce.catalog.admin.SoftAllocationClient.addSoftAllocationsClient( softAllocationsIn); client.setContext(_apiContext); return client.executeRequest(callback); } /** * Converts a set of existing softAllocations into productReservations * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * ProductReservation productReservation = softallocation.convertToProductReservation( softAllocations); * </code></pre></p> * @param dataViewMode DataViewMode * @param softAllocations Mozu.ProductAdmin.Contracts.SoftAllocation ApiType DOCUMENT_HERE * @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(); } /** * Converts a set of existing softAllocations into productReservations * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * CountDownLatch latch = softallocation.convertToProductReservation( softAllocations, callback ); * latch.await() * </code></pre></p> * @param callback callback handler for asynchronous operations * @param dataViewMode DataViewMode * @param softAllocations Mozu.ProductAdmin.Contracts.SoftAllocation ApiType DOCUMENT_HERE * @return List<com.mozu.api.contracts.productadmin.ProductReservation> * @see com.mozu.api.contracts.productadmin.ProductReservation * @see com.mozu.api.contracts.productadmin.SoftAllocation */ public CountDownLatch convertToProductReservationAsync(List<com.mozu.api.contracts.productadmin.SoftAllocation> softAllocations, AsyncCallback<List<com.mozu.api.contracts.productadmin.ProductReservation>> callback) throws Exception { MozuClient<List<com.mozu.api.contracts.productadmin.ProductReservation>> client = com.mozu.api.clients.commerce.catalog.admin.SoftAllocationClient.convertToProductReservationClient( softAllocations); client.setContext(_apiContext); return client.executeRequest(callback); } /** * Updates a set of softAllocations expiration time in a non trassactional batch * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * SoftAllocation softAllocation = softallocation.renewSoftAllocations( softAllocationRenew); * </code></pre></p> * @param dataViewMode DataViewMode * @param softAllocationRenew Mozu.ProductAdmin.Contracts.SoftAllocationRenew ApiType DOCUMENT_HERE * @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 set of softAllocations expiration time in a non trassactional batch * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * CountDownLatch latch = softallocation.renewSoftAllocations( softAllocationRenew, callback ); * latch.await() * </code></pre></p> * @param callback callback handler for asynchronous operations * @param dataViewMode DataViewMode * @param softAllocationRenew Mozu.ProductAdmin.Contracts.SoftAllocationRenew ApiType DOCUMENT_HERE * @return List<com.mozu.api.contracts.productadmin.SoftAllocation> * @see com.mozu.api.contracts.productadmin.SoftAllocation * @see com.mozu.api.contracts.productadmin.SoftAllocationRenew */ public CountDownLatch renewSoftAllocationsAsync(com.mozu.api.contracts.productadmin.SoftAllocationRenew softAllocationRenew, AsyncCallback<List<com.mozu.api.contracts.productadmin.SoftAllocation>> callback) throws Exception { MozuClient<List<com.mozu.api.contracts.productadmin.SoftAllocation>> client = com.mozu.api.clients.commerce.catalog.admin.SoftAllocationClient.renewSoftAllocationsClient( softAllocationRenew); client.setContext(_apiContext); return client.executeRequest(callback); } /** * Updates a soft allocationt. 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 Mozu.ProductAdmin.Contracts.SoftAllocation ApiType DOCUMENT_HERE * @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(); } /** * Updates a soft allocationt. This updates a hold on the product inventory for the quantity specified during the ordering process. * <p><pre><code> * SoftAllocation softallocation = new SoftAllocation(); * CountDownLatch latch = softallocation.updateSoftAllocations( softAllocations, callback ); * latch.await() * </code></pre></p> * @param callback callback handler for asynchronous operations * @param dataViewMode DataViewMode * @param softAllocations Mozu.ProductAdmin.Contracts.SoftAllocation ApiType DOCUMENT_HERE * @return List<com.mozu.api.contracts.productadmin.SoftAllocation> * @see com.mozu.api.contracts.productadmin.SoftAllocation * @see com.mozu.api.contracts.productadmin.SoftAllocation */ public CountDownLatch updateSoftAllocationsAsync(List<com.mozu.api.contracts.productadmin.SoftAllocation> softAllocations, AsyncCallback<List<com.mozu.api.contracts.productadmin.SoftAllocation>> callback) throws Exception { MozuClient<List<com.mozu.api.contracts.productadmin.SoftAllocation>> client = com.mozu.api.clients.commerce.catalog.admin.SoftAllocationClient.updateSoftAllocationsClient( softAllocations); client.setContext(_apiContext); return client.executeRequest(callback); } /** * Deletes a soft allocation. You might delete a allocation when an order or cart is not processed 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(); } }