private static void handleSleep(TerminalSendAction terminalSendAction) { if (terminalSendAction.getSleep() > 0) { try { if (logger.isDebugEnabled()) { logger.debug( MessageFormat.format( "Sleeping for {0} after action {1}", terminalSendAction.getSleep(), terminalSendAction.getCommand())); } Thread.sleep(terminalSendAction.getSleep()); } catch (InterruptedException e) { logger.fatal(e, e); } } }
private static void handleRightAdjust(TerminalSendAction terminalSendAction) { List<TerminalField> fields = terminalSendAction.getFields(); for (TerminalField terminalField : fields) { if (terminalField.getRightAdjust() != RightAdjust.NONE) { if (terminalField.getLength() > terminalField.getValue().length()) { String fillerChar = terminalField.getRightAdjust() == RightAdjust.ZERO_FILL ? "0" : " "; String newValue = StringUtils.leftPad(terminalField.getValue(), terminalField.getLength(), fillerChar); terminalField.setValue(newValue); } } } }