private TransitionLineItemState(final String lineItemId, final Long quantity, final Referenceable<State> fromState, final Referenceable<State> toState, final ZonedDateTime actualTransitionDate) { super("transitionLineItemState", quantity, actualTransitionDate, toState.toReference(), fromState.toReference()); this.lineItemId = lineItemId; }
private CustomLineItemDraft(final LocalizedStrings name, final String slug, final MonetaryAmount money, final Referenceable<TaxCategory> taxCategory, final int quantity) { this.name = name; this.money = money; this.slug = slug; this.taxCategory = taxCategory.toReference(); this.quantity = quantity; }
private SetCustomShippingMethod(final String shippingMethodName, final ShippingRate shippingRate, final Referenceable<TaxCategory> taxCategory) { super("setCustomShippingMethod"); this.shippingMethodName = shippingMethodName; this.shippingRate = shippingRate; this.taxCategory = taxCategory.toReference(); }
private TransitionCustomLineItemState(final String customLineItemId, final Long quantity, final Referenceable<State> fromState, final Referenceable<State> toState, final ZonedDateTime actualTransitionDate) { super("transitionCustomLineItemState", quantity, actualTransitionDate, toState.toReference(), fromState.toReference()); this.customLineItemId = customLineItemId; }
private TransitionLineItemState(final String lineItemId, final Long quantity, final Referenceable<State> fromState, final Referenceable<State> toState, final ZonedDateTime actualTransitionDate) { super("transitionLineItemState", quantity, actualTransitionDate, toState.toReference(), fromState.toReference()); this.lineItemId = lineItemId; }
private AddCustomLineItem(final LocalizedString name, final String slug, final MonetaryAmount money, final Referenceable<TaxCategory> taxCategory, final Long quantity, @Nullable final CustomFieldsDraft custom) { super("addCustomLineItem"); this.name = name; this.quantity = quantity; this.money = money; this.slug = slug; this.custom = custom; this.taxCategory = taxCategory.toReference(); }
public static TransitionState of(final @Nullable Referenceable<State> state) { final Reference<State> stateReference = Optional.ofNullable(state).map(stateReferenceable -> stateReferenceable.toReference()).orElse(null); return new TransitionState(stateReference); }
public static TransitionState of(final @Nullable Referenceable<State> state) { final Reference<State> stateReference = Optional.ofNullable(state).map(stateReferenceable -> stateReferenceable.toReference()).orElse(null); return new TransitionState(stateReference); }
static DiscountCodeInfo of(final Referenceable<DiscountCode> discountCode, final DiscountCodeState state) { final Reference<DiscountCode> discountCodeReference = Optional.ofNullable(discountCode).map(d -> d.toReference()).orElse(null); return new DiscountCodeInfoImpl(discountCodeReference, state); } }
@JsonIgnore static ZoneRate of(final Referenceable<Zone> zone, final List<ShippingRate> shippingRates) { return new ZoneRateImpl(shippingRates, zone.toReference()); } }
private SetCustomerGroup(final Referenceable<CustomerGroup> customerGroup) { super("setCustomerGroup"); this.customerGroup = Optional.ofNullable(customerGroup) .map(x -> x.toReference().filled(null)) .orElse(null); }
@JsonIgnore public static NestedAttributeType of(final Referenceable<ProductType> typeReference) { return new NestedAttributeType(typeReference.toReference()); } }
@JsonIgnore public static NestedType of(final Referenceable<ProductType> typeReference) { return new NestedType(typeReference.toReference()); } }
@JsonIgnore public static NestedAttributeType of(final Referenceable<ProductType> typeReference) { return new NestedAttributeType(typeReference.toReference()); } }
private SetCustomerGroup(final Referenceable<CustomerGroup> customerGroup) { super("setCustomerGroup"); this.customerGroup = Optional.ofNullable(customerGroup) .map(x -> x.toReference().filled(null)) .orElse(null); }
public static SetShippingMethod of(@Nullable final Referenceable<ShippingMethod> shippingMethod) { return shippingMethod != null ? new SetShippingMethod(shippingMethod.toReference()) : ofRemove(); }
default List<ShippingRate> getShippingRatesForZone(final Referenceable<Zone> zone) { return getZoneRates().stream() .filter(rate -> rate.getZone().hasSameIdAs(zone.toReference())) .findFirst() .map(rate -> rate.getShippingRates()) .orElse(Collections.emptyList()); }
default List<ShippingRate> getShippingRatesForZone(final Referenceable<Zone> zone) { final Optional<ZoneRate> zoneRateOptional = getZoneRates().stream() .filter(rate -> rate.getZone().hasSameIdAs(zone.toReference())) .findFirst(); return zoneRateOptional .map(rate -> rate.getShippingRates()) .orElse(Collections.emptyList()); }
@Nullable @Override public T convert(final Attribute attribute, final Referenceable<ProductType> productType) { final String productTypeId = productType.toReference().getId(); final Optional<ProductType> productTypeOptional = productTypes.findById(productTypeId); return productTypeOptional.map(pt -> convertWithProductType(attribute, pt)).orElse(null); }
/** * Serializer to convert the given reference into the identifier value. * @param <R> type of the reference. * @return the serializer for references of the given type. */ public static <R> TypeSerializer<Referenceable<R>> ofReference() { return new TypeSerializer<>(v -> withQuotes(v.toReference().getId())); }