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 * ReviewStateTransitionMessageBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * ReviewStateTransitionMessage reviewStateTransitionMessage = ReviewStateTransitionMessage.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 * .newState(newStateBuilder -> newStateBuilder) 027 * .oldIncludedInStatistics(true) 028 * .newIncludedInStatistics(true) 029 * .force(true) 030 * .build() 031 * </code></pre> 032 * </div> 033 */ 034@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 035public class ReviewStateTransitionMessageBuilder implements Builder<ReviewStateTransitionMessage> { 036 037 private String id; 038 039 private Long version; 040 041 private java.time.ZonedDateTime createdAt; 042 043 private java.time.ZonedDateTime lastModifiedAt; 044 045 @Nullable 046 private com.commercetools.api.models.common.LastModifiedBy lastModifiedBy; 047 048 @Nullable 049 private com.commercetools.api.models.common.CreatedBy createdBy; 050 051 private Long sequenceNumber; 052 053 private com.commercetools.api.models.common.Reference resource; 054 055 private Long resourceVersion; 056 057 @Nullable 058 private com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers; 059 060 @Nullable 061 private com.commercetools.api.models.state.StateReference oldState; 062 063 private com.commercetools.api.models.state.StateReference newState; 064 065 private Boolean oldIncludedInStatistics; 066 067 private Boolean newIncludedInStatistics; 068 069 @Nullable 070 private com.commercetools.api.models.common.Reference target; 071 072 private Boolean force; 073 074 /** 075 * <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p> 076 * @param id value to be set 077 * @return Builder 078 */ 079 080 public ReviewStateTransitionMessageBuilder id(final String id) { 081 this.id = id; 082 return this; 083 } 084 085 /** 086 * <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p> 087 * @param version value to be set 088 * @return Builder 089 */ 090 091 public ReviewStateTransitionMessageBuilder version(final Long version) { 092 this.version = version; 093 return this; 094 } 095 096 /** 097 * <p>Date and time (UTC) the Message was generated.</p> 098 * @param createdAt value to be set 099 * @return Builder 100 */ 101 102 public ReviewStateTransitionMessageBuilder createdAt(final java.time.ZonedDateTime createdAt) { 103 this.createdAt = createdAt; 104 return this; 105 } 106 107 /** 108 * <p>Value of <code>createdAt</code>.</p> 109 * @param lastModifiedAt value to be set 110 * @return Builder 111 */ 112 113 public ReviewStateTransitionMessageBuilder lastModifiedAt(final java.time.ZonedDateTime lastModifiedAt) { 114 this.lastModifiedAt = lastModifiedAt; 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 ReviewStateTransitionMessageBuilder lastModifiedBy( 125 Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedByBuilder> builder) { 126 this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of()).build(); 127 return this; 128 } 129 130 /** 131 * <p>Value of <code>createdBy</code>.</p> 132 * @param builder function to build the lastModifiedBy value 133 * @return Builder 134 */ 135 136 public ReviewStateTransitionMessageBuilder withLastModifiedBy( 137 Function<com.commercetools.api.models.common.LastModifiedByBuilder, com.commercetools.api.models.common.LastModifiedBy> builder) { 138 this.lastModifiedBy = builder.apply(com.commercetools.api.models.common.LastModifiedByBuilder.of()); 139 return this; 140 } 141 142 /** 143 * <p>Value of <code>createdBy</code>.</p> 144 * @param lastModifiedBy value to be set 145 * @return Builder 146 */ 147 148 public ReviewStateTransitionMessageBuilder lastModifiedBy( 149 @Nullable final com.commercetools.api.models.common.LastModifiedBy lastModifiedBy) { 150 this.lastModifiedBy = lastModifiedBy; 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 ReviewStateTransitionMessageBuilder createdBy( 161 Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedByBuilder> builder) { 162 this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of()).build(); 163 return this; 164 } 165 166 /** 167 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 168 * @param builder function to build the createdBy value 169 * @return Builder 170 */ 171 172 public ReviewStateTransitionMessageBuilder withCreatedBy( 173 Function<com.commercetools.api.models.common.CreatedByBuilder, com.commercetools.api.models.common.CreatedBy> builder) { 174 this.createdBy = builder.apply(com.commercetools.api.models.common.CreatedByBuilder.of()); 175 return this; 176 } 177 178 /** 179 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 180 * @param createdBy value to be set 181 * @return Builder 182 */ 183 184 public ReviewStateTransitionMessageBuilder createdBy( 185 @Nullable final com.commercetools.api.models.common.CreatedBy createdBy) { 186 this.createdBy = createdBy; 187 return this; 188 } 189 190 /** 191 * <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> 192 * @param sequenceNumber value to be set 193 * @return Builder 194 */ 195 196 public ReviewStateTransitionMessageBuilder sequenceNumber(final Long sequenceNumber) { 197 this.sequenceNumber = sequenceNumber; 198 return this; 199 } 200 201 /** 202 * <p>Reference to the resource on which the change or action was performed.</p> 203 * @param resource value to be set 204 * @return Builder 205 */ 206 207 public ReviewStateTransitionMessageBuilder resource(final com.commercetools.api.models.common.Reference resource) { 208 this.resource = resource; 209 return this; 210 } 211 212 /** 213 * <p>Reference to the resource on which the change or action was performed.</p> 214 * @param builder function to build the resource value 215 * @return Builder 216 */ 217 218 public ReviewStateTransitionMessageBuilder resource( 219 Function<com.commercetools.api.models.common.ReferenceBuilder, Builder<? extends com.commercetools.api.models.common.Reference>> builder) { 220 this.resource = builder.apply(com.commercetools.api.models.common.ReferenceBuilder.of()).build(); 221 return this; 222 } 223 224 /** 225 * <p>Version of the resource on which the change or action was performed.</p> 226 * @param resourceVersion value to be set 227 * @return Builder 228 */ 229 230 public ReviewStateTransitionMessageBuilder resourceVersion(final Long resourceVersion) { 231 this.resourceVersion = resourceVersion; 232 return this; 233 } 234 235 /** 236 * <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> 237 * @param builder function to build the resourceUserProvidedIdentifiers value 238 * @return Builder 239 */ 240 241 public ReviewStateTransitionMessageBuilder resourceUserProvidedIdentifiers( 242 Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiersBuilder> builder) { 243 this.resourceUserProvidedIdentifiers = builder 244 .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of()) 245 .build(); 246 return this; 247 } 248 249 /** 250 * <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> 251 * @param builder function to build the resourceUserProvidedIdentifiers value 252 * @return Builder 253 */ 254 255 public ReviewStateTransitionMessageBuilder withResourceUserProvidedIdentifiers( 256 Function<com.commercetools.api.models.message.UserProvidedIdentifiersBuilder, com.commercetools.api.models.message.UserProvidedIdentifiers> builder) { 257 this.resourceUserProvidedIdentifiers = builder 258 .apply(com.commercetools.api.models.message.UserProvidedIdentifiersBuilder.of()); 259 return this; 260 } 261 262 /** 263 * <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> 264 * @param resourceUserProvidedIdentifiers value to be set 265 * @return Builder 266 */ 267 268 public ReviewStateTransitionMessageBuilder resourceUserProvidedIdentifiers( 269 @Nullable final com.commercetools.api.models.message.UserProvidedIdentifiers resourceUserProvidedIdentifiers) { 270 this.resourceUserProvidedIdentifiers = resourceUserProvidedIdentifiers; 271 return this; 272 } 273 274 /** 275 * <p>State of the Review before the Transition State update action.</p> 276 * @param builder function to build the oldState value 277 * @return Builder 278 */ 279 280 public ReviewStateTransitionMessageBuilder oldState( 281 Function<com.commercetools.api.models.state.StateReferenceBuilder, com.commercetools.api.models.state.StateReferenceBuilder> builder) { 282 this.oldState = builder.apply(com.commercetools.api.models.state.StateReferenceBuilder.of()).build(); 283 return this; 284 } 285 286 /** 287 * <p>State of the Review before the Transition State update action.</p> 288 * @param builder function to build the oldState value 289 * @return Builder 290 */ 291 292 public ReviewStateTransitionMessageBuilder withOldState( 293 Function<com.commercetools.api.models.state.StateReferenceBuilder, com.commercetools.api.models.state.StateReference> builder) { 294 this.oldState = builder.apply(com.commercetools.api.models.state.StateReferenceBuilder.of()); 295 return this; 296 } 297 298 /** 299 * <p>State of the Review before the Transition State update action.</p> 300 * @param oldState value to be set 301 * @return Builder 302 */ 303 304 public ReviewStateTransitionMessageBuilder oldState( 305 @Nullable final com.commercetools.api.models.state.StateReference oldState) { 306 this.oldState = oldState; 307 return this; 308 } 309 310 /** 311 * <p>State of the Review after the Transition State update action.</p> 312 * @param builder function to build the newState value 313 * @return Builder 314 */ 315 316 public ReviewStateTransitionMessageBuilder newState( 317 Function<com.commercetools.api.models.state.StateReferenceBuilder, com.commercetools.api.models.state.StateReferenceBuilder> builder) { 318 this.newState = builder.apply(com.commercetools.api.models.state.StateReferenceBuilder.of()).build(); 319 return this; 320 } 321 322 /** 323 * <p>State of the Review after the Transition State update action.</p> 324 * @param builder function to build the newState value 325 * @return Builder 326 */ 327 328 public ReviewStateTransitionMessageBuilder withNewState( 329 Function<com.commercetools.api.models.state.StateReferenceBuilder, com.commercetools.api.models.state.StateReference> builder) { 330 this.newState = builder.apply(com.commercetools.api.models.state.StateReferenceBuilder.of()); 331 return this; 332 } 333 334 /** 335 * <p>State of the Review after the Transition State update action.</p> 336 * @param newState value to be set 337 * @return Builder 338 */ 339 340 public ReviewStateTransitionMessageBuilder newState( 341 final com.commercetools.api.models.state.StateReference newState) { 342 this.newState = newState; 343 return this; 344 } 345 346 /** 347 * <p>Whether the old Review was taken into account in the rating statistics of the target before the state transition.</p> 348 * @param oldIncludedInStatistics value to be set 349 * @return Builder 350 */ 351 352 public ReviewStateTransitionMessageBuilder oldIncludedInStatistics(final Boolean oldIncludedInStatistics) { 353 this.oldIncludedInStatistics = oldIncludedInStatistics; 354 return this; 355 } 356 357 /** 358 * <p>Whether the new Review was taken into account in the rating statistics of the target after the state transition.</p> 359 * @param newIncludedInStatistics value to be set 360 * @return Builder 361 */ 362 363 public ReviewStateTransitionMessageBuilder newIncludedInStatistics(final Boolean newIncludedInStatistics) { 364 this.newIncludedInStatistics = newIncludedInStatistics; 365 return this; 366 } 367 368 /** 369 * <p>Reference to the resource that the Review belongs to.</p> 370 * @param target value to be set 371 * @return Builder 372 */ 373 374 public ReviewStateTransitionMessageBuilder target( 375 @Nullable final com.commercetools.api.models.common.Reference target) { 376 this.target = target; 377 return this; 378 } 379 380 /** 381 * <p>Reference to the resource that the Review belongs to.</p> 382 * @param builder function to build the target value 383 * @return Builder 384 */ 385 386 public ReviewStateTransitionMessageBuilder target( 387 Function<com.commercetools.api.models.common.ReferenceBuilder, Builder<? extends com.commercetools.api.models.common.Reference>> builder) { 388 this.target = builder.apply(com.commercetools.api.models.common.ReferenceBuilder.of()).build(); 389 return this; 390 } 391 392 /** 393 * <p>Whether State transition validations were turned off during the Transition State update action.</p> 394 * @param force value to be set 395 * @return Builder 396 */ 397 398 public ReviewStateTransitionMessageBuilder force(final Boolean force) { 399 this.force = force; 400 return this; 401 } 402 403 /** 404 * <p>Unique identifier of the Message. Can be used to track which Messages have been processed.</p> 405 * @return id 406 */ 407 408 public String getId() { 409 return this.id; 410 } 411 412 /** 413 * <p>Version of a resource. In case of Messages, this is always <code>1</code>.</p> 414 * @return version 415 */ 416 417 public Long getVersion() { 418 return this.version; 419 } 420 421 /** 422 * <p>Date and time (UTC) the Message was generated.</p> 423 * @return createdAt 424 */ 425 426 public java.time.ZonedDateTime getCreatedAt() { 427 return this.createdAt; 428 } 429 430 /** 431 * <p>Value of <code>createdAt</code>.</p> 432 * @return lastModifiedAt 433 */ 434 435 public java.time.ZonedDateTime getLastModifiedAt() { 436 return this.lastModifiedAt; 437 } 438 439 /** 440 * <p>Value of <code>createdBy</code>.</p> 441 * @return lastModifiedBy 442 */ 443 444 @Nullable 445 public com.commercetools.api.models.common.LastModifiedBy getLastModifiedBy() { 446 return this.lastModifiedBy; 447 } 448 449 /** 450 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 451 * @return createdBy 452 */ 453 454 @Nullable 455 public com.commercetools.api.models.common.CreatedBy getCreatedBy() { 456 return this.createdBy; 457 } 458 459 /** 460 * <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> 461 * @return sequenceNumber 462 */ 463 464 public Long getSequenceNumber() { 465 return this.sequenceNumber; 466 } 467 468 /** 469 * <p>Reference to the resource on which the change or action was performed.</p> 470 * @return resource 471 */ 472 473 public com.commercetools.api.models.common.Reference getResource() { 474 return this.resource; 475 } 476 477 /** 478 * <p>Version of the resource on which the change or action was performed.</p> 479 * @return resourceVersion 480 */ 481 482 public Long getResourceVersion() { 483 return this.resourceVersion; 484 } 485 486 /** 487 * <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> 488 * @return resourceUserProvidedIdentifiers 489 */ 490 491 @Nullable 492 public com.commercetools.api.models.message.UserProvidedIdentifiers getResourceUserProvidedIdentifiers() { 493 return this.resourceUserProvidedIdentifiers; 494 } 495 496 /** 497 * <p>State of the Review before the Transition State update action.</p> 498 * @return oldState 499 */ 500 501 @Nullable 502 public com.commercetools.api.models.state.StateReference getOldState() { 503 return this.oldState; 504 } 505 506 /** 507 * <p>State of the Review after the Transition State update action.</p> 508 * @return newState 509 */ 510 511 public com.commercetools.api.models.state.StateReference getNewState() { 512 return this.newState; 513 } 514 515 /** 516 * <p>Whether the old Review was taken into account in the rating statistics of the target before the state transition.</p> 517 * @return oldIncludedInStatistics 518 */ 519 520 public Boolean getOldIncludedInStatistics() { 521 return this.oldIncludedInStatistics; 522 } 523 524 /** 525 * <p>Whether the new Review was taken into account in the rating statistics of the target after the state transition.</p> 526 * @return newIncludedInStatistics 527 */ 528 529 public Boolean getNewIncludedInStatistics() { 530 return this.newIncludedInStatistics; 531 } 532 533 /** 534 * <p>Reference to the resource that the Review belongs to.</p> 535 * @return target 536 */ 537 538 @Nullable 539 public com.commercetools.api.models.common.Reference getTarget() { 540 return this.target; 541 } 542 543 /** 544 * <p>Whether State transition validations were turned off during the Transition State update action.</p> 545 * @return force 546 */ 547 548 public Boolean getForce() { 549 return this.force; 550 } 551 552 /** 553 * builds ReviewStateTransitionMessage with checking for non-null required values 554 * @return ReviewStateTransitionMessage 555 */ 556 public ReviewStateTransitionMessage build() { 557 Objects.requireNonNull(id, ReviewStateTransitionMessage.class + ": id is missing"); 558 Objects.requireNonNull(version, ReviewStateTransitionMessage.class + ": version is missing"); 559 Objects.requireNonNull(createdAt, ReviewStateTransitionMessage.class + ": createdAt is missing"); 560 Objects.requireNonNull(lastModifiedAt, ReviewStateTransitionMessage.class + ": lastModifiedAt is missing"); 561 Objects.requireNonNull(sequenceNumber, ReviewStateTransitionMessage.class + ": sequenceNumber is missing"); 562 Objects.requireNonNull(resource, ReviewStateTransitionMessage.class + ": resource is missing"); 563 Objects.requireNonNull(resourceVersion, ReviewStateTransitionMessage.class + ": resourceVersion is missing"); 564 Objects.requireNonNull(newState, ReviewStateTransitionMessage.class + ": newState is missing"); 565 Objects.requireNonNull(oldIncludedInStatistics, 566 ReviewStateTransitionMessage.class + ": oldIncludedInStatistics is missing"); 567 Objects.requireNonNull(newIncludedInStatistics, 568 ReviewStateTransitionMessage.class + ": newIncludedInStatistics is missing"); 569 Objects.requireNonNull(force, ReviewStateTransitionMessage.class + ": force is missing"); 570 return new ReviewStateTransitionMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy, 571 sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, oldState, newState, 572 oldIncludedInStatistics, newIncludedInStatistics, target, force); 573 } 574 575 /** 576 * builds ReviewStateTransitionMessage without checking for non-null required values 577 * @return ReviewStateTransitionMessage 578 */ 579 public ReviewStateTransitionMessage buildUnchecked() { 580 return new ReviewStateTransitionMessageImpl(id, version, createdAt, lastModifiedAt, lastModifiedBy, createdBy, 581 sequenceNumber, resource, resourceVersion, resourceUserProvidedIdentifiers, oldState, newState, 582 oldIncludedInStatistics, newIncludedInStatistics, target, force); 583 } 584 585 /** 586 * factory method for an instance of ReviewStateTransitionMessageBuilder 587 * @return builder 588 */ 589 public static ReviewStateTransitionMessageBuilder of() { 590 return new ReviewStateTransitionMessageBuilder(); 591 } 592 593 /** 594 * create builder for ReviewStateTransitionMessage instance 595 * @param template instance with prefilled values for the builder 596 * @return builder 597 */ 598 public static ReviewStateTransitionMessageBuilder of(final ReviewStateTransitionMessage template) { 599 ReviewStateTransitionMessageBuilder builder = new ReviewStateTransitionMessageBuilder(); 600 builder.id = template.getId(); 601 builder.version = template.getVersion(); 602 builder.createdAt = template.getCreatedAt(); 603 builder.lastModifiedAt = template.getLastModifiedAt(); 604 builder.lastModifiedBy = template.getLastModifiedBy(); 605 builder.createdBy = template.getCreatedBy(); 606 builder.sequenceNumber = template.getSequenceNumber(); 607 builder.resource = template.getResource(); 608 builder.resourceVersion = template.getResourceVersion(); 609 builder.resourceUserProvidedIdentifiers = template.getResourceUserProvidedIdentifiers(); 610 builder.oldState = template.getOldState(); 611 builder.newState = template.getNewState(); 612 builder.oldIncludedInStatistics = template.getOldIncludedInStatistics(); 613 builder.newIncludedInStatistics = template.getNewIncludedInStatistics(); 614 builder.target = template.getTarget(); 615 builder.force = template.getForce(); 616 return builder; 617 } 618 619}