public final class SetCustomType extends SetCustomTypeBase<Channel>
See also ChannelUpdateCommand.
withUpdateableType(client(), type -> { withUpdatableChannelOfRole(client(), ChannelRole.INVENTORY_SUPPLY, channel -> { final HashMap<String, Object> fields = new HashMap<>(); fields.put(STRING_FIELD_NAME, "hello"); final ChannelUpdateCommand updateCommand = ChannelUpdateCommand.of(channel, SetCustomType.ofTypeIdAndObjects(type.getId(), fields)); final Channel updatedChannel = client().executeBlocking(updateCommand); assertThat(updatedChannel.getCustom().getType()).isEqualTo(type.toReference()); assertThat(updatedChannel.getCustom().getFieldAsString(STRING_FIELD_NAME)).isEqualTo("hello"); final Channel updated2 = client().executeBlocking(ChannelUpdateCommand.of(updatedChannel, SetCustomType.ofRemoveType())); assertThat(updated2.getCustom()).isNull(); return updated2; }); return type; });
See the test code.
Modifier and Type | Method and Description |
---|---|
static SetCustomType |
ofRemoveType() |
static SetCustomType |
ofTypeIdAndJson(String typeId,
Map<String,com.fasterxml.jackson.databind.JsonNode> fields) |
static SetCustomType |
ofTypeIdAndObjects(String typeId,
Map<String,Object> fields) |
static SetCustomType |
ofTypeKeyAndJson(String typeKey,
Map<String,com.fasterxml.jackson.databind.JsonNode> fields) |
static SetCustomType |
ofTypeKeyAndObjects(String typeKey,
Map<String,Object> fields) |
getFields, getType, mapObjectToJsonMap
getAction
public static SetCustomType ofTypeKeyAndObjects(String typeKey, Map<String,Object> fields)
public static SetCustomType ofTypeIdAndObjects(String typeId, Map<String,Object> fields)
public static SetCustomType ofTypeIdAndJson(String typeId, Map<String,com.fasterxml.jackson.databind.JsonNode> fields)
public static SetCustomType ofTypeKeyAndJson(String typeKey, Map<String,com.fasterxml.jackson.databind.JsonNode> fields)
public static SetCustomType ofRemoveType()