001 002package com.commercetools.api.models.business_unit; 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>Only Business Units of type <code>Division</code> can be have a store mode of <code>FromParent</code>. Changing the <code>storeMode</code> to <code>FromParent</code> empties the <code>stores</code> array on the BusinessUnit. This update action generates a BusinessUnitStoreModeChanged Message.</p> 019 */ 020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 021public class BusinessUnitSetStoreModeActionImpl implements BusinessUnitSetStoreModeAction, ModelBase { 022 023 private String action; 024 025 private com.commercetools.api.models.business_unit.BusinessUnitStoreMode storeMode; 026 027 private java.util.List<com.commercetools.api.models.store.StoreResourceIdentifier> stores; 028 029 /** 030 * create instance with all properties 031 */ 032 @JsonCreator 033 BusinessUnitSetStoreModeActionImpl( 034 @JsonProperty("storeMode") final com.commercetools.api.models.business_unit.BusinessUnitStoreMode storeMode, 035 @JsonProperty("stores") final java.util.List<com.commercetools.api.models.store.StoreResourceIdentifier> stores) { 036 this.storeMode = storeMode; 037 this.stores = stores; 038 this.action = SET_STORE_MODE; 039 } 040 041 /** 042 * create empty instance 043 */ 044 public BusinessUnitSetStoreModeActionImpl() { 045 this.action = SET_STORE_MODE; 046 } 047 048 /** 049 * 050 */ 051 052 public String getAction() { 053 return this.action; 054 } 055 056 /** 057 * <p>Set to <code>Explicit</code> to specify Stores for the Business Unit. Set to <code>FromParent</code> to inherit Stores from a parent.</p> 058 */ 059 060 public com.commercetools.api.models.business_unit.BusinessUnitStoreMode getStoreMode() { 061 return this.storeMode; 062 } 063 064 /** 065 * <p>Set the Stores the Business Unit is associated with. Can only be set if <code>storeMode</code> is <code>Explicit</code>.</p> 066 */ 067 068 public java.util.List<com.commercetools.api.models.store.StoreResourceIdentifier> getStores() { 069 return this.stores; 070 } 071 072 public void setStoreMode(final com.commercetools.api.models.business_unit.BusinessUnitStoreMode storeMode) { 073 this.storeMode = storeMode; 074 } 075 076 public void setStores(final com.commercetools.api.models.store.StoreResourceIdentifier... stores) { 077 this.stores = new ArrayList<>(Arrays.asList(stores)); 078 } 079 080 public void setStores(final java.util.List<com.commercetools.api.models.store.StoreResourceIdentifier> stores) { 081 this.stores = stores; 082 } 083 084 @Override 085 public boolean equals(Object o) { 086 if (this == o) 087 return true; 088 089 if (o == null || getClass() != o.getClass()) 090 return false; 091 092 BusinessUnitSetStoreModeActionImpl that = (BusinessUnitSetStoreModeActionImpl) o; 093 094 return new EqualsBuilder().append(action, that.action) 095 .append(storeMode, that.storeMode) 096 .append(stores, that.stores) 097 .append(action, that.action) 098 .append(storeMode, that.storeMode) 099 .append(stores, that.stores) 100 .isEquals(); 101 } 102 103 @Override 104 public int hashCode() { 105 return new HashCodeBuilder(17, 37).append(action).append(storeMode).append(stores).toHashCode(); 106 } 107 108}