本文整理了Java中io.sphere.sdk.zones.commands.ZoneDeleteCommand.of()
方法的一些代码示例,展示了ZoneDeleteCommand.of()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneDeleteCommand.of()
方法的具体详情如下:
包路径:io.sphere.sdk.zones.commands.ZoneDeleteCommand
类名称:ZoneDeleteCommand
方法名:of
[英]Creates a command object to delete a Zone by ID.
[中]创建命令对象以按ID删除分区。
代码示例来源:origin: com.commercetools.sdk.jvm.core/commercetools-models
/**
Creates a command object to delete a {@link Zone} by its key.
@param key the key of the Zone to delete, see {@link Zone#getKey()}
@param version `the current version of the Zone, see {@link Zone#getVersion()}
@return delete command
*/
static ZoneDeleteCommand ofKey(final String key, final Long version) {
final Versioned<Zone> versioned = Versioned.of("key=" + urlEncode(key), version);//hack for simple reuse
return of(versioned);
}
代码示例来源:origin: com.commercetools.sdk.jvm.core/commercetools-models
/**
Creates a command object to delete a {@link Zone} by its id.
@param id the id of the Zone to delete, see {@link Zone#getId()}
@param version `the current version of the Zone, see {@link Zone#getVersion()}
@return delete command
*/
static ZoneDeleteCommand ofId(final String id, final Long version) {
final Versioned<Zone> versioned = Versioned.of("id=" + urlEncode(id), version);//hack for simple reuse
return of(versioned);
}
代码示例来源: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
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
public static void deleteZonesForCountries(final BlockingSphereClient client, final CountryCode country, final CountryCode ... moreCountries) {
final Set<CountryCode> countries = setOf(country, moreCountries);
final ZoneQuery query = ZoneQuery.of();
final Consumer<Zone> action = zone -> {
try {
client.executeBlocking(ZoneDeleteCommand.of(zone));
} catch (final SphereException e) {
client.executeBlocking(ShippingMethodQuery.of().withPredicates(ShippingMethodQueryModel.of().zoneRates().zone().is(zone)))
.head()
.ifPresent(sm -> {
client.executeBlocking(ShippingMethodDeleteCommand.of(sm));
client.executeBlocking(ZoneDeleteCommand.of(zone));
});
}
};
client.executeBlocking(query).getResults().stream()
.filter(zone -> countries.stream().anyMatch(zone::contains))
.forEach(action);
}
}
内容来源于网络,如有侵权,请联系作者删除!