/** * Converts the supplied fix message to a pretty string that can be logged. * The returned string prints the human readable representations of field * tags and enumeration type field values to make them easily readable. * <p> * This method ignores any repeating groups in the message. * * @param msg the FIX Message. * @param inDict the data dictionary for the message * * @return the string form of the message. */ public static String toPrettyString(Message msg, FIXDataDictionary inDict) { HashMap<String, String> fields = fieldsToMap(msg, inDict); fields.put("HEADER", fieldsToMap(msg.getHeader(), //$NON-NLS-1$ inDict).toString()); fields.put("TRAILER", fieldsToMap(msg.getTrailer(), //$NON-NLS-1$ inDict).toString()); return fields.toString(); }
private FieldMap getAppropriateMap(Integer fieldID, Message message) { FieldMap map; if (dataDictionary.isHeaderField(fieldID)) { map = message.getHeader(); } else if (dataDictionary.isTrailerField(fieldID)) { map = message.getTrailer(); } else { map = message; } return map; }
private Object cloneTo(Message message) { message.initializeFrom(this); message.header.initializeFrom(getHeader()); message.trailer.initializeFrom(getTrailer()); return message; }
private Object cloneTo(Message message) { message.initializeFrom(this); message.header.initializeFrom(getHeader()); message.trailer.initializeFrom(getTrailer()); return message; }
private Object cloneTo(Message message) { message.initializeFrom(this); message.header.initializeFrom(getHeader()); message.trailer.initializeFrom(getTrailer()); return message; }
message.getTrailer().setString(Integer.parseInt(tag), value);
iter = message.getTrailer().iterator(); if (iter != null) { while (iter.hasNext()) {
static void validate(Message message, DataDictionary sessionDataDictionary, DataDictionary applicationDataDictionary) throws IncorrectTagValue, FieldNotFound, IncorrectDataFormat { final boolean bodyOnly = sessionDataDictionary == null; if (isVersionSpecified(sessionDataDictionary) && !sessionDataDictionary.getVersion().equals( message.getHeader().getString(BeginString.FIELD)) && !message.getHeader().getString(BeginString.FIELD).equals("FIXT.1.1") && !sessionDataDictionary.getVersion().equals("FIX.5.0")) { throw new UnsupportedVersion("Message version '" + message.getHeader().getString(BeginString.FIELD) + "' does not match the data dictionary version '" + sessionDataDictionary.getVersion() + "'"); } if (!message.hasValidStructure() && message.getException() != null) { throw message.getException(); } final String msgType = message.getHeader().getString(MsgType.FIELD); if (isVersionSpecified(applicationDataDictionary)) { applicationDataDictionary.checkMsgType(msgType); applicationDataDictionary.checkHasRequired(message.getHeader(), message, message.getTrailer(), msgType, bodyOnly); } if (!bodyOnly) { sessionDataDictionary.iterate(message.getHeader(), HEADER_ID, sessionDataDictionary); sessionDataDictionary.iterate(message.getTrailer(), TRAILER_ID, sessionDataDictionary); } applicationDataDictionary.iterate(message, msgType, applicationDataDictionary); }
static void validate(Message message, DataDictionary sessionDataDictionary, DataDictionary applicationDataDictionary) throws IncorrectTagValue, FieldNotFound, IncorrectDataFormat { final boolean bodyOnly = sessionDataDictionary == null; if (isVersionSpecified(sessionDataDictionary) && !sessionDataDictionary.getVersion().equals( message.getHeader().getString(BeginString.FIELD)) && !message.getHeader().getString(BeginString.FIELD).equals("FIXT.1.1") && !sessionDataDictionary.getVersion().equals("FIX.5.0")) { throw new UnsupportedVersion("Message version '" + message.getHeader().getString(BeginString.FIELD) + "' does not match the data dictionary version '" + sessionDataDictionary.getVersion() + "'"); } if (!message.hasValidStructure() && message.getException() != null) { throw message.getException(); } final String msgType = message.getHeader().getString(MsgType.FIELD); if (isVersionSpecified(applicationDataDictionary)) { applicationDataDictionary.checkMsgType(msgType); applicationDataDictionary.checkHasRequired(message.getHeader(), message, message.getTrailer(), msgType, bodyOnly); } if (!bodyOnly) { sessionDataDictionary.iterate(message.getHeader(), HEADER_ID, sessionDataDictionary); sessionDataDictionary.iterate(message.getTrailer(), TRAILER_ID, sessionDataDictionary); } applicationDataDictionary.iterate(message, msgType, applicationDataDictionary); }
static void validate(Message message, DataDictionary sessionDataDictionary, DataDictionary applicationDataDictionary) throws IncorrectTagValue, FieldNotFound, IncorrectDataFormat { final boolean bodyOnly = sessionDataDictionary == null; if (isVersionSpecified(sessionDataDictionary) && !sessionDataDictionary.getVersion().equals( message.getHeader().getString(BeginString.FIELD)) && !message.getHeader().getString(BeginString.FIELD).equals("FIXT.1.1") && !sessionDataDictionary.getVersion().equals("FIX.5.0")) { throw new UnsupportedVersion("Message version '" + message.getHeader().getString(BeginString.FIELD) + "' does not match the data dictionary version '" + sessionDataDictionary.getVersion() + "'"); } if (!message.hasValidStructure() && message.getException() != null) { throw message.getException(); } final String msgType = message.getHeader().getString(MsgType.FIELD); if (isVersionSpecified(applicationDataDictionary)) { applicationDataDictionary.checkMsgType(msgType); applicationDataDictionary.checkHasRequired(message.getHeader(), message, message.getTrailer(), msgType, bodyOnly); } if (!bodyOnly) { sessionDataDictionary.iterate(message.getHeader(), HEADER_ID, sessionDataDictionary); sessionDataDictionary.iterate(message.getTrailer(), TRAILER_ID, sessionDataDictionary); } applicationDataDictionary.iterate(message, msgType, applicationDataDictionary); }
iter = message.getTrailer().iterator(); if (iter != null) { while (iter.hasNext()) {