001 002package com.commercetools.api.models.cart; 003 004import java.time.*; 005import java.util.*; 006 007import com.fasterxml.jackson.annotation.JsonCreator; 008import com.fasterxml.jackson.annotation.JsonProperty; 009import com.fasterxml.jackson.databind.annotation.*; 010 011import io.vrap.rmf.base.client.ModelBase; 012import io.vrap.rmf.base.client.utils.Generated; 013 014import org.apache.commons.lang3.builder.EqualsBuilder; 015import org.apache.commons.lang3.builder.HashCodeBuilder; 016 017/** 018 * <p>This update action can only be used if a Customer is not assigned to a Cart. If a Customer is already assigned, the Cart has the same Customer Group as the assigned Customer.</p> 019 * <p>Setting the Customer Group also updates the LineItem <code>prices</code> according to the Customer Group.</p> 020 */ 021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 022public class CartSetCustomerGroupActionImpl implements CartSetCustomerGroupAction, ModelBase { 023 024 private String action; 025 026 private com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier customerGroup; 027 028 /** 029 * create instance with all properties 030 */ 031 @JsonCreator 032 CartSetCustomerGroupActionImpl( 033 @JsonProperty("customerGroup") final com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier customerGroup) { 034 this.customerGroup = customerGroup; 035 this.action = SET_CUSTOMER_GROUP; 036 } 037 038 /** 039 * create empty instance 040 */ 041 public CartSetCustomerGroupActionImpl() { 042 this.action = SET_CUSTOMER_GROUP; 043 } 044 045 /** 046 * 047 */ 048 049 public String getAction() { 050 return this.action; 051 } 052 053 /** 054 * <p>Value to set. If empty, any existing value is removed.</p> 055 */ 056 057 public com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier getCustomerGroup() { 058 return this.customerGroup; 059 } 060 061 public void setCustomerGroup( 062 final com.commercetools.api.models.customer_group.CustomerGroupResourceIdentifier customerGroup) { 063 this.customerGroup = customerGroup; 064 } 065 066 @Override 067 public boolean equals(Object o) { 068 if (this == o) 069 return true; 070 071 if (o == null || getClass() != o.getClass()) 072 return false; 073 074 CartSetCustomerGroupActionImpl that = (CartSetCustomerGroupActionImpl) o; 075 076 return new EqualsBuilder().append(action, that.action).append(customerGroup, that.customerGroup).isEquals(); 077 } 078 079 @Override 080 public int hashCode() { 081 return new HashCodeBuilder(17, 37).append(action).append(customerGroup).toHashCode(); 082 } 083 084}