001 002package com.commercetools.api.models.subscription; 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 payload is sent for a ChangeSubscription when a resource is updated. This includes updates by a background process, like a change in product availability.</p> 019 */ 020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 021public class ResourceUpdatedDeliveryPayloadImpl implements ResourceUpdatedDeliveryPayload, ModelBase { 022 023 private String projectKey; 024 025 private String notificationType; 026 027 private com.commercetools.api.models.common.Reference resource; 028 029 private com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers; 030 031 private Long version; 032 033 private Long oldVersion; 034 035 private java.time.ZonedDateTime modifiedAt; 036 037 /** 038 * create instance with all properties 039 */ 040 @JsonCreator 041 ResourceUpdatedDeliveryPayloadImpl(@JsonProperty("projectKey") final String projectKey, 042 @JsonProperty("resource") final com.commercetools.api.models.common.Reference resource, 043 @JsonProperty("resourceUserProvidedIdentifiers") final com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers, 044 @JsonProperty("version") final Long version, @JsonProperty("oldVersion") final Long oldVersion, 045 @JsonProperty("modifiedAt") final java.time.ZonedDateTime modifiedAt) { 046 this.projectKey = projectKey; 047 this.resource = resource; 048 this.resourceUserProvidedIdentifiers = resourceUserProvidedIdentifiers; 049 this.version = version; 050 this.oldVersion = oldVersion; 051 this.modifiedAt = modifiedAt; 052 this.notificationType = RESOURCE_UPDATED; 053 } 054 055 /** 056 * create empty instance 057 */ 058 public ResourceUpdatedDeliveryPayloadImpl() { 059 this.notificationType = RESOURCE_UPDATED; 060 } 061 062 /** 063 * <p><code>key</code> of the Project. Useful in message processing if the Destination receives events from multiple Projects.</p> 064 */ 065 066 public String getProjectKey() { 067 return this.projectKey; 068 } 069 070 /** 071 * <p>Identifies the payload.</p> 072 */ 073 074 public String getNotificationType() { 075 return this.notificationType; 076 } 077 078 /** 079 * <p>Reference to the resource that triggered the message.</p> 080 */ 081 082 public com.commercetools.api.models.common.Reference getResource() { 083 return this.resource; 084 } 085 086 /** 087 * <p>User-defined unique identifiers of the resource.</p> 088 */ 089 090 public com.commercetools.api.models.message.UserProvidedIdentifiers getResourceUserProvidedIdentifiers() { 091 return this.resourceUserProvidedIdentifiers; 092 } 093 094 /** 095 * <p>Last seen version of the resource.</p> 096 */ 097 098 public Long getVersion() { 099 return this.version; 100 } 101 102 /** 103 * <p>Version of the resource before the update.</p> 104 */ 105 106 public Long getOldVersion() { 107 return this.oldVersion; 108 } 109 110 /** 111 * <p>Date and time (UTC) the resource was last updated.</p> 112 */ 113 114 public java.time.ZonedDateTime getModifiedAt() { 115 return this.modifiedAt; 116 } 117 118 public void setProjectKey(final String projectKey) { 119 this.projectKey = projectKey; 120 } 121 122 public void setResource(final com.commercetools.api.models.common.Reference resource) { 123 this.resource = resource; 124 } 125 126 public void setResourceUserProvidedIdentifiers( 127 final com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers) { 128 this.resourceUserProvidedIdentifiers = resourceUserProvidedIdentifiers; 129 } 130 131 public void setVersion(final Long version) { 132 this.version = version; 133 } 134 135 public void setOldVersion(final Long oldVersion) { 136 this.oldVersion = oldVersion; 137 } 138 139 public void setModifiedAt(final java.time.ZonedDateTime modifiedAt) { 140 this.modifiedAt = modifiedAt; 141 } 142 143 @Override 144 public boolean equals(Object o) { 145 if (this == o) 146 return true; 147 148 if (o == null || getClass() != o.getClass()) 149 return false; 150 151 ResourceUpdatedDeliveryPayloadImpl that = (ResourceUpdatedDeliveryPayloadImpl) o; 152 153 return new EqualsBuilder().append(projectKey, that.projectKey) 154 .append(notificationType, that.notificationType) 155 .append(resource, that.resource) 156 .append(resourceUserProvidedIdentifiers, that.resourceUserProvidedIdentifiers) 157 .append(version, that.version) 158 .append(oldVersion, that.oldVersion) 159 .append(modifiedAt, that.modifiedAt) 160 .isEquals(); 161 } 162 163 @Override 164 public int hashCode() { 165 return new HashCodeBuilder(17, 37).append(projectKey) 166 .append(notificationType) 167 .append(resource) 168 .append(resourceUserProvidedIdentifiers) 169 .append(version) 170 .append(oldVersion) 171 .append(modifiedAt) 172 .toHashCode(); 173 } 174 175}