001 002package com.commercetools.api.models.extension; 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 * ExtensionDraft 019 */ 020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 021public class ExtensionDraftImpl implements ExtensionDraft, ModelBase { 022 023 private String key; 024 025 private com.commercetools.api.models.extension.ExtensionDestination destination; 026 027 private java.util.List<com.commercetools.api.models.extension.ExtensionTrigger> triggers; 028 029 private Integer timeoutInMs; 030 031 /** 032 * create instance with all properties 033 */ 034 @JsonCreator 035 ExtensionDraftImpl(@JsonProperty("key") final String key, 036 @JsonProperty("destination") final com.commercetools.api.models.extension.ExtensionDestination destination, 037 @JsonProperty("triggers") final java.util.List<com.commercetools.api.models.extension.ExtensionTrigger> triggers, 038 @JsonProperty("timeoutInMs") final Integer timeoutInMs) { 039 this.key = key; 040 this.destination = destination; 041 this.triggers = triggers; 042 this.timeoutInMs = timeoutInMs; 043 } 044 045 /** 046 * create empty instance 047 */ 048 public ExtensionDraftImpl() { 049 } 050 051 /** 052 * <p>User-defined unique identifier for the Extension.</p> 053 */ 054 055 public String getKey() { 056 return this.key; 057 } 058 059 /** 060 * <p>Defines where the Extension can be reached.</p> 061 */ 062 063 public com.commercetools.api.models.extension.ExtensionDestination getDestination() { 064 return this.destination; 065 } 066 067 /** 068 * <p>Describes what triggers the Extension.</p> 069 */ 070 071 public java.util.List<com.commercetools.api.models.extension.ExtensionTrigger> getTriggers() { 072 return this.triggers; 073 } 074 075 /** 076 * <p>Maximum time (in milliseconds) the Extension can respond within. If no timeout is provided, the default value is used for all types of Extensions. The maximum value is 10000 ms (10 seconds) for <code>payment</code> Extensions and 2000 ms (2 seconds) for all other Extensions.</p> 077 * <p>This limit can be increased per Project after we review the performance impact. Please contact our support via the Support Portal and provide the Region, Project key, and use case.</p> 078 */ 079 080 public Integer getTimeoutInMs() { 081 return this.timeoutInMs; 082 } 083 084 public void setKey(final String key) { 085 this.key = key; 086 } 087 088 public void setDestination(final com.commercetools.api.models.extension.ExtensionDestination destination) { 089 this.destination = destination; 090 } 091 092 public void setTriggers(final com.commercetools.api.models.extension.ExtensionTrigger... triggers) { 093 this.triggers = new ArrayList<>(Arrays.asList(triggers)); 094 } 095 096 public void setTriggers(final java.util.List<com.commercetools.api.models.extension.ExtensionTrigger> triggers) { 097 this.triggers = triggers; 098 } 099 100 public void setTimeoutInMs(final Integer timeoutInMs) { 101 this.timeoutInMs = timeoutInMs; 102 } 103 104 @Override 105 public boolean equals(Object o) { 106 if (this == o) 107 return true; 108 109 if (o == null || getClass() != o.getClass()) 110 return false; 111 112 ExtensionDraftImpl that = (ExtensionDraftImpl) o; 113 114 return new EqualsBuilder().append(key, that.key) 115 .append(destination, that.destination) 116 .append(triggers, that.triggers) 117 .append(timeoutInMs, that.timeoutInMs) 118 .append(key, that.key) 119 .append(destination, that.destination) 120 .append(triggers, that.triggers) 121 .append(timeoutInMs, that.timeoutInMs) 122 .isEquals(); 123 } 124 125 @Override 126 public int hashCode() { 127 return new HashCodeBuilder(17, 37).append(key) 128 .append(destination) 129 .append(triggers) 130 .append(timeoutInMs) 131 .toHashCode(); 132 } 133 134}