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