public static char getCancelRejResponseToFor(Message inMessage) throws FieldNotFound { switch(inMessage.getHeader().getString(quickfix.field.MsgType.FIELD)) { case quickfix.field.MsgType.ORDER_CANCEL_REPLACE_REQUEST: return quickfix.field.CxlRejResponseTo.ORDER_CANCEL_REPLACE_REQUEST; case quickfix.field.MsgType.ORDER_CANCEL_REQUEST: return quickfix.field.CxlRejResponseTo.ORDER_CANCEL_REQUEST; } throw new IllegalArgumentException(); } /**
public boolean needsTransactTime(Message inMsg) { String theType = null; try { theType = inMsg.getHeader().getString(MsgType.FIELD); } catch (FieldNotFound ex) { return false; } return applicableMsgTypes.contains(theType); } /* (non-Javadoc)
private void copyField(Header header, int fromField, int toField) throws FieldNotFound { if (header.isSetField(fromField)) { final String value = header.getString(fromField); if (value.length() > 0) { this.header.setString(toField, value); } } }
private void doBadTime(Message msg) throws IOException, FieldNotFound { try { if (!MsgType.LOGON.equals(msg.getHeader().getString(MsgType.FIELD))) { generateReject(msg, BAD_TIME_REJ_REASON, SendingTime.FIELD); generateLogout(BAD_TIME_TEXT); } else { logoutWithErrorMessage(BAD_TIME_TEXT); } } catch (final SessionException ex) { generateLogout(ex.getMessage()); throw ex; } }
private String getMsgType() throws InvalidMessage { try { return header.getString(MsgType.FIELD); } catch (final FieldNotFound e) { throw new InvalidMessage(e.getMessage() + " in " + messageData); } }
private void copyField(Header header, int fromField, int toField) throws FieldNotFound { if (header.isSetField(fromField)) { final String value = header.getString(fromField); if (value.length() > 0) { this.header.setString(toField, value); } } }
private String getMsgType() throws InvalidMessage { try { return header.getString(MsgType.FIELD); } catch (final FieldNotFound e) { throw MessageUtils.newInvalidMessageException(e.getMessage() + " in " + messageData, this); } }
public boolean isAdmin() { if (header.isSetField(MsgType.FIELD)) { try { final String msgType = header.getString(MsgType.FIELD); return MessageUtils.isAdminMessage(msgType); } catch (final FieldNotFound e) { // shouldn't happen } } return false; }
private void sendBusinessReject(Message message, int rejectReason, String rejectText) throws FieldNotFound, SessionNotFound { Message reply = createMessage(message, MsgType.BUSINESS_MESSAGE_REJECT); reverseRoute(message, reply); String refSeqNum = message.getHeader().getString(MsgSeqNum.FIELD); reply.setString(RefSeqNum.FIELD, refSeqNum); reply.setString(RefMsgType.FIELD, message.getHeader().getString(MsgType.FIELD)); reply.setInt(BusinessRejectReason.FIELD, rejectReason); reply.setString(Text.FIELD, rejectText); Session.sendToTarget(reply); }
private boolean isCorrectCompID(Message message) throws FieldNotFound { if (!checkCompID) { return true; } final String senderCompID = message.getHeader().getString(SenderCompID.FIELD); final String targetCompID = message.getHeader().getString(TargetCompID.FIELD); return sessionID.getSenderCompID().equals(targetCompID) && sessionID.getTargetCompID().equals(senderCompID); }
public boolean isAdmin() { if (header.isSetField(MsgType.FIELD)) { try { final String msgType = header.getString(MsgType.FIELD); return MessageUtils.isAdminMessage(msgType); } catch (final FieldNotFound e) { // shouldn't happen } } return false; }
private void copyField(Header header, int fromField, int toField) throws FieldNotFound { if (header.isSetField(fromField)) { final String value = header.getString(fromField); if (value.length() > 0) { this.header.setString(toField, value); } } }
private void sendSessionReject(Message message, int rejectReason) throws FieldNotFound, SessionNotFound { Message reply = createMessage(message, MsgType.REJECT); reverseRoute(message, reply); String refSeqNum = message.getHeader().getString(MsgSeqNum.FIELD); reply.setString(RefSeqNum.FIELD, refSeqNum); reply.setString(RefMsgType.FIELD, message.getHeader().getString(MsgType.FIELD)); reply.setInt(SessionRejectReason.FIELD, rejectReason); Session.sendToTarget(reply); }
public boolean isAdmin() { if (header.isSetField(MsgType.FIELD)) { try { final String msgType = header.getString(MsgType.FIELD); return MessageUtils.isAdminMessage(msgType); } catch (final FieldNotFound e) { // shouldn't happen } } return false; }
/** Reverses the sender/target compIDs from reply and sets them in the outgoing outgoingMsg */ public void reverseRoute(Message outgoingMsg, Message reply) throws FieldNotFound { reply.getHeader().setString(SenderCompID.FIELD, outgoingMsg.getHeader().getString(TargetCompID.FIELD)); reply.getHeader().setString(TargetCompID.FIELD, outgoingMsg.getHeader().getString(SenderCompID.FIELD)); } /**
private void doBadCompID(Message msg) throws IOException, FieldNotFound { if (!MsgType.LOGON.equals(msg.getHeader().getString(MsgType.FIELD))) { generateReject(msg, BAD_COMPID_REJ_REASON, 0); generateLogout(BAD_COMPID_TEXT); } else { logoutWithErrorMessage(BAD_COMPID_TEXT); } }
public static boolean isRequiredField(Message message, int whichField) { boolean required = false; try { String msgType; msgType = message.getHeader().getString(MsgType.FIELD); return isRequiredField(msgType, whichField); } catch (Exception e) { // Ignore } return required; }
private String getMsgType() throws InvalidMessage { try { return header.getString(MsgType.FIELD); } catch (final FieldNotFound e) { throw MessageUtils.newInvalidMessageException(e.getMessage() + " in " + messageData, this); } }
private void doBadCompID(Message msg) throws IOException, FieldNotFound { if (!MsgType.LOGON.equals(msg.getHeader().getString(MsgType.FIELD))) { generateReject(msg, BAD_COMPID_REJ_REASON, 0); generateLogout(BAD_COMPID_TEXT); } else { logoutWithErrorMessage(BAD_COMPID_TEXT); } }