/** * 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.products; 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; import com.mozu.api.DataViewMode; /** <summary> * Use the Properties resource to configure a property attribute for an individual product associated with a product type that uses the property attribute, as well as set property values for the product. * </summary> */ public class ProductPropertyResource { /// /// <see cref="Mozu.Api.ApiContext"/> /// private ApiContext _apiContext; private DataViewMode _dataViewMode; public ProductPropertyResource(ApiContext apiContext) { _apiContext = apiContext; _dataViewMode = DataViewMode.Live; } public ProductPropertyResource(ApiContext apiContext, DataViewMode dataViewMode) { _apiContext = apiContext; _dataViewMode = dataViewMode; } /** * Retrieves a list of the property attributes configured for the product specified in the request. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductProperty productProperty = productproperty.getProperties( productCode); * </code></pre></p> * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @return List<com.mozu.api.contracts.productadmin.ProductProperty> * @see com.mozu.api.contracts.productadmin.ProductProperty */ public List<com.mozu.api.contracts.productadmin.ProductProperty> getProperties(String productCode) throws Exception { MozuClient<List<com.mozu.api.contracts.productadmin.ProductProperty>> client = com.mozu.api.clients.commerce.catalog.admin.products.ProductPropertyClient.getPropertiesClient(_dataViewMode, productCode); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Retrieves a collection of property values for localized content. This content is set by the locale code. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductPropertyValueLocalizedContent productPropertyValueLocalizedContent = productproperty.getPropertyValueLocalizedContents( productCode, attributeFQN, value); * </code></pre></p> * @param attributeFQN Fully qualified name for an attribute. * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @param value The value string to create. * @return List<com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent> * @see com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent */ public List<com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent> getPropertyValueLocalizedContents(String productCode, String attributeFQN, String value) throws Exception { MozuClient<List<com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent>> client = com.mozu.api.clients.commerce.catalog.admin.products.ProductPropertyClient.getPropertyValueLocalizedContentsClient(_dataViewMode, productCode, attributeFQN, value); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Retrieves the property value for localized content. This content is set by the locale code. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductPropertyValueLocalizedContent productPropertyValueLocalizedContent = productproperty.getPropertyValueLocalizedContent( productCode, attributeFQN, value, localeCode); * </code></pre></p> * @param attributeFQN Fully qualified name for an attribute. * @param localeCode Language used for the entity. Currently, only "en-US" is supported. * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @param value The value string to create. * @return com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent * @see com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent */ public com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent getPropertyValueLocalizedContent(String productCode, String attributeFQN, String value, String localeCode) throws Exception { return getPropertyValueLocalizedContent( productCode, attributeFQN, value, localeCode, null); } /** * Retrieves the property value for localized content. This content is set by the locale code. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductPropertyValueLocalizedContent productPropertyValueLocalizedContent = productproperty.getPropertyValueLocalizedContent( productCode, attributeFQN, value, localeCode, responseFields); * </code></pre></p> * @param attributeFQN Fully qualified name for an attribute. * @param localeCode Language used for the entity. Currently, only "en-US" is supported. * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @param responseFields Use this field to include those fields which are not included by default. * @param value The value string to create. * @return com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent * @see com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent */ public com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent getPropertyValueLocalizedContent(String productCode, String attributeFQN, String value, String localeCode, String responseFields) throws Exception { MozuClient<com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent> client = com.mozu.api.clients.commerce.catalog.admin.products.ProductPropertyClient.getPropertyValueLocalizedContentClient(_dataViewMode, productCode, attributeFQN, value, localeCode, responseFields); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Retrieves the details of a property attribute configuration for the product specified in the request. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductProperty productProperty = productproperty.getProperty( productCode, attributeFQN); * </code></pre></p> * @param attributeFQN The fully qualified name of the attribute, which is a user defined attribute identifier. * @param productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only. * @return com.mozu.api.contracts.productadmin.ProductProperty * @see com.mozu.api.contracts.productadmin.ProductProperty */ public com.mozu.api.contracts.productadmin.ProductProperty getProperty(String productCode, String attributeFQN) throws Exception { return getProperty( productCode, attributeFQN, null); } /** * Retrieves the details of a property attribute configuration for the product specified in the request. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductProperty productProperty = productproperty.getProperty( productCode, attributeFQN, responseFields); * </code></pre></p> * @param attributeFQN The fully qualified name of the attribute, which is a user defined attribute identifier. * @param productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only. * @param responseFields Use this field to include those fields which are not included by default. * @return com.mozu.api.contracts.productadmin.ProductProperty * @see com.mozu.api.contracts.productadmin.ProductProperty */ public com.mozu.api.contracts.productadmin.ProductProperty getProperty(String productCode, String attributeFQN, String responseFields) throws Exception { MozuClient<com.mozu.api.contracts.productadmin.ProductProperty> client = com.mozu.api.clients.commerce.catalog.admin.products.ProductPropertyClient.getPropertyClient(_dataViewMode, productCode, attributeFQN, responseFields); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Adds a property value for localized content. This content is set by the locale code. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductPropertyValueLocalizedContent productPropertyValueLocalizedContent = productproperty.addPropertyValueLocalizedContent( localizedContent, productCode, attributeFQN, value); * </code></pre></p> * @param attributeFQN Fully qualified name for an attribute. * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @param value The value string to create. * @param localizedContent Use this field to include those fields which are not included by default. * @return com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent * @see com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent * @see com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent */ public com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent addPropertyValueLocalizedContent(com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent localizedContent, String productCode, String attributeFQN, String value) throws Exception { return addPropertyValueLocalizedContent( localizedContent, productCode, attributeFQN, value, null); } /** * Adds a property value for localized content. This content is set by the locale code. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductPropertyValueLocalizedContent productPropertyValueLocalizedContent = productproperty.addPropertyValueLocalizedContent( localizedContent, productCode, attributeFQN, value, responseFields); * </code></pre></p> * @param attributeFQN Fully qualified name for an attribute. * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @param responseFields Use this field to include those fields which are not included by default. * @param value The value string to create. * @param localizedContent Use this field to include those fields which are not included by default. * @return com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent * @see com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent * @see com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent */ public com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent addPropertyValueLocalizedContent(com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent localizedContent, String productCode, String attributeFQN, String value, String responseFields) throws Exception { MozuClient<com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent> client = com.mozu.api.clients.commerce.catalog.admin.products.ProductPropertyClient.addPropertyValueLocalizedContentClient(_dataViewMode, localizedContent, productCode, attributeFQN, value, responseFields); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Configures a property attribute for the product specified in the request. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductProperty productProperty = productproperty.addProperty( productProperty, productCode); * </code></pre></p> * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @param productProperty Details of a property defined for a product. * @return com.mozu.api.contracts.productadmin.ProductProperty * @see com.mozu.api.contracts.productadmin.ProductProperty * @see com.mozu.api.contracts.productadmin.ProductProperty */ public com.mozu.api.contracts.productadmin.ProductProperty addProperty(com.mozu.api.contracts.productadmin.ProductProperty productProperty, String productCode) throws Exception { return addProperty( productProperty, productCode, null); } /** * Configures a property attribute for the product specified in the request. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductProperty productProperty = productproperty.addProperty( productProperty, productCode, responseFields); * </code></pre></p> * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @param responseFields Use this field to include those fields which are not included by default. * @param productProperty Details of a property defined for a product. * @return com.mozu.api.contracts.productadmin.ProductProperty * @see com.mozu.api.contracts.productadmin.ProductProperty * @see com.mozu.api.contracts.productadmin.ProductProperty */ public com.mozu.api.contracts.productadmin.ProductProperty addProperty(com.mozu.api.contracts.productadmin.ProductProperty productProperty, String productCode, String responseFields) throws Exception { MozuClient<com.mozu.api.contracts.productadmin.ProductProperty> client = com.mozu.api.clients.commerce.catalog.admin.products.ProductPropertyClient.addPropertyClient(_dataViewMode, productProperty, productCode, responseFields); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Updates all property values for localized content. This content is set by the locale code. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductPropertyValueLocalizedContent productPropertyValueLocalizedContent = productproperty.updatePropertyValueLocalizedContents( localizedContent, productCode, attributeFQN, value); * </code></pre></p> * @param attributeFQN Fully qualified name for an attribute. * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @param value The value string to create. * @param localizedContent Content of the product property value in the language defined for the locale code. * @return List<com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent> * @see com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent * @see com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent */ public List<com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent> updatePropertyValueLocalizedContents(List<com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent> localizedContent, String productCode, String attributeFQN, String value) throws Exception { MozuClient<List<com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent>> client = com.mozu.api.clients.commerce.catalog.admin.products.ProductPropertyClient.updatePropertyValueLocalizedContentsClient(_dataViewMode, localizedContent, productCode, attributeFQN, value); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Updates the property value for localized content. This content is set by the locale code. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductPropertyValueLocalizedContent productPropertyValueLocalizedContent = productproperty.updatePropertyValueLocalizedContent( localizedContent, productCode, attributeFQN, value, localeCode); * </code></pre></p> * @param attributeFQN Fully qualified name for an attribute. * @param localeCode Language used for the entity. Currently, only "en-US" is supported. * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @param value The value string to create. * @param localizedContent Content of the product property value in the language defined for the locale code. * @return com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent * @see com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent * @see com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent */ public com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent updatePropertyValueLocalizedContent(com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent localizedContent, String productCode, String attributeFQN, String value, String localeCode) throws Exception { return updatePropertyValueLocalizedContent( localizedContent, productCode, attributeFQN, value, localeCode, null); } /** * Updates the property value for localized content. This content is set by the locale code. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductPropertyValueLocalizedContent productPropertyValueLocalizedContent = productproperty.updatePropertyValueLocalizedContent( localizedContent, productCode, attributeFQN, value, localeCode, responseFields); * </code></pre></p> * @param attributeFQN Fully qualified name for an attribute. * @param localeCode Language used for the entity. Currently, only "en-US" is supported. * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @param responseFields Use this field to include those fields which are not included by default. * @param value The value string to create. * @param localizedContent Content of the product property value in the language defined for the locale code. * @return com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent * @see com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent * @see com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent */ public com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent updatePropertyValueLocalizedContent(com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent localizedContent, String productCode, String attributeFQN, String value, String localeCode, String responseFields) throws Exception { MozuClient<com.mozu.api.contracts.productadmin.ProductPropertyValueLocalizedContent> client = com.mozu.api.clients.commerce.catalog.admin.products.ProductPropertyClient.updatePropertyValueLocalizedContentClient(_dataViewMode, localizedContent, productCode, attributeFQN, value, localeCode, responseFields); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Update one or more details of a property attribute configuration for the product specified in the request. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductProperty productProperty = productproperty.updateProperty( productProperty, productCode, attributeFQN); * </code></pre></p> * @param attributeFQN The fully qualified name of the attribute, which is a user defined attribute identifier. * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @param productProperty Details of a property defined for a product. * @return com.mozu.api.contracts.productadmin.ProductProperty * @see com.mozu.api.contracts.productadmin.ProductProperty * @see com.mozu.api.contracts.productadmin.ProductProperty */ public com.mozu.api.contracts.productadmin.ProductProperty updateProperty(com.mozu.api.contracts.productadmin.ProductProperty productProperty, String productCode, String attributeFQN) throws Exception { return updateProperty( productProperty, productCode, attributeFQN, null); } /** * Update one or more details of a property attribute configuration for the product specified in the request. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * ProductProperty productProperty = productproperty.updateProperty( productProperty, productCode, attributeFQN, responseFields); * </code></pre></p> * @param attributeFQN The fully qualified name of the attribute, which is a user defined attribute identifier. * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @param responseFields Use this field to include those fields which are not included by default. * @param productProperty Details of a property defined for a product. * @return com.mozu.api.contracts.productadmin.ProductProperty * @see com.mozu.api.contracts.productadmin.ProductProperty * @see com.mozu.api.contracts.productadmin.ProductProperty */ public com.mozu.api.contracts.productadmin.ProductProperty updateProperty(com.mozu.api.contracts.productadmin.ProductProperty productProperty, String productCode, String attributeFQN, String responseFields) throws Exception { MozuClient<com.mozu.api.contracts.productadmin.ProductProperty> client = com.mozu.api.clients.commerce.catalog.admin.products.ProductPropertyClient.updatePropertyClient(_dataViewMode, productProperty, productCode, attributeFQN, responseFields); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } /** * Deletes the configuration of a property attribute for the product specified in the request. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * productproperty.deleteProperty( productCode, attributeFQN); * </code></pre></p> * @param attributeFQN The fully qualified name of the attribute, which is a user defined attribute identifier. * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @return */ public void deleteProperty(String productCode, String attributeFQN) throws Exception { MozuClient client = com.mozu.api.clients.commerce.catalog.admin.products.ProductPropertyClient.deletePropertyClient(_dataViewMode, productCode, attributeFQN); client.setContext(_apiContext); client.executeRequest(); client.cleanupHttpConnection(); } /** * Deletes the property value for localized content. This content is set by the locale code. * <p><pre><code> * ProductProperty productproperty = new ProductProperty(); * productproperty.deletePropertyValueLocalizedContent( productCode, attributeFQN, value, localeCode); * </code></pre></p> * @param attributeFQN Fully qualified name for an attribute. * @param localeCode Language used for the entity. Currently, only "en-US" is supported. * @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. * @param value The value string to create. * @return */ public void deletePropertyValueLocalizedContent(String productCode, String attributeFQN, String value, String localeCode) throws Exception { MozuClient client = com.mozu.api.clients.commerce.catalog.admin.products.ProductPropertyClient.deletePropertyValueLocalizedContentClient(_dataViewMode, productCode, attributeFQN, value, localeCode); client.setContext(_apiContext); client.executeRequest(); client.cleanupHttpConnection(); } }