@Override public List<IVariable> getOutputVariables() { try { final List<IVariable> ret = super.getOutputVariables(); final MotorContainer cont = (MotorContainer) motorsParam.getBeanFromValue(MotorContainer.class); if (cont == null || cont.isEmpty()) return ret; for (MotorBean mb : cont.getExpressions()) { ret.add( new Variable( mb.getMotorName().substring(mb.getMotorName().lastIndexOf('/') + 1), VARIABLE_TYPE.SCALAR, mb.getExpression(), String.class)); } return ret; } catch (Exception e) { logger.error("Cannot read variables", e); return null; } }
@Override protected DataMessageComponent getTransformedMessage(List<DataMessageComponent> cache) throws ProcessingException { try { final MotorContainer cont = (MotorContainer) motorsParam.getBeanFromValue(MotorContainer.class); final DataMessageComponent comp = MessageUtils.mergeAll(cache); if (cont == null) { comp.putScalar("error_messsage", "No motors configured, '" + getName() + "' did nothing."); return comp; } final Map<String, String> values = setMotors(cont, comp); if (values != null) comp.addScalar(values); return comp; } catch (Exception e) { throw createDataMessageException("Cannot set motor values!", e); } }