Skip to content

Commit

Permalink
Merge pull request #2191 from commercetools/jvm-maintainance
Browse files Browse the repository at this point in the history
Jvm sdk mantainance
  • Loading branch information
barbara79 authored Feb 7, 2022
2 parents 6092a7f + add81a4 commit 7e8853c
Show file tree
Hide file tree
Showing 81 changed files with 7,892 additions and 197 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,16 @@ jobs:
distribution: 'adopt'
java-version: '8'

- run: mvn clean install javadoc:aggregate -DskipTests --no-transfer-progress -Pjavadoc-jdk-8u121
- run: mvn clean install javadoc:aggregate -DskipTests --no-transfer-progress -Pjavadoc-jdk-8u121,third-party-licenses
- run: mvn exec:java -pl commercetools-internal-docs -Dexec.mainClass="introspection.rules.RulesMain" -Dexec.classpathScope="test"
- run: mvn exec:java -pl commercetools-models -Dexec.mainClass="io.sphere.sdk.client.MainMethodThreadLeakTest" -Dexec.classpathScope="test"
- run: mvn test verify --no-transfer-progress -Djava.util.logging.config.file=src/test/resources/logging.properties

- uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: 'licenses/*'
disable_globbing: true
commit_message: "Update licenses"
commit_user_name: Auto Mation
commit_user_email: [email protected]
commit_author: Auto Mation <[email protected]>
Binary file modified .mvn/wrapper/maven-wrapper.jar
100755 → 100644
Binary file not shown.
19 changes: 18 additions & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
import io.sphere.sdk.messages.UserProvidedIdentifiers;
import io.sphere.sdk.models.*;
import io.sphere.sdk.orders.*;
import io.sphere.sdk.orders.commands.updateactions.AddDelivery;
import io.sphere.sdk.orders.commands.updateactions.*;
import io.sphere.sdk.orders.expansion.OrderExpansionModel;
import io.sphere.sdk.orders.messages.OrderPaymentStateChangedMessage;
import io.sphere.sdk.orders.messages.OrderStateTransitionMessage;
Expand Down Expand Up @@ -115,10 +115,7 @@
import io.sphere.sdk.states.State;
import io.sphere.sdk.states.StateDraftDsl;
import io.sphere.sdk.stores.commands.updateactions.SetLanguages;
import io.sphere.sdk.subscriptions.AzureServiceBusDestination;
import io.sphere.sdk.subscriptions.MessageSubscriptionPayload;
import io.sphere.sdk.subscriptions.Payload;
import io.sphere.sdk.subscriptions.Subscription;
import io.sphere.sdk.subscriptions.*;
import io.sphere.sdk.taxcategories.*;
import io.sphere.sdk.types.*;
import io.sphere.sdk.zones.ZoneDraftBuilder;
Expand Down Expand Up @@ -157,9 +154,21 @@
</ul>
-->
-->
<h3 class=released-version id="v2_5_0">2.5.0 (01.12.2021)</h3>
<ul>
<h3 class=released-version id="v2_5_0">2.5.0 (01.03.2022)</h3>
<ul>
<li class=new-in-release>Support custom field in {@link Parcel} and {@link ParcelDraft} and added related update actions for Order and OrderEdit {@link SetParcelCustomField}, {@link SetParcelCustomType}, {@link SetParcelCustomType} and {@link SetParcelCustomField}</li>
<li class=new-in-release>Support custom field in {@link ReturnItem} and {@link ReturnItemDraft} and added related update actions for Order and OrderEdit {@link SetReturnItemCustomField}, {@link SetReturnItemCustomType}, {@link SetReturnItemCustomType} and {@link SetReturnItemCustomField}</li>
<li class=new-in-release>Support update commands for Custom Field and Type for Payment transactions {@link io.sphere.sdk.payments.commands.updateactions.SetTransactionCustomField} and {@link io.sphere.sdk.payments.commands.updateactions.SetTransactionCustomType} </li>
<li class=new-in-release>Support productKey in LineItem {@link LineItem#getProductKey()} </li>
<li class=new-in-release>Support for Cart the uodate action {@link SetLineItemSupplyChannel}</li>
<li class=new-in-release>Add new field for {@link UserProvidedIdentifiers#getContainerAndKey()} and related classes {@link ContainerAndKey} and {@link ContainerAndKeyImpl} </li>
<li class=new-in-release>Support {@link io.sphere.sdk.inventory.messages.InventoryEntryQuantitySetMessage} </li>
<li class=new-in-release>Support SetReturnInfo in order and order edit {@link io.sphere.sdk.orders.commands.updateactions.SetReturnInfo} and the related message {@link io.sphere.sdk.orders.messages.ReturnInfoSetMessage } </li>
<li class=fixed-in-release>Fixed serialization issue with duplicate type property in ShippingRateTier model</li>
<li class=new-in-release>Support order edit with the update action for {@link io.sphere.sdk.orderedits.commands.stagedactions.SetLineItemDistributionChannel} and related message {@link io.sphere.sdk.orders.messages.OrderLineItemDistributionChannelSetMessage} </li>
<li class=new-in-release>Add new field in the {@link ResourceDeletedPayload#getDataErasure()} </li>
<li class=new-in-release>Support new message for customer {@link io.sphere.sdk.customers.messages.CustomerDeletedMessage} </li>
<li class=new-in-release>Support localizedName field for ShippingMethod {@link ShippingMethod#getLocalizedName() and {@link ShippingMethodDraft#getLocalizedName()} and related action {@link io.sphere.sdk.shippingmethods.commands.updateactions.SetLocalizedName} </li>
</ul>
<h3 class=released-version id="v2_4_0">2.4.0 (01.11.2021)</h3>
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public interface LineItem extends LineItemLike {
@Nullable
ZonedDateTime getLastModifiedAt();

@Nullable
String getProductKey();

/**
* An identifier for this resource which supports {@link CustomFields}.
* @see TypeDraft#getResourceTypeIds()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ final class LineItemImpl extends LineItemImplBase {
@Nullable final Reference<Channel> distributionChannel, final String id,
final ZonedDateTime lastModifiedAt,
final LineItemMode lineItemMode, final LocalizedString name, final Price price,
final LineItemPriceMode priceMode, final String productId,
final LineItemPriceMode priceMode, final String productId, final String productKey,
@Nullable final LocalizedString productSlug,
@Nullable final Reference<ProductType> productType, final Long quantity,
@Nullable final ItemShippingDetails shippingDetails,
final Set<ItemState> state, @Nullable final Reference<Channel> supplyChannel,
@Nullable final TaxRate taxRate, @Nullable final TaxedItemPrice taxedPrice,
final MonetaryAmount totalPrice, final ObjectNode variant, final ZonedDateTime addedAt) {
super(addedAt, custom, discountedPricePerQuantity, distributionChannel, id, lastModifiedAt, lineItemMode, name, price, priceMode, productId, productSlug,
super(addedAt, custom, discountedPricePerQuantity, distributionChannel, id, lastModifiedAt, lineItemMode, name, price, priceMode, productId, productKey, productSlug,
productType, quantity, shippingDetails, state, supplyChannel, taxRate, taxedPrice, totalPrice, asVariant(variant, productId));

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package io.sphere.sdk.carts.commands.updateactions;

import io.sphere.sdk.carts.Cart;
import io.sphere.sdk.channels.Channel;
import io.sphere.sdk.commands.UpdateActionImpl;
import io.sphere.sdk.models.Reference;

import javax.annotation.Nullable;

/**
* Sets the supply channel of the given LineItem.
* The LineItem price is updated as described in LineItem Price selection.
*
* {@doc.gen intro}
*
* {@include.example io.sphere.sdk.carts.commands.CartUpdateCommandIntegrationTest}
*/
public final class SetLineItemSupplyChannel extends UpdateActionImpl<Cart> {

final private String lineItemId;
@Nullable
final private Reference<Channel> supplyChannel;

private SetLineItemSupplyChannel(final String lineItemId, @Nullable final Reference<Channel> supplyChannel) {
super("setLineItemSupplyChannel");
this.lineItemId = lineItemId;
this.supplyChannel = supplyChannel;
}

public static SetLineItemSupplyChannel of(final String lineItemId, @Nullable final Reference<Channel> supplyChannel) {
return new SetLineItemSupplyChannel(lineItemId, supplyChannel);
}

public String getLineItemId() {
return lineItemId;
}

@Nullable
public Reference<Channel> getSupplyChannel() {
return supplyChannel;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package io.sphere.sdk.customers.messages;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.sphere.sdk.customers.Customer;
import io.sphere.sdk.messages.GenericMessageImpl;
import io.sphere.sdk.messages.MessageDerivateHint;
import io.sphere.sdk.messages.UserProvidedIdentifiers;

import java.time.ZonedDateTime;

@JsonDeserialize(as = CustomerDeletedMessage.class)//important to override annotation in Message class
public final class CustomerDeletedMessage extends GenericMessageImpl<Customer> {
public static final String MESSAGE_TYPE = "CustomerDeleted";
public static final MessageDerivateHint<CustomerDeletedMessage> MESSAGE_HINT =
MessageDerivateHint.ofSingleMessageType(MESSAGE_TYPE, CustomerDeletedMessage.class, Customer.referenceTypeId());

private final Customer customer;

@JsonCreator
private CustomerDeletedMessage(final String id, final Long version, final ZonedDateTime createdAt, final ZonedDateTime lastModifiedAt, final JsonNode resource, final Long sequenceNumber, final Long resourceVersion, final String type, final UserProvidedIdentifiers resourceUserProvidedIdentifiers, final Customer customer) {
super(id, version, createdAt, lastModifiedAt, resource, sequenceNumber, resourceVersion, type,resourceUserProvidedIdentifiers, Customer.class);
this.customer = customer;
}

/**
* Gets the Customer at creation time
*
* @return the created Customer at creation time
*/
public Customer getCustomer() {
return customer;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package io.sphere.sdk.inventory.messages;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.sphere.sdk.channels.Channel;
import io.sphere.sdk.inventory.InventoryEntry;
import io.sphere.sdk.messages.GenericMessageImpl;
import io.sphere.sdk.messages.MessageDerivateHint;
import io.sphere.sdk.messages.UserProvidedIdentifiers;
import io.sphere.sdk.models.Reference;

import javax.annotation.Nullable;
import java.time.ZonedDateTime;

@JsonDeserialize(as = InventoryEntryQuantitySetMessage.class)//important to override annotation in Message class
public final class InventoryEntryQuantitySetMessage extends GenericMessageImpl<InventoryEntry> {
public static final String MESSAGE_TYPE = "InventoryEntryQuantitySet";
public static final MessageDerivateHint<InventoryEntryQuantitySetMessage> MESSAGE_HINT =
MessageDerivateHint.ofSingleMessageType(MESSAGE_TYPE, InventoryEntryQuantitySetMessage.class, InventoryEntry.referenceTypeId());

private final Long oldQuantityOnStock;
private final Long newQuantityOnStock;
private final Long oldAvailableQuantity;
private final Long newAvailableQuantity;
@Nullable
private final Reference<Channel> supplyChannel;

@JsonCreator
private InventoryEntryQuantitySetMessage(final String id, final Long version, final ZonedDateTime createdAt, final ZonedDateTime lastModifiedAt, final JsonNode resource, final Long sequenceNumber, final Long resourceVersion, final String type, final UserProvidedIdentifiers resourceUserProvidedIdentifiers, Long oldQuantityOnStock, Long newQuantityOnStock, Long oldAvailableQuantity, Long newAvailableQuantity, final Reference<Channel> supplyChannel) {
super(id, version, createdAt, lastModifiedAt, resource, sequenceNumber, resourceVersion, type,resourceUserProvidedIdentifiers, InventoryEntry.class);
this.oldQuantityOnStock = oldQuantityOnStock;
this.newQuantityOnStock = newQuantityOnStock;
this.oldAvailableQuantity = oldAvailableQuantity;
this.newAvailableQuantity = newAvailableQuantity;
this.supplyChannel = supplyChannel;
}

public Long getOldQuantityOnStock() {
return oldQuantityOnStock;
}

public Long getNewQuantityOnStock() {
return newQuantityOnStock;
}

public Long getOldAvailableQuantity() {
return oldAvailableQuantity;
}

public Long getNewAvailableQuantity() {
return newAvailableQuantity;
}

@Nullable
public Reference<Channel> getSupplyChannel() {
return supplyChannel;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.sphere.sdk.annotations.ResourceValue;
import io.sphere.sdk.models.ContainerAndKey;
import io.sphere.sdk.models.LocalizedString;
import io.sphere.sdk.models.WithKey;

Expand Down Expand Up @@ -31,4 +32,6 @@ public interface UserProvidedIdentifiers extends WithKey {
@Nullable
String getCustomerNumber();

@Nullable
ContainerAndKey getContainerAndKey();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package io.sphere.sdk.models;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

@JsonDeserialize(as= ContainerAndKeyImpl.class)
public interface ContainerAndKey {
String getContainer();
String getKey();

static ContainerAndKey of(final String container, final String key) {
return ContainerAndKeyImpl.of(container, key);
}

@JsonIgnore
static ContainerAndKey ofContainerAndKey(final String container, final String key) {
return of(container, key);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package io.sphere.sdk.models;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;

final class ContainerAndKeyImpl extends Base implements ContainerAndKey{
private final String container;
private final String key;

@JsonCreator
public ContainerAndKeyImpl(String container, String key) {
this.container = container;
this.key = key;
}

@JsonIgnore
public static ContainerAndKey of(final String container, final String key) {
return new ContainerAndKeyImpl(container, key);
}

@Override
public String getContainer() {
return container;
}

@Override
public String getKey() {
return key;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
@JsonSubTypes.Type(value = SetCustomLineItemTaxRate.class, name = "setCustomLineItemTaxRate"),
@JsonSubTypes.Type(value = ChangeCustomLineItemQuantity.class, name = "changeCustomLineItemQuantity"),
@JsonSubTypes.Type(value = ChangeCustomLineItemMoney.class, name = "changeCustomLineItemMoney"),
@JsonSubTypes.Type(value = SetShippingAddressAndCustomShippingMethod.class, name = "setShippingAddressAndCustomShippingMethod")
@JsonSubTypes.Type(value = SetShippingAddressAndCustomShippingMethod.class, name = "setShippingAddressAndCustomShippingMethod"),
@JsonSubTypes.Type(value = SetLineItemDistributionChannel.class, name = "setLineItemDistributionChannel")
})
public interface OrderEditStagedUpdateAction extends StagedUpdateAction<OrderEdit> {
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public final class SetLineItemCustomType extends OrderEditStagedUpdateActionBase
private final Map<String, JsonNode> fields;

private SetLineItemCustomType(final String lineItemId, @Nullable final String typeId, @Nullable final String typeKey, @Nullable final Map<String, JsonNode> fields) {
super("setCustomType");
super("setLineItemCustomType");
this.lineItemId = lineItemId;
this.type = ResourceIdentifier.ofIdOrKey(typeId, typeKey);
this.fields = fields;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package io.sphere.sdk.orderedits.commands.stagedactions;

import com.fasterxml.jackson.annotation.JsonCreator;
import io.sphere.sdk.channels.Channel;
import io.sphere.sdk.models.ResourceIdentifier;

import javax.annotation.Nullable;

public final class SetLineItemDistributionChannel extends OrderEditStagedUpdateActionBase {

private final String lineItemId;
@Nullable
private final ResourceIdentifier<Channel> distributionChannel;

@JsonCreator
private SetLineItemDistributionChannel(final String lineItemId, @Nullable final ResourceIdentifier<Channel> distributionChannel) {
super("setLineItemDistributionChannel");
this.lineItemId = lineItemId;
this.distributionChannel = distributionChannel;
}

public static SetLineItemDistributionChannel of(final String lineItemId) {
return new SetLineItemDistributionChannel(lineItemId, null);
}

public String getLineItemId() {
return lineItemId;
}

@Nullable
public ResourceIdentifier<Channel> getDistributionChannel() {
return distributionChannel;
}

public SetLineItemDistributionChannel withDistributionChannel(@Nullable final ResourceIdentifier<Channel> distributionChannel) {
return new SetLineItemDistributionChannel(getLineItemId(), distributionChannel);
}
}
Loading

0 comments on commit 7e8853c

Please sign in to comment.