@Override public IDeviceCommand getDeviceCommandByToken(String token) throws SiteWhereException { return delegate.getDeviceCommandByToken(token); }
@Override public IDeviceCommand getDeviceCommandByToken(String token) throws SiteWhereException { return getDelegate().getDeviceCommandByToken(token); }
public AssignmentScope persist(DeviceCommandInvocationCreateRequest.Builder builder) throws SiteWhereException { DeviceCommandInvocationCreateRequest request = builder.build(); IDeviceCommand command = deviceManagement.getDeviceCommandByToken(request.getCommandToken()); events.addDeviceCommandInvocation(getAssignmentToken(), command, request); return this; }
/** * Get a device command by unique token. Throw an exception if not found. * * @param token * @param servletRequest * @return * @throws SiteWhereException */ protected IDeviceCommand assureDeviceCommand(String token, HttpServletRequest servletRequest) throws SiteWhereException { IDeviceCommand command = SiteWhere.getServer().getDeviceManagement(getTenant(servletRequest)) .getDeviceCommandByToken(token); if (command == null) { throw new SiteWhereSystemException(ErrorCode.InvalidDeviceCommandToken, ErrorLevel.ERROR); } return command; } }
/** * Get a device command by unique token. Throw an exception if not found. * * @param token * @param servletRequest * @return * @throws SiteWhereException */ protected IDeviceCommand assureDeviceCommand(String token, HttpServletRequest servletRequest) throws SiteWhereException { IDeviceCommand command = SiteWhere.getServer().getDeviceManagement(getTenant(servletRequest)) .getDeviceCommandByToken(token); if (command == null) { throw new SiteWhereSystemException(ErrorCode.InvalidDeviceCommandToken, ErrorLevel.ERROR); } return command; } }
/** * Gets a device command by token and throws an exception if not found. * * @param token * @param servletRequest * @return * @throws SiteWhereException */ protected IDeviceCommand assertDeviceCommandByToken(String token, HttpServletRequest servletRequest) throws SiteWhereException { IDeviceCommand result = SiteWhere.getServer().getDeviceManagement(getTenant(servletRequest)) .getDeviceCommandByToken(token); if (result == null) { throw new SiteWhereSystemException(ErrorCode.InvalidDeviceCommandToken, ErrorLevel.ERROR, HttpServletResponse.SC_NOT_FOUND); } return result; } }
return showError("No command token set for batch operation."); IDeviceCommand command = management.getDeviceCommandByToken(commandToken); data.put("command", new String(MarshalUtils.marshalJsonAsString(command))); return new ModelAndView("batch/command", data);
IDeviceCommand command = getDeviceManagement(getTenant()).getDeviceCommandByToken(commandToken); if (command != null) { Map<String, String> paramValues = new HashMap<String, String>();
@Override public void getDeviceCommandByToken(GGetDeviceCommandByTokenRequest request, StreamObserver<GGetDeviceCommandByTokenResponse> responseObserver) { try { GrpcUtils.handleServerMethodEntry(this, DeviceManagementGrpc.getGetDeviceCommandByTokenMethod()); IDeviceCommand apiResult = getDeviceManagement().getDeviceCommandByToken(request.getToken()); GGetDeviceCommandByTokenResponse.Builder response = GGetDeviceCommandByTokenResponse.newBuilder(); if (apiResult != null) { response.setCommand(DeviceModelConverter.asGrpcDeviceCommand(apiResult)); } responseObserver.onNext(response.build()); responseObserver.onCompleted(); } catch (Throwable e) { GrpcUtils.handleServerMethodException(DeviceManagementGrpc.getGetDeviceCommandByTokenMethod(), e, responseObserver); } finally { GrpcUtils.handleServerMethodExit(DeviceManagementGrpc.getGetDeviceCommandByTokenMethod()); } }
IDeviceCommand command = getDeviceManagement(getTenant()).getDeviceCommandByToken(commandToken); if (command != null) { Map<String, String> paramValues = new HashMap<String, String>();
IDeviceCommand found = getDeviceManagement(tenant).getDeviceCommandByToken(source.getCommandToken()); if (found == null) { LOGGER.warn("Device invocation references a non-existent command token.");
.getDeviceCommandByToken(commandToken); if (command == null) { throw new SiteWhereException("Invalid command token referenced by batch command invocation.");
@Override public void deliverCommand(IDeviceCommunication communication, IDeviceCommandInvocation invocation) throws SiteWhereException { LOGGER.debug("Command processing strategy handling invocation."); IDeviceCommand command = SiteWhere.getServer().getDeviceManagement(getTenant()) .getDeviceCommandByToken(invocation.getCommandToken()); if (command != null) { IDeviceCommandExecution execution = getCommandExecutionBuilder().createExecution(command, invocation); List<IDeviceAssignment> assignments = getCommandTargetResolver().resolveTargets(invocation); for (IDeviceAssignment assignment : assignments) { IDevice device = SiteWhere.getServer().getDeviceManagement(getTenant()) .getDeviceForAssignment(assignment); if (device == null) { throw new SiteWhereException("Targeted assignment references device that does not exist."); } IDeviceNestingContext nesting = NestedDeviceSupport.calculateNestedDeviceInformation(device, getTenant()); communication.getOutboundCommandRouter().routeCommand(execution, nesting, assignment); } } else { throw new SiteWhereException("Invalid command referenced from invocation."); } }
IDeviceManagement devices = SiteWhere.getServer().getDeviceManagement(tenant); IDeviceEventManagement events = SiteWhere.getServer().getDeviceEventManagement(tenant); IDeviceCommand command = devices.getDeviceCommandByToken(getCommandToken()); DeviceCommandInvocationCreateRequest create = new DeviceCommandInvocationCreateRequest(); create.setCommandToken(getCommandToken());
IDeviceCommand found = getDeviceManagement().getDeviceCommandByToken(source.getCommandToken()); if (found == null) { LOGGER.warn("Device invocation references a non-existent command token.");