Package org.ugate.service.entity.jpa

Examples of org.ugate.service.entity.jpa.RemoteNode


  protected void doPost(final HttpServletRequest request,
      final HttpServletResponse response) throws ServletException,
      IOException {
    try {
      if (validate(request, response)) {
        final RemoteNode rn = getRemoteNode(request, response);
        executeCommands(request, response, rn);
        final String p = request.getParameter(VAR_ACTION_NAME);
        if (p != null && p.equals(VAR_ACTION_CONNECT_NAME)) {
          final boolean connected = ServiceProvider.IMPL
              .getWirelessService().testRemoteConnection(rn, 0);
          if (!connected) {
            response.sendError(
                HttpServletResponse.SC_CONFLICT,
                RS.rbLabel(KEY.WIRELESS_NODE_CONNECT_FAILED,
                    rn.getAddress()));
            return;
          }
        }
        response.setStatus(HttpServletResponse.SC_OK);
      }
View Full Code Here


  @Override
  protected void doPut(final HttpServletRequest request,
      final HttpServletResponse response) throws ServletException,
      IOException {
    try {
      RemoteNode rn;
      if (validate(request, response)
          && (rn = getRemoteNode(request, response)) != null) {
        boolean hasParams = false;
        String p;
        Object v;
        for (final RemoteNodeType rnt : RemoteNodeType.values()) {
          p = request.getParameter(rnt.getKey());
          if (p == null || p.isEmpty()) {
            continue;
          }
          v = rnt.getValue(rn);
          if (v != null && v.toString().equals(p)) {
            continue;
          }
          if (log.isInfoEnabled()) {
            log.info(String
                .format("Setting request parameter %1$s to %2$s for %3$s at address %4$s)",
                    rnt.getKey(), p,
                    RemoteNode.class.getSimpleName(),
                    rn.getAddress()));
          }
          rnt.setValue(rn, p);
          hasParams = true;
        }
        if (hasParams) {
View Full Code Here

    // show a visual indication that the settings need updated
    UGateKeeper.DEFAULT.addListener(new UGateListener() {
      @Override
      public void handle(final UGateEvent<?, ?> event) {
        if (event.getType() == UGateEvent.Type.WIRELESS_DATA_RX_SUCCESS) {
          final RemoteNode rn = (RemoteNode) event.getSource();
          if (event.getNewValue() instanceof RxTxRemoteNodeReadingDTO &&
              rn.getAddress().equalsIgnoreCase(cb.getRemoteNode().getAddress())) {
            final RxTxRemoteNodeReadingDTO sr = (RxTxRemoteNodeReadingDTO) event.getNewValue();
            remoteNodeReadingShow(sr.getRemoteNodeReading());
          }
        } else if (event.getType() == UGateEvent.Type.APP_DATA_LOADED ||
            event.getType() == UGateEvent.Type.WIRELESS_REMOTE_NODE_CHANGED) {
View Full Code Here

    final Actor actor = findActor(req);
    if (actor == null) {
      req.authenticate(res);
    }
    final Integer rnId = getParameter(req, RemoteNodeType.ID.getKey(), Integer.class);
    RemoteNode rn = null;
    if (rnId != null) {
      rn = getRemoteNode(actor, rnId);
      if (rn != null) {
        ctx.setVariable(VAR_REMOTE_NODE_NAME, rn);
        addRemoteNodeReadingVars(rn, ctx);
        addRemoteNodeVars(rn, ctx);
      }
    }
    if (rn == null) {
      rn = new RemoteNode();
      rn.setAddress("");
      ctx.setVariable(VAR_REMOTE_NODE_NAME, rn);
    }
    ctx.setVariable(VAR_REMOTE_NODES_NAME, actor.getHost().getRemoteNodes());
    return null;
  }
View Full Code Here

TOP

Related Classes of org.ugate.service.entity.jpa.RemoteNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.