gpt4 book ai didi

io.sphere.sdk.zones.commands.ZoneCreateCommand类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 10:54:22 27 4
gpt4 key购买 nike

本文整理了Java中io.sphere.sdk.zones.commands.ZoneCreateCommand类的一些代码示例,展示了ZoneCreateCommand类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneCreateCommand类的具体详情如下:
包路径:io.sphere.sdk.zones.commands.ZoneCreateCommand
类名称:ZoneCreateCommand

ZoneCreateCommand介绍

[英]Creates a zone in SPHERE.IO. io.sphere.sdk.zones.commands.ZoneCreateCommandTest#execution()
[中]在球体中创建一个分区。伊奥。伊奥。球sdk。区域。命令。ZoneCreateCommandTest#执行()

代码示例

代码示例来源:origin: io.sphere.sdk.jvm/models

public static ZoneCreateCommand of(final ZoneDraft draft) {
    return new ZoneCreateCommand(draft);
  }
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

public static void withZone(final BlockingSphereClient client, final ZoneDraft draft, final Consumer<Zone> consumer) {
  final Zone zone = client.executeBlocking(ZoneCreateCommand.of(draft));
  consumer.accept(zone);
  client.executeBlocking(ZoneDeleteCommand.of(zone));
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

private static void withUpdateableZone(final BlockingSphereClient client, final ZoneDraft draft, final Function<Zone, Zone> f) {
  final ZoneCreateCommand createCommand = ZoneCreateCommand.of(draft);
  Zone zone = client.executeBlocking(createCommand);
  zone = f.apply(zone);//zone possibly has been updated
  client.executeBlocking(ZoneDeleteCommand.of(zone));
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

@Test
public void execution() throws Exception {
  final Set<CountryCode> euAndSwissCountries = asSet(AT, BE, CH);//not complete, but you get the idea
  final String key = randomKey();
  final Set<Location> locations = euAndSwissCountries.stream().map(country -> Location.of(country)).collect(toSet());
  final ZoneDraft draft = ZoneDraftBuilder.of("zone1",locations ).description("EU and Swiss").key(key).build();
  final ZoneCreateCommand createCommand = ZoneCreateCommand.of(draft);
  final Zone zone = client().executeBlocking(createCommand);
  assertThat(zone.getKey()).isEqualTo(key);
  //end example parsing here
  client().executeBlocking(ZoneDeleteCommand.ofKey(zone.getKey(),zone.getVersion()));
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

public static void withUpdateableDynamicShippingMethodForGermany(final BlockingSphereClient client, final CartPredicate cartPredicate, final UnaryOperator<ShippingMethod> consumer) {
  final Optional<Zone> zoneOptional = client.executeBlocking(ZoneQuery.of().byCountry(DE)).head();
  final Zone zone;
  if (zoneOptional.isPresent()) {
    zone = zoneOptional.get();
  } else {
    zone = client.executeBlocking(ZoneCreateCommand.of(ZoneDraft.of("de", singleton(Location.of(DE)))));
  }
  withUpdateableDynamicShippingMethod(client, cartPredicate, shippingMethodWithOutZone -> {
    final ShippingMethod updated = client.executeBlocking(ShippingMethodUpdateCommand.of(shippingMethodWithOutZone, asList(AddZone.of(zone), AddShippingRate.of(ShippingRate.of(EURO_1), zone))));
    return consumer.apply(updated);
  });
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

public static void withUpdateableShippingMethodForGermany(final BlockingSphereClient client, final UnaryOperator<ShippingMethod> consumer) {
  final Optional<Zone> zoneOptional = client.executeBlocking(ZoneQuery.of().byCountry(DE)).head();
  final Zone zone;
  if (zoneOptional.isPresent()) {
    zone = zoneOptional.get();
  } else {
    zone = client.executeBlocking(ZoneCreateCommand.of(ZoneDraft.of("de", singleton(Location.of(DE)))));
  }
  withUpdateableShippingMethod(client, shippingMethodWithOutZone -> {
    final ShippingMethod updated = client.executeBlocking(ShippingMethodUpdateCommand.of(shippingMethodWithOutZone, asList(AddZone.of(zone), AddShippingRate.of(ShippingRate.of(EURO_1), zone))));
    return consumer.apply(updated);
  });
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com