use of com.canoo.dp.impl.remoting.commands.CreateControllerCommand in project dolphin-platform by canoo.
the class ControllerProxyFactory method create.
public <T> CompletableFuture<ControllerProxy<T>> create(String name, String parentControllerId) {
Assert.requireNonBlank(name, "name");
final InternalAttributesBean bean = platformBeanRepository.getInternalAttributesBean();
final CreateControllerCommand createControllerCommand = new CreateControllerCommand();
createControllerCommand.setControllerName(name);
if (parentControllerId != null) {
createControllerCommand.setParentControllerId(parentControllerId);
}
return dolphinCommandHandler.invokeDolphinCommand(createControllerCommand).thenApply(new Function<Void, ControllerProxy<T>>() {
@Override
public ControllerProxy<T> apply(Void aVoid) {
return new ControllerProxyImpl<T>(bean.getControllerId(), (T) bean.getModel(), clientConnector, platformBeanRepository, ControllerProxyFactory.this, converters);
}
});
}
use of com.canoo.dp.impl.remoting.commands.CreateControllerCommand in project dolphin-platform by canoo.
the class CreateControllerCommandEncoder method decode.
@Override
public CreateControllerCommand decode(final JsonObject jsonObject) {
Assert.requireNonNull(jsonObject, "jsonObject");
try {
final CreateControllerCommand command = new CreateControllerCommand();
if (jsonObject.has(CONTROLLER_ID) && !isElementJsonNull(jsonObject, CONTROLLER_ID)) {
command.setParentControllerId(getStringElement(jsonObject, CONTROLLER_ID));
}
command.setControllerName(getStringElement(jsonObject, NAME));
return command;
} catch (final Exception ex) {
throw new JsonParseException("Illegal JSON detected", ex);
}
}
Aggregations