All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.orders.commands.updateactions.UpdateSyncInfo Maven / Gradle / Ivy

There is a newer version: 1.0.0-M12
Show newest version
package io.sphere.sdk.orders.commands.updateactions;

import io.sphere.sdk.channels.Channel;
import io.sphere.sdk.commands.UpdateAction;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.models.Referenceable;
import io.sphere.sdk.orders.Order;

import java.time.Instant;
import java.util.Optional;

/**

 {@include.example io.sphere.sdk.orders.commands.OrderUpdateCommandTest#updateSyncInfo()}
 */
public class UpdateSyncInfo extends UpdateAction {
    private final Reference channel;
    private final Optional externalId;
    private final Optional syncedAt;


    private UpdateSyncInfo(final Reference channel, final Optional externalId, final Optional syncedAt) {
        super("updateSyncInfo");
        this.channel = channel;
        this.externalId = externalId;
        this.syncedAt = syncedAt;
    }

    public static UpdateSyncInfo of(final Referenceable channel) {
        return new UpdateSyncInfo(channel.toReference(), Optional.empty(), Optional.empty());
    }

    public UpdateSyncInfo withExternalId(final String externalId) {
        return new UpdateSyncInfo(channel, Optional.of(externalId), syncedAt);
    }

    public UpdateSyncInfo withSyncedAt(final Instant syncedAt) {
        return new UpdateSyncInfo(channel, externalId, Optional.of(syncedAt));
    }

    public Reference getChannel() {
        return channel;
    }

    public Optional getExternalId() {
        return externalId;
    }

    public Optional getSyncedAt() {
        return syncedAt;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy