Search in sources :

Example 1 with ChangeAttributeMetadataCommand

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());
}
Also used : ServerPresentationModel(com.canoo.dp.impl.server.legacy.ServerPresentationModel) ChangeAttributeMetadataCommand(com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand) ServerAttribute(com.canoo.dp.impl.server.legacy.ServerAttribute) Test(org.testng.annotations.Test)

Example 2 with ChangeAttributeMetadataCommand

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;
}
Also used : ChangeAttributeMetadataCommand(com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand)

Example 3 with ChangeAttributeMetadataCommand

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);
}
Also used : Command(com.canoo.dp.impl.remoting.legacy.communication.Command) CreatePresentationModelCommand(com.canoo.dp.impl.remoting.legacy.communication.CreatePresentationModelCommand) PresentationModelDeletedCommand(com.canoo.dp.impl.remoting.legacy.communication.PresentationModelDeletedCommand) ChangeAttributeMetadataCommand(com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand) ValueChangedCommand(com.canoo.dp.impl.remoting.legacy.communication.ValueChangedCommand) ChangeAttributeMetadataCommand(com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand)

Aggregations

ChangeAttributeMetadataCommand (com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand)3 Command (com.canoo.dp.impl.remoting.legacy.communication.Command)1 CreatePresentationModelCommand (com.canoo.dp.impl.remoting.legacy.communication.CreatePresentationModelCommand)1 PresentationModelDeletedCommand (com.canoo.dp.impl.remoting.legacy.communication.PresentationModelDeletedCommand)1 ValueChangedCommand (com.canoo.dp.impl.remoting.legacy.communication.ValueChangedCommand)1 ServerAttribute (com.canoo.dp.impl.server.legacy.ServerAttribute)1 ServerPresentationModel (com.canoo.dp.impl.server.legacy.ServerPresentationModel)1 Test (org.testng.annotations.Test)1