001 002package com.commercetools.api.models.message; 003 004import java.util.*; 005import java.util.function.Function; 006 007import javax.annotation.Nullable; 008 009import io.vrap.rmf.base.client.Builder; 010import io.vrap.rmf.base.client.utils.Generated; 011 012/** 013 * StagedQuoteStateChangedMessageBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * StagedQuoteStateChangedMessage stagedQuoteStateChangedMessage = StagedQuoteStateChangedMessage.builder() 019 * .id("{id}") 020 * .version(0.3) 021 * .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z")) 022 * .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z")) 023 * .sequenceNumber(0.3) 024 * .resource(resourceBuilder -> resourceBuilder) 025 * .resourceVersion(0.3) 026 * .stagedQuoteState(StagedQuoteState.IN_PROGRESS) 027 * .oldStagedQuoteState(StagedQuoteState.IN_PROGRESS) 028 * .build() 029 * </code></pre> 030 * </div> 031 */ 032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 033public class StagedQuoteStateChangedMessageBuilder implements Builder<StagedQuoteStateChangedMessage> { 034 035 private String id; 036 037 private Long version; 038 039 private java.time.ZonedDateTime createdAt; 040 041 private java.time.ZonedDateTime lastModifiedAt; 042 043 @Nullable 044 private com.commercetools.api.models.common.LastModifiedBy lastModifiedBy; 045 046 @Nullable 047 private com.commercetools.api.models.common.CreatedBy createdBy; 048 049 private Long sequenceNumber; 050 051 private com.commercetools.api.models.common.Reference resource; 052 053 private Long resourceVersion; 054 055 @Nullable 056 private com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers; 057 058 private com.commercetools.api.models.staged_quote.StagedQuoteState stagedQuoteState; 059 060 private com.commercetools.api.models.staged_quote.StagedQuoteState oldStagedQuoteState; 061 062 /** 063 * <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p> 064 * @param id value to be set 065 * @return Builder 066 */ 067 068 public StagedQuoteStateChangedMessageBuilder id(final String id) { 069 this.id = id; 070 return this; 071 } 072 073 /** 074 * <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p> 075 * @param version value to be set 076 * @return Builder 077 */ 078 079 public StagedQuoteStateChangedMessageBuilder version(final Long version) { 080 this.version = version; 081 return this; 082 } 083 084 /** 085 * <p>Date and time (UTC) the Message was generated.</p> 086 * @param createdAt value to be set 087 * @return Builder 088 */ 089 090 public StagedQuoteStateChangedMessageBuilder createdAt(final java.time.ZonedDateTime createdAt) { 091 this.createdAt = createdAt; 092 return this; 093 } 094 095 /** 096 * <p>Value of <code>createdAt</code>.</p> 097 * @param lastModifiedAt value to be set 098 * @return Builder 099 */ 100 101 public StagedQuoteStateChangedMessageBuilder lastModifiedAt(final java.time.ZonedDateTime lastModifiedAt) { 102 this.lastModifiedAt = lastModifiedAt; 103 return this; 104 } 105 106 /** 107 * <p>Value of <code>createdBy</code>.</p> 108 * @param builder function to build the lastModifiedBy value 109 * @return Builder 110 */ 111 112 public StagedQuoteStateChangedMessageBuilder lastModifiedBy( 113 Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedByBuilder> builder) { 114 this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of()).build(); 115 return this; 116 } 117 118 /** 119 * <p>Value of <code>createdBy</code>.</p> 120 * @param builder function to build the lastModifiedBy value 121 * @return Builder 122 */ 123 124 public StagedQuoteStateChangedMessageBuilder withLastModifiedBy( 125 Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedBy> builder) { 126 this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of()); 127 return this; 128 } 129 130 /** 131 * <p>Value of <code>createdBy</code>.</p> 132 * @param lastModifiedBy value to be set 133 * @return Builder 134 */ 135 136 public StagedQuoteStateChangedMessageBuilder lastModifiedBy( 137 @Nullable final com.commercetools.api.models.common.LastModifiedBy lastModifiedBy) { 138 this.lastModifiedBy = lastModifiedBy; 139 return this; 140 } 141 142 /** 143 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 144 * @param builder function to build the createdBy value 145 * @return Builder 146 */ 147 148 public StagedQuoteStateChangedMessageBuilder createdBy( 149 Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedByBuilder> builder) { 150 this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of()).build(); 151 return this; 152 } 153 154 /** 155 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 156 * @param builder function to build the createdBy value 157 * @return Builder 158 */ 159 160 public StagedQuoteStateChangedMessageBuilder withCreatedBy( 161 Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedBy> builder) { 162 this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of()); 163 return this; 164 } 165 166 /** 167 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 168 * @param createdBy value to be set 169 * @return Builder 170 */ 171 172 public StagedQuoteStateChangedMessageBuilder createdBy( 173 @Nullable final com.commercetools.api.models.common.CreatedBy createdBy) { 174 this.createdBy = createdBy; 175 return this; 176 } 177 178 /** 179 * <p>Message number in relation to other Messages for a given resource. The <code>sequenceNumber</code> of the next Message for the resource is the successor of the <code>sequenceNumber</code> of the current Message. Meaning, the <code>sequenceNumber</code> of the next Message equals the <code>sequenceNumber</code> of the current Message + 1. <code>sequenceNumber</code> can be used to ensure that Messages are processed in the correct order for a particular resource.</p> 180 * @param sequenceNumber value to be set 181 * @return Builder 182 */ 183 184 public StagedQuoteStateChangedMessageBuilder sequenceNumber(final Long sequenceNumber) { 185 this.sequenceNumber = sequenceNumber; 186 return this; 187 } 188 189 /** 190 * <p>Reference to the resource on which the change or action was performed.</p> 191 * @param resource value to be set 192 * @return Builder 193 */ 194 195 public StagedQuoteStateChangedMessageBuilder resource( 196 final com.commercetools.api.models.common.Reference resource) { 197 this.resource = resource; 198 return this; 199 } 200 201 /** 202 * <p>Reference to the resource on which the change or action was performed.</p> 203 * @param builder function to build the resource value 204 * @return Builder 205 */ 206 207 public StagedQuoteStateChangedMessageBuilder resource( 208 Function<com.commercetools.api.models.common.ReferenceBuilder, Builder<? extends com.commercetools.api.models.common.Reference>> builder) { 209 this.resource = builder.apply(com.commercetools.api.models.common.ReferenceBuilder.of()).build(); 210 return this; 211 } 212 213 /** 214 * <p>Version of the resource on which the change or action was performed.</p> 215 * @param resourceVersion value to be set 216 * @return Builder 217 */ 218 219 public StagedQuoteStateChangedMessageBuilder resourceVersion(final Long resourceVersion) { 220 this.resourceVersion = resourceVersion; 221 return this; 222 } 223 224 /** 225 * <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p> 226 * @param builder function to build the resourceUserProvidedIdentifiers value 227 * @return Builder 228 */ 229 230 public StagedQuoteStateChangedMessageBuilder resourceUserProvidedIdentifiers( 231 Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiersBuilder> builder) { 232 this.resourceUserProvidedIdentifiers = builder 233 .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of()) 234 .build(); 235 return this; 236 } 237 238 /** 239 * <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p> 240 * @param builder function to build the resourceUserProvidedIdentifiers value 241 * @return Builder 242 */ 243 244 public StagedQuoteStateChangedMessageBuilder withResourceUserProvidedIdentifiers( 245 Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiers> builder) { 246 this.resourceUserProvidedIdentifiers = builder 247 .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of()); 248 return this; 249 } 250 251 /** 252 * <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p> 253 * @param resourceUserProvidedIdentifiers value to be set 254 * @return Builder 255 */ 256 257 public StagedQuoteStateChangedMessageBuilder resourceUserProvidedIdentifiers( 258 @Nullable final com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers) { 259 this.resourceUserProvidedIdentifiers = resourceUserProvidedIdentifiers; 260 return this; 261 } 262 263 /** 264 * <p>State of the Staged Quote after the Change Staged Quote State update action.</p> 265 * @param stagedQuoteState value to be set 266 * @return Builder 267 */ 268 269 public StagedQuoteStateChangedMessageBuilder stagedQuoteState( 270 final com.commercetools.api.models.staged_quote.StagedQuoteState stagedQuoteState) { 271 this.stagedQuoteState = stagedQuoteState; 272 return this; 273 } 274 275 /** 276 * <p>State of the Staged Quote before the Change Staged Quote State update action.</p> 277 * @param oldStagedQuoteState value to be set 278 * @return Builder 279 */ 280 281 public StagedQuoteStateChangedMessageBuilder oldStagedQuoteState( 282 final com.commercetools.api.models.staged_quote.StagedQuoteState oldStagedQuoteState) { 283 this.oldStagedQuoteState = oldStagedQuoteState; 284 return this; 285 } 286 287 /** 288 * <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p> 289 * @return id 290 */ 291 292 public String getId() { 293 return this.id; 294 } 295 296 /** 297 * <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p> 298 * @return version 299 */ 300 301 public Long getVersion() { 302 return this.version; 303 } 304 305 /** 306 * <p>Date and time (UTC) the Message was generated.</p> 307 * @return createdAt 308 */ 309 310 public java.time.ZonedDateTime getCreatedAt() { 311 return this.createdAt; 312 } 313 314 /** 315 * <p>Value of <code>createdAt</code>.</p> 316 * @return lastModifiedAt 317 */ 318 319 public java.time.ZonedDateTime getLastModifiedAt() { 320 return this.lastModifiedAt; 321 } 322 323 /** 324 * <p>Value of <code>createdBy</code>.</p> 325 * @return lastModifiedBy 326 */ 327 328 @Nullable 329 public com.commercetools.api.models.common.LastModifiedBy getLastModifiedBy() { 330 return this.lastModifiedBy; 331 } 332 333 /** 334 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 335 * @return createdBy 336 */ 337 338 @Nullable 339 public com.commercetools.api.models.common.CreatedBy getCreatedBy() { 340 return this.createdBy; 341 } 342 343 /** 344 * <p>Message number in relation to other Messages for a given resource. The <code>sequenceNumber</code> of the next Message for the resource is the successor of the <code>sequenceNumber</code> of the current Message. Meaning, the <code>sequenceNumber</code> of the next Message equals the <code>sequenceNumber</code> of the current Message + 1. <code>sequenceNumber</code> can be used to ensure that Messages are processed in the correct order for a particular resource.</p> 345 * @return sequenceNumber 346 */ 347 348 public Long getSequenceNumber() { 349 return this.sequenceNumber; 350 } 351 352 /** 353 * <p>Reference to the resource on which the change or action was performed.</p> 354 * @return resource 355 */ 356 357 public com.commercetools.api.models.common.Reference getResource() { 358 return this.resource; 359 } 360 361 /** 362 * <p>Version of the resource on which the change or action was performed.</p> 363 * @return resourceVersion 364 */ 365 366 public Long getResourceVersion() { 367 return this.resourceVersion; 368 } 369 370 /** 371 * <p>User-provided identifiers of the resource, such as <code>key</code> or <code>externalId</code>. Only present if the resource has such identifiers.</p> 372 * @return resourceUserProvidedIdentifiers 373 */ 374 375 @Nullable 376 public com.commercetools.api.models.message.UserProvidedIdentifiers getResourceUserProvidedIdentifiers() { 377 return this.resourceUserProvidedIdentifiers; 378 } 379 380 /** 381 * <p>State of the Staged Quote after the Change Staged Quote State update action.</p> 382 * @return stagedQuoteState 383 */ 384 385 public com.commercetools.api.models.staged_quote.StagedQuoteState getStagedQuoteState() { 386 return this.stagedQuoteState; 387 } 388 389 /** 390 * <p>State of the Staged Quote before the Change Staged Quote State update action.</p> 391 * @return oldStagedQuoteState 392 */ 393 394 public com.commercetools.api.models.staged_quote.StagedQuoteState getOldStagedQuoteState() { 395 return this.oldStagedQuoteState; 396 } 397 398 /** 399 * builds StagedQuoteStateChangedMessage with checking for non-null required values 400 * @return StagedQuoteStateChangedMessage 401 */ 402 public StagedQuoteStateChangedMessage build() { 403 Objects.requireNonNull(id, StagedQuoteStateChangedMessage.class + ": id is missing"); 404 Objects.requireNonNull(version, StagedQuoteStateChangedMessage.class + ": version is missing"); 405 Objects.requireNonNull(createdAt, StagedQuoteStateChangedMessage.class + ": createdAt is missing"); 406 Objects.requireNonNull(lastModifiedAt, StagedQuoteStateChangedMessage.class + ": lastModifiedAt is missing"); 407 Objects.requireNonNull(sequenceNumber, StagedQuoteStateChangedMessage.class + ": sequenceNumber is missing"); 408 Objects.requireNonNull(resource, StagedQuoteStateChangedMessage.class + ": resource is missing"); 409 Objects.requireNonNull(resourceVersion, StagedQuoteStateChangedMessage.class + ": resourceVersion is missing"); 410 Objects.requireNonNull(stagedQuoteState, 411 StagedQuoteStateChangedMessage.class + ": stagedQuoteState is missing"); 412 Objects.requireNonNull(oldStagedQuoteState, 413 StagedQuoteStateChangedMessage.class + ": oldStagedQuoteState is missing"); 414 return new StagedQuoteStateChangedMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy, 415 sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, stagedQuoteState, 416 oldStagedQuoteState); 417 } 418 419 /** 420 * builds StagedQuoteStateChangedMessage without checking for non-null required values 421 * @return StagedQuoteStateChangedMessage 422 */ 423 public StagedQuoteStateChangedMessage buildUnchecked() { 424 return new StagedQuoteStateChangedMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy, 425 sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, stagedQuoteState, 426 oldStagedQuoteState); 427 } 428 429 /** 430 * factory method for an instance of StagedQuoteStateChangedMessageBuilder 431 * @return builder 432 */ 433 public static StagedQuoteStateChangedMessageBuilder of() { 434 return new StagedQuoteStateChangedMessageBuilder(); 435 } 436 437 /** 438 * create builder for StagedQuoteStateChangedMessage instance 439 * @param template instance with prefilled values for the builder 440 * @return builder 441 */ 442 public static StagedQuoteStateChangedMessageBuilder of(final StagedQuoteStateChangedMessage template) { 443 StagedQuoteStateChangedMessageBuilder builder = new StagedQuoteStateChangedMessageBuilder(); 444 builder.id = template.getId(); 445 builder.version = template.getVersion(); 446 builder.createdAt = template.getCreatedAt(); 447 builder.lastModifiedAt = template.getLastModifiedAt(); 448 builder.lastModifiedBy = template.getLastModifiedBy(); 449 builder.createdBy = template.getCreatedBy(); 450 builder.sequenceNumber = template.getSequenceNumber(); 451 builder.resource = template.getResource(); 452 builder.resourceVersion = template.getResourceVersion(); 453 builder.resourceUserProvidedIdentifiers = template.getResourceUserProvidedIdentifiers(); 454 builder.stagedQuoteState = template.getStagedQuoteState(); 455 builder.oldStagedQuoteState = template.getOldStagedQuoteState(); 456 return builder; 457 } 458 459}