001 002package com.commercetools.importapi.models.orders; 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 * OrderImportBuilder 014 * <hr> 015 * Example to create an instance using the builder pattern 016 * <div class=code-example> 017 * <pre><code class='java'> 018 * OrderImport orderImport = OrderImport.builder() 019 * .orderNumber("{orderNumber}") 020 * .totalPrice(totalPriceBuilder -> totalPriceBuilder) 021 * .build() 022 * </code></pre> 023 * </div> 024 */ 025@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 026public class OrderImportBuilder implements Builder<OrderImport> { 027 028 private String orderNumber; 029 030 @Nullable 031 private com.commercetools.importapi.models.common.CustomerKeyReference customer; 032 033 @Nullable 034 private String customerEmail; 035 036 @Nullable 037 private java.util.List<com.commercetools.importapi.models.orders.LineItemImportDraft> lineItems; 038 039 @Nullable 040 private java.util.List<com.commercetools.importapi.models.orders.CustomLineItemDraft> customLineItems; 041 042 private com.commercetools.importapi.models.common.TypedMoney totalPrice; 043 044 @Nullable 045 private com.commercetools.importapi.models.orders.TaxedPrice taxedPrice; 046 047 @Nullable 048 private com.commercetools.importapi.models.common.Address shippingAddress; 049 050 @Nullable 051 private com.commercetools.importapi.models.common.Address billingAddress; 052 053 @Nullable 054 private com.commercetools.importapi.models.common.CustomerGroupKeyReference customerGroup; 055 056 @Nullable 057 private String country; 058 059 @Nullable 060 private com.commercetools.importapi.models.orders.OrderState orderState; 061 062 @Nullable 063 private com.commercetools.importapi.models.orders.ShipmentState shipmentState; 064 065 @Nullable 066 private com.commercetools.importapi.models.orders.PaymentState paymentState; 067 068 @Nullable 069 private com.commercetools.importapi.models.orders.ShippingInfoImportDraft shippingInfo; 070 071 @Nullable 072 private java.time.ZonedDateTime completedAt; 073 074 @Nullable 075 private com.commercetools.importapi.models.customfields.Custom custom; 076 077 @Nullable 078 private com.commercetools.importapi.models.orders.InventoryMode inventoryMode; 079 080 @Nullable 081 private com.commercetools.importapi.models.orders.RoundingMode taxRoundingMode; 082 083 @Nullable 084 private com.commercetools.importapi.models.orders.TaxCalculationMode taxCalculationMode; 085 086 @Nullable 087 private com.commercetools.importapi.models.orders.CartOrigin origin; 088 089 @Nullable 090 private java.util.List<com.commercetools.importapi.models.common.Address> itemShippingAddresses; 091 092 @Nullable 093 private com.commercetools.importapi.models.common.StoreKeyReference store; 094 095 @Nullable 096 private com.commercetools.importapi.models.common.StateKeyReference state; 097 098 /** 099 * <p>Maps to <code>Order.orderNumber</code>, String that uniquely identifies an order. It should be unique across a project. Once it's set it cannot be changed.</p> 100 * @param orderNumber value to be set 101 * @return Builder 102 */ 103 104 public OrderImportBuilder orderNumber(final String orderNumber) { 105 this.orderNumber = orderNumber; 106 return this; 107 } 108 109 /** 110 * set the value to the customer using the builder function 111 * @param builder function to build the customer value 112 * @return Builder 113 */ 114 115 public OrderImportBuilder customer( 116 Function<com.commercetools.importapi.models.common.CustomerKeyReferenceBuilder, com.commercetools.importapi.models.common.CustomerKeyReferenceBuilder> builder) { 117 this.customer = builder.apply(com.commercetools.importapi.models.common.CustomerKeyReferenceBuilder.of()) 118 .build(); 119 return this; 120 } 121 122 /** 123 * set the value to the customer using the builder function 124 * @param builder function to build the customer value 125 * @return Builder 126 */ 127 128 public OrderImportBuilder withCustomer( 129 Function<com.commercetools.importapi.models.common.CustomerKeyReferenceBuilder, com.commercetools.importapi.models.common.CustomerKeyReference> builder) { 130 this.customer = builder.apply(com.commercetools.importapi.models.common.CustomerKeyReferenceBuilder.of()); 131 return this; 132 } 133 134 /** 135 * set the value to the customer 136 * @param customer value to be set 137 * @return Builder 138 */ 139 140 public OrderImportBuilder customer( 141 @Nullable final com.commercetools.importapi.models.common.CustomerKeyReference customer) { 142 this.customer = customer; 143 return this; 144 } 145 146 /** 147 * <p>Maps to <code>Order.customerEmail</code>.</p> 148 * @param customerEmail value to be set 149 * @return Builder 150 */ 151 152 public OrderImportBuilder customerEmail(@Nullable final String customerEmail) { 153 this.customerEmail = customerEmail; 154 return this; 155 } 156 157 /** 158 * <p>Maps to <code>Order.lineItems</code>.</p> 159 * @param lineItems value to be set 160 * @return Builder 161 */ 162 163 public OrderImportBuilder lineItems( 164 @Nullable final com.commercetools.importapi.models.orders.LineItemImportDraft... lineItems) { 165 this.lineItems = new ArrayList<>(Arrays.asList(lineItems)); 166 return this; 167 } 168 169 /** 170 * <p>Maps to <code>Order.lineItems</code>.</p> 171 * @param lineItems value to be set 172 * @return Builder 173 */ 174 175 public OrderImportBuilder lineItems( 176 @Nullable final java.util.List<com.commercetools.importapi.models.orders.LineItemImportDraft> lineItems) { 177 this.lineItems = lineItems; 178 return this; 179 } 180 181 /** 182 * <p>Maps to <code>Order.lineItems</code>.</p> 183 * @param lineItems value to be set 184 * @return Builder 185 */ 186 187 public OrderImportBuilder plusLineItems( 188 @Nullable final com.commercetools.importapi.models.orders.LineItemImportDraft... lineItems) { 189 if (this.lineItems == null) { 190 this.lineItems = new ArrayList<>(); 191 } 192 this.lineItems.addAll(Arrays.asList(lineItems)); 193 return this; 194 } 195 196 /** 197 * <p>Maps to <code>Order.lineItems</code>.</p> 198 * @param builder function to build the lineItems value 199 * @return Builder 200 */ 201 202 public OrderImportBuilder plusLineItems( 203 Function<com.commercetools.importapi.models.orders.LineItemImportDraftBuilder, com.commercetools.importapi.models.orders.LineItemImportDraftBuilder> builder) { 204 if (this.lineItems == null) { 205 this.lineItems = new ArrayList<>(); 206 } 207 this.lineItems 208 .add(builder.apply(com.commercetools.importapi.models.orders.LineItemImportDraftBuilder.of()).build()); 209 return this; 210 } 211 212 /** 213 * <p>Maps to <code>Order.lineItems</code>.</p> 214 * @param builder function to build the lineItems value 215 * @return Builder 216 */ 217 218 public OrderImportBuilder withLineItems( 219 Function<com.commercetools.importapi.models.orders.LineItemImportDraftBuilder, com.commercetools.importapi.models.orders.LineItemImportDraftBuilder> builder) { 220 this.lineItems = new ArrayList<>(); 221 this.lineItems 222 .add(builder.apply(com.commercetools.importapi.models.orders.LineItemImportDraftBuilder.of()).build()); 223 return this; 224 } 225 226 /** 227 * <p>Maps to <code>Order.lineItems</code>.</p> 228 * @param builder function to build the lineItems value 229 * @return Builder 230 */ 231 232 public OrderImportBuilder addLineItems( 233 Function<com.commercetools.importapi.models.orders.LineItemImportDraftBuilder, com.commercetools.importapi.models.orders.LineItemImportDraft> builder) { 234 return plusLineItems(builder.apply(com.commercetools.importapi.models.orders.LineItemImportDraftBuilder.of())); 235 } 236 237 /** 238 * <p>Maps to <code>Order.lineItems</code>.</p> 239 * @param builder function to build the lineItems value 240 * @return Builder 241 */ 242 243 public OrderImportBuilder setLineItems( 244 Function<com.commercetools.importapi.models.orders.LineItemImportDraftBuilder, com.commercetools.importapi.models.orders.LineItemImportDraft> builder) { 245 return lineItems(builder.apply(com.commercetools.importapi.models.orders.LineItemImportDraftBuilder.of())); 246 } 247 248 /** 249 * <p>Maps to <code>Order.customLineItems</code></p> 250 * @param customLineItems value to be set 251 * @return Builder 252 */ 253 254 public OrderImportBuilder customLineItems( 255 @Nullable final com.commercetools.importapi.models.orders.CustomLineItemDraft... customLineItems) { 256 this.customLineItems = new ArrayList<>(Arrays.asList(customLineItems)); 257 return this; 258 } 259 260 /** 261 * <p>Maps to <code>Order.customLineItems</code></p> 262 * @param customLineItems value to be set 263 * @return Builder 264 */ 265 266 public OrderImportBuilder customLineItems( 267 @Nullable final java.util.List<com.commercetools.importapi.models.orders.CustomLineItemDraft> customLineItems) { 268 this.customLineItems = customLineItems; 269 return this; 270 } 271 272 /** 273 * <p>Maps to <code>Order.customLineItems</code></p> 274 * @param customLineItems value to be set 275 * @return Builder 276 */ 277 278 public OrderImportBuilder plusCustomLineItems( 279 @Nullable final com.commercetools.importapi.models.orders.CustomLineItemDraft... customLineItems) { 280 if (this.customLineItems == null) { 281 this.customLineItems = new ArrayList<>(); 282 } 283 this.customLineItems.addAll(Arrays.asList(customLineItems)); 284 return this; 285 } 286 287 /** 288 * <p>Maps to <code>Order.customLineItems</code></p> 289 * @param builder function to build the customLineItems value 290 * @return Builder 291 */ 292 293 public OrderImportBuilder plusCustomLineItems( 294 Function<com.commercetools.importapi.models.orders.CustomLineItemDraftBuilder, com.commercetools.importapi.models.orders.CustomLineItemDraftBuilder> builder) { 295 if (this.customLineItems == null) { 296 this.customLineItems = new ArrayList<>(); 297 } 298 this.customLineItems 299 .add(builder.apply(com.commercetools.importapi.models.orders.CustomLineItemDraftBuilder.of()).build()); 300 return this; 301 } 302 303 /** 304 * <p>Maps to <code>Order.customLineItems</code></p> 305 * @param builder function to build the customLineItems value 306 * @return Builder 307 */ 308 309 public OrderImportBuilder withCustomLineItems( 310 Function<com.commercetools.importapi.models.orders.CustomLineItemDraftBuilder, com.commercetools.importapi.models.orders.CustomLineItemDraftBuilder> builder) { 311 this.customLineItems = new ArrayList<>(); 312 this.customLineItems 313 .add(builder.apply(com.commercetools.importapi.models.orders.CustomLineItemDraftBuilder.of()).build()); 314 return this; 315 } 316 317 /** 318 * <p>Maps to <code>Order.customLineItems</code></p> 319 * @param builder function to build the customLineItems value 320 * @return Builder 321 */ 322 323 public OrderImportBuilder addCustomLineItems( 324 Function<com.commercetools.importapi.models.orders.CustomLineItemDraftBuilder, com.commercetools.importapi.models.orders.CustomLineItemDraft> builder) { 325 return plusCustomLineItems( 326 builder.apply(com.commercetools.importapi.models.orders.CustomLineItemDraftBuilder.of())); 327 } 328 329 /** 330 * <p>Maps to <code>Order.customLineItems</code></p> 331 * @param builder function to build the customLineItems value 332 * @return Builder 333 */ 334 335 public OrderImportBuilder setCustomLineItems( 336 Function<com.commercetools.importapi.models.orders.CustomLineItemDraftBuilder, com.commercetools.importapi.models.orders.CustomLineItemDraft> builder) { 337 return customLineItems( 338 builder.apply(com.commercetools.importapi.models.orders.CustomLineItemDraftBuilder.of())); 339 } 340 341 /** 342 * <p>Maps to <code>Order.totalPrice</code>.</p> 343 * @param totalPrice value to be set 344 * @return Builder 345 */ 346 347 public OrderImportBuilder totalPrice(final com.commercetools.importapi.models.common.TypedMoney totalPrice) { 348 this.totalPrice = totalPrice; 349 return this; 350 } 351 352 /** 353 * <p>Maps to <code>Order.totalPrice</code>.</p> 354 * @param builder function to build the totalPrice value 355 * @return Builder 356 */ 357 358 public OrderImportBuilder totalPrice( 359 Function<com.commercetools.importapi.models.common.TypedMoneyBuilder, Builder<? extends com.commercetools.importapi.models.common.TypedMoney>> builder) { 360 this.totalPrice = builder.apply(com.commercetools.importapi.models.common.TypedMoneyBuilder.of()).build(); 361 return this; 362 } 363 364 /** 365 * <p>Maps to <code>Order.taxedPrice</code>.</p> 366 * @param builder function to build the taxedPrice value 367 * @return Builder 368 */ 369 370 public OrderImportBuilder taxedPrice( 371 Function<com.commercetools.importapi.models.orders.TaxedPriceBuilder, com.commercetools.importapi.models.orders.TaxedPriceBuilder> builder) { 372 this.taxedPrice = builder.apply(com.commercetools.importapi.models.orders.TaxedPriceBuilder.of()).build(); 373 return this; 374 } 375 376 /** 377 * <p>Maps to <code>Order.taxedPrice</code>.</p> 378 * @param builder function to build the taxedPrice value 379 * @return Builder 380 */ 381 382 public OrderImportBuilder withTaxedPrice( 383 Function<com.commercetools.importapi.models.orders.TaxedPriceBuilder, com.commercetools.importapi.models.orders.TaxedPrice> builder) { 384 this.taxedPrice = builder.apply(com.commercetools.importapi.models.orders.TaxedPriceBuilder.of()); 385 return this; 386 } 387 388 /** 389 * <p>Maps to <code>Order.taxedPrice</code>.</p> 390 * @param taxedPrice value to be set 391 * @return Builder 392 */ 393 394 public OrderImportBuilder taxedPrice( 395 @Nullable final com.commercetools.importapi.models.orders.TaxedPrice taxedPrice) { 396 this.taxedPrice = taxedPrice; 397 return this; 398 } 399 400 /** 401 * <p>Maps to <code>Order.shippingAddress</code>.</p> 402 * @param builder function to build the shippingAddress value 403 * @return Builder 404 */ 405 406 public OrderImportBuilder shippingAddress( 407 Function<com.commercetools.importapi.models.common.AddressBuilder, com.commercetools.importapi.models.common.AddressBuilder> builder) { 408 this.shippingAddress = builder.apply(com.commercetools.importapi.models.common.AddressBuilder.of()).build(); 409 return this; 410 } 411 412 /** 413 * <p>Maps to <code>Order.shippingAddress</code>.</p> 414 * @param builder function to build the shippingAddress value 415 * @return Builder 416 */ 417 418 public OrderImportBuilder withShippingAddress( 419 Function<com.commercetools.importapi.models.common.AddressBuilder, com.commercetools.importapi.models.common.Address> builder) { 420 this.shippingAddress = builder.apply(com.commercetools.importapi.models.common.AddressBuilder.of()); 421 return this; 422 } 423 424 /** 425 * <p>Maps to <code>Order.shippingAddress</code>.</p> 426 * @param shippingAddress value to be set 427 * @return Builder 428 */ 429 430 public OrderImportBuilder shippingAddress( 431 @Nullable final com.commercetools.importapi.models.common.Address shippingAddress) { 432 this.shippingAddress = shippingAddress; 433 return this; 434 } 435 436 /** 437 * <p>Maps to <code>Order.billingAddress</code>.</p> 438 * @param builder function to build the billingAddress value 439 * @return Builder 440 */ 441 442 public OrderImportBuilder billingAddress( 443 Function<com.commercetools.importapi.models.common.AddressBuilder, com.commercetools.importapi.models.common.AddressBuilder> builder) { 444 this.billingAddress = builder.apply(com.commercetools.importapi.models.common.AddressBuilder.of()).build(); 445 return this; 446 } 447 448 /** 449 * <p>Maps to <code>Order.billingAddress</code>.</p> 450 * @param builder function to build the billingAddress value 451 * @return Builder 452 */ 453 454 public OrderImportBuilder withBillingAddress( 455 Function<com.commercetools.importapi.models.common.AddressBuilder, com.commercetools.importapi.models.common.Address> builder) { 456 this.billingAddress = builder.apply(com.commercetools.importapi.models.common.AddressBuilder.of()); 457 return this; 458 } 459 460 /** 461 * <p>Maps to <code>Order.billingAddress</code>.</p> 462 * @param billingAddress value to be set 463 * @return Builder 464 */ 465 466 public OrderImportBuilder billingAddress( 467 @Nullable final com.commercetools.importapi.models.common.Address billingAddress) { 468 this.billingAddress = billingAddress; 469 return this; 470 } 471 472 /** 473 * <p>Maps to <code>Order.customerGroup</code>.</p> 474 * @param builder function to build the customerGroup value 475 * @return Builder 476 */ 477 478 public OrderImportBuilder customerGroup( 479 Function<com.commercetools.importapi.models.common.CustomerGroupKeyReferenceBuilder, com.commercetools.importapi.models.common.CustomerGroupKeyReferenceBuilder> builder) { 480 this.customerGroup = builder 481 .apply(com.commercetools.importapi.models.common.CustomerGroupKeyReferenceBuilder.of()) 482 .build(); 483 return this; 484 } 485 486 /** 487 * <p>Maps to <code>Order.customerGroup</code>.</p> 488 * @param builder function to build the customerGroup value 489 * @return Builder 490 */ 491 492 public OrderImportBuilder withCustomerGroup( 493 Function<com.commercetools.importapi.models.common.CustomerGroupKeyReferenceBuilder, com.commercetools.importapi.models.common.CustomerGroupKeyReference> builder) { 494 this.customerGroup = builder 495 .apply(com.commercetools.importapi.models.common.CustomerGroupKeyReferenceBuilder.of()); 496 return this; 497 } 498 499 /** 500 * <p>Maps to <code>Order.customerGroup</code>.</p> 501 * @param customerGroup value to be set 502 * @return Builder 503 */ 504 505 public OrderImportBuilder customerGroup( 506 @Nullable final com.commercetools.importapi.models.common.CustomerGroupKeyReference customerGroup) { 507 this.customerGroup = customerGroup; 508 return this; 509 } 510 511 /** 512 * <p>Maps to <code>Order.country</code>.</p> 513 * @param country value to be set 514 * @return Builder 515 */ 516 517 public OrderImportBuilder country(@Nullable final String country) { 518 this.country = country; 519 return this; 520 } 521 522 /** 523 * <p>Maps to <code>Order.orderState</code>.</p> 524 * @param orderState value to be set 525 * @return Builder 526 */ 527 528 public OrderImportBuilder orderState( 529 @Nullable final com.commercetools.importapi.models.orders.OrderState orderState) { 530 this.orderState = orderState; 531 return this; 532 } 533 534 /** 535 * <p>Maps to <code>Order.shipmentState</code>.</p> 536 * @param shipmentState value to be set 537 * @return Builder 538 */ 539 540 public OrderImportBuilder shipmentState( 541 @Nullable final com.commercetools.importapi.models.orders.ShipmentState shipmentState) { 542 this.shipmentState = shipmentState; 543 return this; 544 } 545 546 /** 547 * <p>Maps to <code>Order.paymentState</code>.</p> 548 * @param paymentState value to be set 549 * @return Builder 550 */ 551 552 public OrderImportBuilder paymentState( 553 @Nullable final com.commercetools.importapi.models.orders.PaymentState paymentState) { 554 this.paymentState = paymentState; 555 return this; 556 } 557 558 /** 559 * <p>Maps to <code>Order.shippingInfo</code>.</p> 560 * @param builder function to build the shippingInfo value 561 * @return Builder 562 */ 563 564 public OrderImportBuilder shippingInfo( 565 Function<com.commercetools.importapi.models.orders.ShippingInfoImportDraftBuilder, com.commercetools.importapi.models.orders.ShippingInfoImportDraftBuilder> builder) { 566 this.shippingInfo = builder.apply(com.commercetools.importapi.models.orders.ShippingInfoImportDraftBuilder.of()) 567 .build(); 568 return this; 569 } 570 571 /** 572 * <p>Maps to <code>Order.shippingInfo</code>.</p> 573 * @param builder function to build the shippingInfo value 574 * @return Builder 575 */ 576 577 public OrderImportBuilder withShippingInfo( 578 Function<com.commercetools.importapi.models.orders.ShippingInfoImportDraftBuilder, com.commercetools.importapi.models.orders.ShippingInfoImportDraft> builder) { 579 this.shippingInfo = builder 580 .apply(com.commercetools.importapi.models.orders.ShippingInfoImportDraftBuilder.of()); 581 return this; 582 } 583 584 /** 585 * <p>Maps to <code>Order.shippingInfo</code>.</p> 586 * @param shippingInfo value to be set 587 * @return Builder 588 */ 589 590 public OrderImportBuilder shippingInfo( 591 @Nullable final com.commercetools.importapi.models.orders.ShippingInfoImportDraft shippingInfo) { 592 this.shippingInfo = shippingInfo; 593 return this; 594 } 595 596 /** 597 * <p>Maps to <code>Order.completedAt</code>.</p> 598 * @param completedAt value to be set 599 * @return Builder 600 */ 601 602 public OrderImportBuilder completedAt(@Nullable final java.time.ZonedDateTime completedAt) { 603 this.completedAt = completedAt; 604 return this; 605 } 606 607 /** 608 * <p>Maps to <code>Order.custom</code>.</p> 609 * @param builder function to build the custom value 610 * @return Builder 611 */ 612 613 public OrderImportBuilder custom( 614 Function<com.commercetools.importapi.models.customfields.CustomBuilder, com.commercetools.importapi.models.customfields.CustomBuilder> builder) { 615 this.custom = builder.apply(com.commercetools.importapi.models.customfields.CustomBuilder.of()).build(); 616 return this; 617 } 618 619 /** 620 * <p>Maps to <code>Order.custom</code>.</p> 621 * @param builder function to build the custom value 622 * @return Builder 623 */ 624 625 public OrderImportBuilder withCustom( 626 Function<com.commercetools.importapi.models.customfields.CustomBuilder, com.commercetools.importapi.models.customfields.Custom> builder) { 627 this.custom = builder.apply(com.commercetools.importapi.models.customfields.CustomBuilder.of()); 628 return this; 629 } 630 631 /** 632 * <p>Maps to <code>Order.custom</code>.</p> 633 * @param custom value to be set 634 * @return Builder 635 */ 636 637 public OrderImportBuilder custom(@Nullable final com.commercetools.importapi.models.customfields.Custom custom) { 638 this.custom = custom; 639 return this; 640 } 641 642 /** 643 * <p>Maps to <code>Order.inventoryMode</code>.</p> 644 * @param inventoryMode value to be set 645 * @return Builder 646 */ 647 648 public OrderImportBuilder inventoryMode( 649 @Nullable final com.commercetools.importapi.models.orders.InventoryMode inventoryMode) { 650 this.inventoryMode = inventoryMode; 651 return this; 652 } 653 654 /** 655 * <p>Maps to <code>Order.taxRoundingMode</code>.</p> 656 * @param taxRoundingMode value to be set 657 * @return Builder 658 */ 659 660 public OrderImportBuilder taxRoundingMode( 661 @Nullable final com.commercetools.importapi.models.orders.RoundingMode taxRoundingMode) { 662 this.taxRoundingMode = taxRoundingMode; 663 return this; 664 } 665 666 /** 667 * <p>Maps to <code>Order.taxCalculationMode</code>.</p> 668 * @param taxCalculationMode value to be set 669 * @return Builder 670 */ 671 672 public OrderImportBuilder taxCalculationMode( 673 @Nullable final com.commercetools.importapi.models.orders.TaxCalculationMode taxCalculationMode) { 674 this.taxCalculationMode = taxCalculationMode; 675 return this; 676 } 677 678 /** 679 * <p>Maps to <code>Order.origin</code>.</p> 680 * @param origin value to be set 681 * @return Builder 682 */ 683 684 public OrderImportBuilder origin(@Nullable final com.commercetools.importapi.models.orders.CartOrigin origin) { 685 this.origin = origin; 686 return this; 687 } 688 689 /** 690 * <p>Maps to <code>Order.itemShippingAddresses</code>.</p> 691 * @param itemShippingAddresses value to be set 692 * @return Builder 693 */ 694 695 public OrderImportBuilder itemShippingAddresses( 696 @Nullable final com.commercetools.importapi.models.common.Address... itemShippingAddresses) { 697 this.itemShippingAddresses = new ArrayList<>(Arrays.asList(itemShippingAddresses)); 698 return this; 699 } 700 701 /** 702 * <p>Maps to <code>Order.itemShippingAddresses</code>.</p> 703 * @param itemShippingAddresses value to be set 704 * @return Builder 705 */ 706 707 public OrderImportBuilder itemShippingAddresses( 708 @Nullable final java.util.List<com.commercetools.importapi.models.common.Address> itemShippingAddresses) { 709 this.itemShippingAddresses = itemShippingAddresses; 710 return this; 711 } 712 713 /** 714 * <p>Maps to <code>Order.itemShippingAddresses</code>.</p> 715 * @param itemShippingAddresses value to be set 716 * @return Builder 717 */ 718 719 public OrderImportBuilder plusItemShippingAddresses( 720 @Nullable final com.commercetools.importapi.models.common.Address... itemShippingAddresses) { 721 if (this.itemShippingAddresses == null) { 722 this.itemShippingAddresses = new ArrayList<>(); 723 } 724 this.itemShippingAddresses.addAll(Arrays.asList(itemShippingAddresses)); 725 return this; 726 } 727 728 /** 729 * <p>Maps to <code>Order.itemShippingAddresses</code>.</p> 730 * @param builder function to build the itemShippingAddresses value 731 * @return Builder 732 */ 733 734 public OrderImportBuilder plusItemShippingAddresses( 735 Function<com.commercetools.importapi.models.common.AddressBuilder, com.commercetools.importapi.models.common.AddressBuilder> builder) { 736 if (this.itemShippingAddresses == null) { 737 this.itemShippingAddresses = new ArrayList<>(); 738 } 739 this.itemShippingAddresses 740 .add(builder.apply(com.commercetools.importapi.models.common.AddressBuilder.of()).build()); 741 return this; 742 } 743 744 /** 745 * <p>Maps to <code>Order.itemShippingAddresses</code>.</p> 746 * @param builder function to build the itemShippingAddresses value 747 * @return Builder 748 */ 749 750 public OrderImportBuilder withItemShippingAddresses( 751 Function<com.commercetools.importapi.models.common.AddressBuilder, com.commercetools.importapi.models.common.AddressBuilder> builder) { 752 this.itemShippingAddresses = new ArrayList<>(); 753 this.itemShippingAddresses 754 .add(builder.apply(com.commercetools.importapi.models.common.AddressBuilder.of()).build()); 755 return this; 756 } 757 758 /** 759 * <p>Maps to <code>Order.itemShippingAddresses</code>.</p> 760 * @param builder function to build the itemShippingAddresses value 761 * @return Builder 762 */ 763 764 public OrderImportBuilder addItemShippingAddresses( 765 Function<com.commercetools.importapi.models.common.AddressBuilder, com.commercetools.importapi.models.common.Address> builder) { 766 return plusItemShippingAddresses(builder.apply(com.commercetools.importapi.models.common.AddressBuilder.of())); 767 } 768 769 /** 770 * <p>Maps to <code>Order.itemShippingAddresses</code>.</p> 771 * @param builder function to build the itemShippingAddresses value 772 * @return Builder 773 */ 774 775 public OrderImportBuilder setItemShippingAddresses( 776 Function<com.commercetools.importapi.models.common.AddressBuilder, com.commercetools.importapi.models.common.Address> builder) { 777 return itemShippingAddresses(builder.apply(com.commercetools.importapi.models.common.AddressBuilder.of())); 778 } 779 780 /** 781 * <p>Reference to the Store in which the Order is associated. If referenced Store does not exist, the <code>state</code> of the ImportOperation will be set to <code>unresolved</code> until the necessary Store exists.</p> 782 * @param builder function to build the store value 783 * @return Builder 784 */ 785 786 public OrderImportBuilder store( 787 Function<com.commercetools.importapi.models.common.StoreKeyReferenceBuilder, com.commercetools.importapi.models.common.StoreKeyReferenceBuilder> builder) { 788 this.store = builder.apply(com.commercetools.importapi.models.common.StoreKeyReferenceBuilder.of()).build(); 789 return this; 790 } 791 792 /** 793 * <p>Reference to the Store in which the Order is associated. If referenced Store does not exist, the <code>state</code> of the ImportOperation will be set to <code>unresolved</code> until the necessary Store exists.</p> 794 * @param builder function to build the store value 795 * @return Builder 796 */ 797 798 public OrderImportBuilder withStore( 799 Function<com.commercetools.importapi.models.common.StoreKeyReferenceBuilder, com.commercetools.importapi.models.common.StoreKeyReference> builder) { 800 this.store = builder.apply(com.commercetools.importapi.models.common.StoreKeyReferenceBuilder.of()); 801 return this; 802 } 803 804 /** 805 * <p>Reference to the Store in which the Order is associated. If referenced Store does not exist, the <code>state</code> of the ImportOperation will be set to <code>unresolved</code> until the necessary Store exists.</p> 806 * @param store value to be set 807 * @return Builder 808 */ 809 810 public OrderImportBuilder store(@Nullable final com.commercetools.importapi.models.common.StoreKeyReference store) { 811 this.store = store; 812 return this; 813 } 814 815 /** 816 * <p>Reference to a State in a custom workflow.</p> 817 * @param builder function to build the state value 818 * @return Builder 819 */ 820 821 public OrderImportBuilder state( 822 Function<com.commercetools.importapi.models.common.StateKeyReferenceBuilder, com.commercetools.importapi.models.common.StateKeyReferenceBuilder> builder) { 823 this.state = builder.apply(com.commercetools.importapi.models.common.StateKeyReferenceBuilder.of()).build(); 824 return this; 825 } 826 827 /** 828 * <p>Reference to a State in a custom workflow.</p> 829 * @param builder function to build the state value 830 * @return Builder 831 */ 832 833 public OrderImportBuilder withState( 834 Function<com.commercetools.importapi.models.common.StateKeyReferenceBuilder, com.commercetools.importapi.models.common.StateKeyReference> builder) { 835 this.state = builder.apply(com.commercetools.importapi.models.common.StateKeyReferenceBuilder.of()); 836 return this; 837 } 838 839 /** 840 * <p>Reference to a State in a custom workflow.</p> 841 * @param state value to be set 842 * @return Builder 843 */ 844 845 public OrderImportBuilder state(@Nullable final com.commercetools.importapi.models.common.StateKeyReference state) { 846 this.state = state; 847 return this; 848 } 849 850 /** 851 * <p>Maps to <code>Order.orderNumber</code>, String that uniquely identifies an order. It should be unique across a project. Once it's set it cannot be changed.</p> 852 * @return orderNumber 853 */ 854 855 public String getOrderNumber() { 856 return this.orderNumber; 857 } 858 859 /** 860 * value of customer} 861 * @return customer 862 */ 863 864 @Nullable 865 public com.commercetools.importapi.models.common.CustomerKeyReference getCustomer() { 866 return this.customer; 867 } 868 869 /** 870 * <p>Maps to <code>Order.customerEmail</code>.</p> 871 * @return customerEmail 872 */ 873 874 @Nullable 875 public String getCustomerEmail() { 876 return this.customerEmail; 877 } 878 879 /** 880 * <p>Maps to <code>Order.lineItems</code>.</p> 881 * @return lineItems 882 */ 883 884 @Nullable 885 public java.util.List<com.commercetools.importapi.models.orders.LineItemImportDraft> getLineItems() { 886 return this.lineItems; 887 } 888 889 /** 890 * <p>Maps to <code>Order.customLineItems</code></p> 891 * @return customLineItems 892 */ 893 894 @Nullable 895 public java.util.List<com.commercetools.importapi.models.orders.CustomLineItemDraft> getCustomLineItems() { 896 return this.customLineItems; 897 } 898 899 /** 900 * <p>Maps to <code>Order.totalPrice</code>.</p> 901 * @return totalPrice 902 */ 903 904 public com.commercetools.importapi.models.common.TypedMoney getTotalPrice() { 905 return this.totalPrice; 906 } 907 908 /** 909 * <p>Maps to <code>Order.taxedPrice</code>.</p> 910 * @return taxedPrice 911 */ 912 913 @Nullable 914 public com.commercetools.importapi.models.orders.TaxedPrice getTaxedPrice() { 915 return this.taxedPrice; 916 } 917 918 /** 919 * <p>Maps to <code>Order.shippingAddress</code>.</p> 920 * @return shippingAddress 921 */ 922 923 @Nullable 924 public com.commercetools.importapi.models.common.Address getShippingAddress() { 925 return this.shippingAddress; 926 } 927 928 /** 929 * <p>Maps to <code>Order.billingAddress</code>.</p> 930 * @return billingAddress 931 */ 932 933 @Nullable 934 public com.commercetools.importapi.models.common.Address getBillingAddress() { 935 return this.billingAddress; 936 } 937 938 /** 939 * <p>Maps to <code>Order.customerGroup</code>.</p> 940 * @return customerGroup 941 */ 942 943 @Nullable 944 public com.commercetools.importapi.models.common.CustomerGroupKeyReference getCustomerGroup() { 945 return this.customerGroup; 946 } 947 948 /** 949 * <p>Maps to <code>Order.country</code>.</p> 950 * @return country 951 */ 952 953 @Nullable 954 public String getCountry() { 955 return this.country; 956 } 957 958 /** 959 * <p>Maps to <code>Order.orderState</code>.</p> 960 * @return orderState 961 */ 962 963 @Nullable 964 public com.commercetools.importapi.models.orders.OrderState getOrderState() { 965 return this.orderState; 966 } 967 968 /** 969 * <p>Maps to <code>Order.shipmentState</code>.</p> 970 * @return shipmentState 971 */ 972 973 @Nullable 974 public com.commercetools.importapi.models.orders.ShipmentState getShipmentState() { 975 return this.shipmentState; 976 } 977 978 /** 979 * <p>Maps to <code>Order.paymentState</code>.</p> 980 * @return paymentState 981 */ 982 983 @Nullable 984 public com.commercetools.importapi.models.orders.PaymentState getPaymentState() { 985 return this.paymentState; 986 } 987 988 /** 989 * <p>Maps to <code>Order.shippingInfo</code>.</p> 990 * @return shippingInfo 991 */ 992 993 @Nullable 994 public com.commercetools.importapi.models.orders.ShippingInfoImportDraft getShippingInfo() { 995 return this.shippingInfo; 996 } 997 998 /** 999 * <p>Maps to <code>Order.completedAt</code>.</p> 1000 * @return completedAt 1001 */ 1002 1003 @Nullable 1004 public java.time.ZonedDateTime getCompletedAt() { 1005 return this.completedAt; 1006 } 1007 1008 /** 1009 * <p>Maps to <code>Order.custom</code>.</p> 1010 * @return custom 1011 */ 1012 1013 @Nullable 1014 public com.commercetools.importapi.models.customfields.Custom getCustom() { 1015 return this.custom; 1016 } 1017 1018 /** 1019 * <p>Maps to <code>Order.inventoryMode</code>.</p> 1020 * @return inventoryMode 1021 */ 1022 1023 @Nullable 1024 public com.commercetools.importapi.models.orders.InventoryMode getInventoryMode() { 1025 return this.inventoryMode; 1026 } 1027 1028 /** 1029 * <p>Maps to <code>Order.taxRoundingMode</code>.</p> 1030 * @return taxRoundingMode 1031 */ 1032 1033 @Nullable 1034 public com.commercetools.importapi.models.orders.RoundingMode getTaxRoundingMode() { 1035 return this.taxRoundingMode; 1036 } 1037 1038 /** 1039 * <p>Maps to <code>Order.taxCalculationMode</code>.</p> 1040 * @return taxCalculationMode 1041 */ 1042 1043 @Nullable 1044 public com.commercetools.importapi.models.orders.TaxCalculationMode getTaxCalculationMode() { 1045 return this.taxCalculationMode; 1046 } 1047 1048 /** 1049 * <p>Maps to <code>Order.origin</code>.</p> 1050 * @return origin 1051 */ 1052 1053 @Nullable 1054 public com.commercetools.importapi.models.orders.CartOrigin getOrigin() { 1055 return this.origin; 1056 } 1057 1058 /** 1059 * <p>Maps to <code>Order.itemShippingAddresses</code>.</p> 1060 * @return itemShippingAddresses 1061 */ 1062 1063 @Nullable 1064 public java.util.List<com.commercetools.importapi.models.common.Address> getItemShippingAddresses() { 1065 return this.itemShippingAddresses; 1066 } 1067 1068 /** 1069 * <p>Reference to the Store in which the Order is associated. If referenced Store does not exist, the <code>state</code> of the ImportOperation will be set to <code>unresolved</code> until the necessary Store exists.</p> 1070 * @return store 1071 */ 1072 1073 @Nullable 1074 public com.commercetools.importapi.models.common.StoreKeyReference getStore() { 1075 return this.store; 1076 } 1077 1078 /** 1079 * <p>Reference to a State in a custom workflow.</p> 1080 * @return state 1081 */ 1082 1083 @Nullable 1084 public com.commercetools.importapi.models.common.StateKeyReference getState() { 1085 return this.state; 1086 } 1087 1088 /** 1089 * builds OrderImport with checking for non-null required values 1090 * @return OrderImport 1091 */ 1092 public OrderImport build() { 1093 Objects.requireNonNull(orderNumber, OrderImport.class + ": orderNumber is missing"); 1094 Objects.requireNonNull(totalPrice, OrderImport.class + ": totalPrice is missing"); 1095 return new OrderImportImpl(orderNumber, customer, customerEmail, lineItems, customLineItems, totalPrice, 1096 taxedPrice, shippingAddress, billingAddress, customerGroup, country, orderState, shipmentState, 1097 paymentState, shippingInfo, completedAt, custom, inventoryMode, taxRoundingMode, taxCalculationMode, origin, 1098 itemShippingAddresses, store, state); 1099 } 1100 1101 /** 1102 * builds OrderImport without checking for non-null required values 1103 * @return OrderImport 1104 */ 1105 public OrderImport buildUnchecked() { 1106 return new OrderImportImpl(orderNumber, customer, customerEmail, lineItems, customLineItems, totalPrice, 1107 taxedPrice, shippingAddress, billingAddress, customerGroup, country, orderState, shipmentState, 1108 paymentState, shippingInfo, completedAt, custom, inventoryMode, taxRoundingMode, taxCalculationMode, origin, 1109 itemShippingAddresses, store, state); 1110 } 1111 1112 /** 1113 * factory method for an instance of OrderImportBuilder 1114 * @return builder 1115 */ 1116 public static OrderImportBuilder of() { 1117 return new OrderImportBuilder(); 1118 } 1119 1120 /** 1121 * create builder for OrderImport instance 1122 * @param template instance with prefilled values for the builder 1123 * @return builder 1124 */ 1125 public static OrderImportBuilder of(final OrderImport template) { 1126 OrderImportBuilder builder = new OrderImportBuilder(); 1127 builder.orderNumber = template.getOrderNumber(); 1128 builder.customer = template.getCustomer(); 1129 builder.customerEmail = template.getCustomerEmail(); 1130 builder.lineItems = template.getLineItems(); 1131 builder.customLineItems = template.getCustomLineItems(); 1132 builder.totalPrice = template.getTotalPrice(); 1133 builder.taxedPrice = template.getTaxedPrice(); 1134 builder.shippingAddress = template.getShippingAddress(); 1135 builder.billingAddress = template.getBillingAddress(); 1136 builder.customerGroup = template.getCustomerGroup(); 1137 builder.country = template.getCountry(); 1138 builder.orderState = template.getOrderState(); 1139 builder.shipmentState = template.getShipmentState(); 1140 builder.paymentState = template.getPaymentState(); 1141 builder.shippingInfo = template.getShippingInfo(); 1142 builder.completedAt = template.getCompletedAt(); 1143 builder.custom = template.getCustom(); 1144 builder.inventoryMode = template.getInventoryMode(); 1145 builder.taxRoundingMode = template.getTaxRoundingMode(); 1146 builder.taxCalculationMode = template.getTaxCalculationMode(); 1147 builder.origin = template.getOrigin(); 1148 builder.itemShippingAddresses = template.getItemShippingAddresses(); 1149 builder.store = template.getStore(); 1150 builder.state = template.getState(); 1151 return builder; 1152 } 1153 1154}