001 002package com.commercetools.api.models.me; 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>When multiple shipping addresses are set for a Line Item, use the Remove LineItem and Add LineItem update action to change the shipping details. Since it is not possible for the API to infer how the overall change in the Line Item quantity should be distributed over the sub-quantities, the <code>shippingDetails</code> field is kept in its current state to avoid data loss.</p> 019 * <p>To change the Line Item quantity and shipping details together, use this update action in combination with the Set LineItem ShippingDetails update action in a single Cart update command.</p> 020 * <p>When the action applies to LineItems with <code>ExternalTotal</code> LineItemPriceMode, it will be changed to <code>ExternalPrice</code> and the existing <code>externalPrice</code> value, i.e. <code>LineItem.price</code>, will be retained. The LineItem total will be calculated by the system instead, so that the <code>externalTotalPrice</code> will be dropped.</p> 021 */ 022@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 023public class MyCartChangeLineItemQuantityActionImpl implements MyCartChangeLineItemQuantityAction, ModelBase { 024 025 private String action; 026 027 private String lineItemId; 028 029 private String lineItemKey; 030 031 private Long quantity; 032 033 /** 034 * create instance with all properties 035 */ 036 @JsonCreator 037 MyCartChangeLineItemQuantityActionImpl(@JsonProperty("lineItemId") final String lineItemId, 038 @JsonProperty("lineItemKey") final String lineItemKey, @JsonProperty("quantity") final Long quantity) { 039 this.lineItemId = lineItemId; 040 this.lineItemKey = lineItemKey; 041 this.quantity = quantity; 042 this.action = CHANGE_LINE_ITEM_QUANTITY; 043 } 044 045 /** 046 * create empty instance 047 */ 048 public MyCartChangeLineItemQuantityActionImpl() { 049 this.action = CHANGE_LINE_ITEM_QUANTITY; 050 } 051 052 /** 053 * 054 */ 055 056 public String getAction() { 057 return this.action; 058 } 059 060 /** 061 * <p><code>id</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p> 062 */ 063 064 public String getLineItemId() { 065 return this.lineItemId; 066 } 067 068 /** 069 * <p><code>key</code> of the LineItem to update. Either <code>lineItemId</code> or <code>lineItemKey</code> is required.</p> 070 */ 071 072 public String getLineItemKey() { 073 return this.lineItemKey; 074 } 075 076 /** 077 * <p>New value to set.</p> 078 * <p>If <code>0</code>, the Line Item is removed from the Cart.</p> 079 */ 080 081 public Long getQuantity() { 082 return this.quantity; 083 } 084 085 public void setLineItemId(final String lineItemId) { 086 this.lineItemId = lineItemId; 087 } 088 089 public void setLineItemKey(final String lineItemKey) { 090 this.lineItemKey = lineItemKey; 091 } 092 093 public void setQuantity(final Long quantity) { 094 this.quantity = quantity; 095 } 096 097 @Override 098 public boolean equals(Object o) { 099 if (this == o) 100 return true; 101 102 if (o == null || getClass() != o.getClass()) 103 return false; 104 105 MyCartChangeLineItemQuantityActionImpl that = (MyCartChangeLineItemQuantityActionImpl) o; 106 107 return new EqualsBuilder().append(action, that.action) 108 .append(lineItemId, that.lineItemId) 109 .append(lineItemKey, that.lineItemKey) 110 .append(quantity, that.quantity) 111 .append(action, that.action) 112 .append(lineItemId, that.lineItemId) 113 .append(lineItemKey, that.lineItemKey) 114 .append(quantity, that.quantity) 115 .isEquals(); 116 } 117 118 @Override 119 public int hashCode() { 120 return new HashCodeBuilder(17, 37).append(action) 121 .append(lineItemId) 122 .append(lineItemKey) 123 .append(quantity) 124 .toHashCode(); 125 } 126 127}