use of com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand in project dolphin-platform by canoo.
the class StoreAttributeActionTests method testChangeAttributeMetadata.
@Test
public void testChangeAttributeMetadata() {
StoreAttributeAction action = new StoreAttributeAction();
action.setServerModelStore(serverModelStore);
action.registerIn(registry);
ServerAttribute attribute = new ServerAttribute("newAttribute", "");
serverModelStore.add(new ServerPresentationModel("model", Collections.singletonList(attribute), serverModelStore));
registry.getActionsFor(ChangeAttributeMetadataCommand.class).get(0).handleCommand(new ChangeAttributeMetadataCommand(attribute.getId(), "value", "newValue"), Collections.emptyList());
Assert.assertEquals("newValue", attribute.getValue());
}
use of com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand in project dolphin-platform by canoo.
the class ChangeAttributeMetadataCommandEncoder method decode.
@Override
public ChangeAttributeMetadataCommand decode(final JsonObject jsonObject) {
final ChangeAttributeMetadataCommand command = new ChangeAttributeMetadataCommand();
command.setAttributeId(getStringElement(jsonObject, ATTRIBUTE_ID));
command.setMetadataName(getStringElement(jsonObject, NAME));
command.setValue(ValueEncoder.decodeValue(jsonObject.get(VALUE)));
return command;
}
use of com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand in project dolphin-platform by canoo.
the class DefaultModelSynchronizer method onMetadataChanged.
@Override
public void onMetadataChanged(final PropertyChangeEvent evt) {
final Command command = new ChangeAttributeMetadataCommand(((Attribute) evt.getSource()).getId(), evt.getPropertyName(), evt.getNewValue());
send(command);
}
Aggregations