gt:                 if (encodedText != null && encodedText.length > 0) {
context: /*
   *   Copyright (c) 2006-2016 Marvisan Pty. Ltd. All rights reserved.
   *               Use is subject to license terms.
   */
  
  /*
   * PositionMaintenanceRequestMsg.java
   *
   * $Id: AllocationInstructionMsg.java,v 1.5 2011-10-21 10:31:03 vrotaru Exp $
   */
  package net.hades.fix.message;
  
  import net.hades.fix.message.anno.FIXVersion;
  import net.hades.fix.message.comp.Instrument;
  import net.hades.fix.message.comp.InstrumentLeg;
  import net.hades.fix.message.comp.Parties;
  import net.hades.fix.message.comp.UnderlyingInstrument;
  import net.hades.fix.message.exception.InvalidMsgException;
  import net.hades.fix.message.exception.TagNotPresentException;
  import net.hades.fix.message.group.PositionQtyGroup;
  import net.hades.fix.message.group.TradingSessionGroup;
  import net.hades.fix.message.struct.Tag;
  import net.hades.fix.message.util.BooleanConverter;
  import net.hades.fix.message.util.DateConverter;
  import net.hades.fix.message.util.MsgUtil;
  
  import java.io.ByteArrayOutputStream;
  import java.io.IOException;
  import java.nio.ByteBuffer;
  import java.util.Arrays;
  import java.util.Date;
  import java.util.HashSet;
  import java.util.Set;
  import java.util.logging.Level;
  
  import javax.xml.bind.annotation.XmlAccessType;
  import javax.xml.bind.annotation.XmlAccessorType;
  
  import net.hades.fix.message.anno.TagNumRef;
  import net.hades.fix.message.exception.BadFormatMsgException;
  import net.hades.fix.message.group.PosAmtGroup;
  import net.hades.fix.message.type.AccountType;
  import net.hades.fix.message.type.AcctIDSource;
  import net.hades.fix.message.type.AdjustmentType;
  import net.hades.fix.message.type.ApplVerID;
  import net.hades.fix.message.type.BeginString;
  import net.hades.fix.message.type.Currency;
  import net.hades.fix.message.type.MsgType;
  import net.hades.fix.message.type.PosMaintAction;
  import net.hades.fix.message.type.PosTransType;
  import net.hades.fix.message.type.SessionRejectReason;
  import net.hades.fix.message.type.TagNum;
  import net.hades.fix.message.util.TagEncoder;
  
  /**
   * <p>Extracted from FIX protocol documentation <a href="http://www.fixprotocol.org/">FIX Protocol</a></p>
   * Used to request a position details.
   *
   * @author <a href="mailto:support@marvisan.com">Support Team</a>
   * @version $Revision: 1.5 $
   * @created 29/01/2011, 9:25:04 AM
   */
  @XmlAccessorType(XmlAccessType.NONE)
  public abstract class PositionMaintenanceRequestMsg extends FIXMsg {
  
      // <editor-fold defaultstate="collapsed" desc="Constants">
  
      private static final long serialVersionUID = 1L;
  
      protected static final Set<Integer> TAGS = new HashSet<Integer>(Arrays.asList(new Integer[] {
          TagNum.PosReqID.getValue(),
          TagNum.PosTransType.getValue(),
          TagNum.PosMaintAction.getValue(),
          TagNum.OrigPosReqRefID.getValue(),
          TagNum.PosMaintRptRefID.getValue(),
          TagNum.ClearingBusinessDate.getValue(),
          TagNum.SettlSessID.getValue(),
          TagNum.SettlSessSubID.getValue(),
          TagNum.Account.getValue(),
          TagNum.AcctIDSource.getValue(),
          TagNum.AccountType.getValue(),
          TagNum.Currency.getValue(),
          TagNum.NoLegs.getValue(),
          TagNum.NoUnderlyings.getValue(),
          TagNum.NoTradingSessions.getValue(),
          TagNum.TransactTime.getValue(),
          TagNum.NoPositions.getValue(),
          TagNum.NoPosAmt.getValue(),
          TagNum.AdjustmentType.getValue(),
          TagNum.ContraryInstructionIndicator.getValue(),
          TagNum.PriorSpreadIndicator.getValue(),
          TagNum.ThresholdAmount.getValue(),
          TagNum.Text.getValue(),
          TagNum.SettlCurrency.getValue()
      }));
  
      protected static final Set<Integer> START_DATA_TAGS = new HashSet<Integer>(Arrays.asList(new Integer[] {
          TagNum.EncodedTextLen.getValue()
      }));
  
      protected static final Set<Integer> REQUIRED_TAGS = new HashSet<Integer>(Arrays.asList(new Integer[] {
          TagNum.PosReqID.getValue(),
          TagNum.PosTransType.getValue(),
          TagNum.PosMaintAction.getValue(),
          TagNum.ClearingBusinessDate.getValue(),
          TagNum.Account.getValue(),
          TagNum.Symbol.getValue(),
          TagNum.TransactTime.getValue()
      }));
  
      // </editor-fold>
  
      // <editor-fold defaultstate="collapsed" desc="Static Block">
      // </editor-fold>
  
      // <editor-fold defaultstate="collapsed" desc="Attributes">
  
      /**
       * TagNum = 710. Starting with 4.4 version.
       */
      protected String posReqID;
      
      /**
       * TagNum = 709 REQUIRED. Starting with 4.4 version.
       */
      protected PosTransType posTransType;
      
      /**
       * TagNum = 712 REQUIRED. Starting with 4.4 version.
       */
      protected PosMaintAction posMaintAction;
      
      /**
       * TagNum = 713. Starting with 4.4 version.
       */
      protected String origPosReqRefID;
      
      /**
       * TagNum = 714. Starting with 4.4 version.
       */
      protected String posMaintRptRefID;
      
      /**
       * TagNum = 715 REQUIRED. Starting with 4.4 version.
       */
      protected Date clearingBusinessDate;
  
      /**
       * TagNum = 716. Starting with 4.4 version.
       */
      protected String settlSessID;
  
      /**
       * TagNum = 716. Starting with 4.4 version.
       */
      protected String settlSessSubID;
  
      /**
       * Starting with 4.4 version.
       */
      protected Parties parties;
  
      /**
       * TagNum = 1. Starting with 4.4 version.
       */
      protected String account;
  
      /**
       * TagNum = 660. Starting with 4.4 version.
       */
      protected AcctIDSource acctIDSource;
  
      /**
       * TagNum = 581. Starting with 4.4 version.
       */
      protected AccountType accountType;
      
      /**
       * Starting with 4.4 version.
       */
      protected Instrument instrument;
  
      /**
       * TagNum = 15. Starting with 4.4 version.
       */
      protected Currency currency;
  
      /**
       * TagNum = 555. Starting with 4.4 version.
       */
      protected Integer noLegs;
  
      /**
       * Starting with 4.4 version.
       */
      protected InstrumentLeg[] instrumentLegs;
  
      /**
       * TagNum = 711. Starting with 4.4 version.
       */
      protected Integer noUnderlyings;
  
      /**
       * Starting with 4.4 version.
       */
      protected UnderlyingInstrument[] underlyingInstruments;
  
      /**
       * TagNum = 386. Starting with 4.4 version.
       */
      protected Integer noTradingSessions;
  
      /**
       * Starting with 4.4 version.
       */
      protected TradingSessionGroup[] tradingSessionGroups;
  
      /**
       * TagNum = 60 REQUIRED. Starting with 4.4 version.
       */
      protected Date transactTime;
  
      /**
       * TagNum = 768 REQUIRED. Starting with 4.4 version.
       */
      protected Integer noPositions;
  
      /**
       * Starting with 4.4 version.
       */
      protected PositionQtyGroup[] positionQtyGroups;
  
      /**
       * TagNum = 753. Starting with 4.4 version.
       */
      protected Integer noPosAmt;
  
      /**
       * Starting with 5.0 version.
       */
      protected PosAmtGroup[] posAmtGroups;
  
      /**
       * TagNum = 718. Starting with 4.4 version.
       */
      protected AdjustmentType adjustmentType;
  
      /**
       * TagNum = 719. Starting with 4.4 version.
       */
      protected Boolean contraryInstructionIndicator;
  
      /**
       * TagNum = 720. Starting with 4.4 version.
       */
      protected Boolean priorSpreadIndicator;
  
      /**
       * TagNum = 834. Starting with 4.4 version.
       */
      protected Double thresholdAmount;
  
      /**
       * TagNum = 58. Starting with 4.4 version.
       */
      protected String text;
  
      /**
       * TagNum = 354. Starting with 4.4 version.
       */
      protected Integer encodedTextLen;
  
      /**
       * TagNum = 355. Starting with 4.4 version.
       */
      protected byte[] encodedText;
  
      /**
       * TagNum = 120. Starting with 5.0 version.
       */
      protected Currency settlCurrency;
  
      // </editor-fold>
  
      // <editor-fold defaultstate="collapsed" desc="Constructors">
  
      public PositionMaintenanceRequestMsg() {
          super();
      }
  
      public PositionMaintenanceRequestMsg(Header header, ByteBuffer rawMsg)
      throws InvalidMsgException, TagNotPresentException, BadFormatMsgException {
          super(header, rawMsg);
      }
  
      public PositionMaintenanceRequestMsg(BeginString beginString) throws InvalidMsgException {
          super(MsgType.PositionMaintenanceRequest.getValue(), beginString);
      }
  
      public PositionMaintenanceRequestMsg(BeginString beginString, ApplVerID applVerID) throws InvalidMsgException {
          super(MsgType.PositionMaintenanceRequest.getValue(), beginString, applVerID);
      }
  
      // </editor-fold>
  
      // <editor-fold defaultstate="collapsed" desc="Public Methods">
  
      @Override
      public Set<Integer> getFragmentTags() {
          return TAGS;
      }
  
      // ACCESSOR METHODS
      //////////////////////////////////////////
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.PosReqID)
      public String getPosReqID() {
          return posReqID;
      }
  
      /**
       * Message field setter.
       * @param posReqID field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.PosReqID)
      public void setPosReqID(String posReqID) {
          this.posReqID = posReqID;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.PosTransType, required=true)
      public PosTransType getPosTransType() {
          return posTransType;
      }
  
      /**
       * Message field setter.
       * @param posTransType field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.PosTransType, required=true)
      public void setPosTransType(PosTransType posTransType) {
          this.posTransType = posTransType;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.PosMaintAction, required=true)
      public PosMaintAction getPosMaintAction() {
          return posMaintAction;
      }
  
      /**
       * Message field setter.
       * @param posMaintAction field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.PosMaintAction, required=true)
      public void setPosMaintAction(PosMaintAction posMaintAction) {
          this.posMaintAction = posMaintAction;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.OrigPosReqRefID)
      public String getOrigPosReqRefID() {
          return origPosReqRefID;
      }
  
      /**
       * Message field setter.
       * @param origPosReqRefID field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.OrigPosReqRefID)
      public void setOrigPosReqRefID(String origPosReqRefID) {
          this.origPosReqRefID = origPosReqRefID;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.PosMaintRptRefID)
      public String getPosMaintRptRefID() {
          return posMaintRptRefID;
      }
  
      /**
       * Message field setter.
       * @param posMaintRptRefID field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.PosMaintRptRefID)
      public void setPosMaintRptRefID(String posMaintRptRefID) {
          this.posMaintRptRefID = posMaintRptRefID;
      }
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.ClearingBusinessDate, required=true)
      public Date getClearingBusinessDate() {
          return clearingBusinessDate;
      }
  
      /**
       * Message field setter.
       * @param clearingBusinessDate field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.ClearingBusinessDate, required=true)
      public void setClearingBusinessDate(Date clearingBusinessDate) {
          this.clearingBusinessDate = clearingBusinessDate;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.SettlSessID)
      public String getSettlSessID() {
          return settlSessID;
      }
  
      /**
       * Message field setter.
       * @param settlSessID field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.SettlSessID)
      public void setSettlSessID(String settlSessID) {
          this.settlSessID = settlSessID;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.SettlSessSubID)
      public String getSettlSessSubID() {
          return settlSessSubID;
      }
  
      /**
       * Message field setter.
       * @param settlSessSubID field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.SettlSessSubID)
      public void setSettlSessSubID(String settlSessSubID) {
          this.settlSessSubID = settlSessSubID;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      public Parties getParties() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Sets the Parties component if used in this message to the proper implementation
       * class.
       */
      @FIXVersion(introduced="4.4")
      public void setParties() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Sets the Parties component to null.
       */
      @FIXVersion(introduced="4.4")
      public void clearParties() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced = "4.4")
      @TagNumRef(tagNum = TagNum.Account)
      public String getAccount() {
          return account;
      }
  
      /**
       * Message field setter.
       * @param account field value
       */
      @FIXVersion(introduced = "4.4")
      @TagNumRef(tagNum = TagNum.Account)
      public void setAccount(String account) {
          this.account = account;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced = "4.4")
      @TagNumRef(tagNum = TagNum.AcctIDSource)
      public AcctIDSource getAcctIDSource() {
          return acctIDSource;
      }
  
      /**
       * Message field setter.
       * @param acctIDSource field value
       */
      @FIXVersion(introduced = "4.4")
      @TagNumRef(tagNum = TagNum.AcctIDSource)
      public void setAcctIDSource(AcctIDSource acctIDSource) {
          this.acctIDSource = acctIDSource;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced = "4.4")
      @TagNumRef(tagNum = TagNum.AccountType)
      public AccountType getAccountType() {
          return accountType;
      }
  
      /**
       * Message field setter.
       * @param accountType field value
       */
      @FIXVersion(introduced = "4.4")
      @TagNumRef(tagNum = TagNum.AccountType)
      public void setAccountType(AccountType accountType) {
          this.accountType = accountType;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced = "4.4")
      public Instrument getInstrument() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Message field setter.
       */
      @FIXVersion(introduced="4.4")
      public void setInstrument() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Sets the instrument component to null.
       */
      @FIXVersion(introduced="4.4")
      public void clearInstrument() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.Currency)
      public Currency getCurrency() {
          return currency;
      }
  
      /**
       * Message field setter.
       * @param currency field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.Currency)
      public void setCurrency(Currency currency) {
          this.currency = currency;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.NoLegs)
      public Integer getNoLegs() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method sets the number of {@link InstrumentLeg} groups. It will also create an array
       * of {@link InstrumentLeg} objects and set the <code>instrumentLegs</code> field with this array.
       * The created objects inside the array need to be populated with data for encoding.<br/>
       * If there where already objects in <code>instrumentLegs</code> array they will be discarded.<br/>
       * @param noLegs field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.NoLegs)
      public void setNoLegs(Integer noLegs) {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Message field getter for {@link InstrumentLeg} array of groups.
       * @return field array value
       */
      @FIXVersion(introduced = "4.4")
      public InstrumentLeg[] getInstrumentLegs() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method adds a {@link InstrumentLeg} object to the existing array of <code>instrumentLegs</code>
       * and expands the static array with 1 place.<br/>
       * This method will also update <code>noLegs</code> field to the proper value.<br/>
       * Note: If the <code>setNoLegs</code> method has been called there will already be a number of objects in the
       * <code>instrumentLegs</code> array created.<br/>
       * @return newly created block and added to the array group object
       */
      @FIXVersion(introduced = "4.4")
      public InstrumentLeg addInstrumentLeg() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method deletes a {@link InstrumentLeg} object from the existing array of <code>instrumentLegs</code>
       * and shrink the static array with 1 place.<br/>
       * If the array does not have the index position then a null object will be returned.)<br/>
       * This method will also update <code>noLegs</code> field to the proper value.<br/>
       * @param index position in array to be deleted starting at 0
       * @return deleted block object
       */
      @FIXVersion(introduced = "4.4")
      public InstrumentLeg deleteInstrumentLeg(int index) {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Deletes all the {@link InstrumentLeg} objects from the <code>instrumentLegs</code> array
       * (sets the array to 0 length)<br/>
       * This method will also update <code>noLegs</code> field and set it to null.<br/>
       * @return number of elements in array cleared
       */
      @FIXVersion(introduced = "4.4")
      public int clearInstrumentLegs() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.NoUnderlyings)
      public Integer getNoUnderlyings() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method sets the number of {@link UnderlyingInstrument} components. It will also create an array
       * of {@link UnderlyingInstrument} objects and set the <code>underlyingInstruments</code>
       * field with this array.
       * The created objects inside the array need to be populated with data for encoding.<br/>
       * If there where already objects in <code>underlyingInstruments</code> array they will be discarded.<br/>
       * @param noUnderlyings number of MsgTypeGroup objects
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.NoUnderlyings)
      public void setNoUnderlyings(Integer noUnderlyings) {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Message field getter for {@link UnderlyingInstrument} array of groups.
       * @return field array value
       */
      @FIXVersion(introduced = "4.4")
      public UnderlyingInstrument[] getUnderlyingInstruments() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method adds a {@link UnderlyingInstrument} object to the existing array of <code>underlyingInstruments</code>
       * and expands the static array with 1 place.<br/>
       * This method will also update <code>noUnderlyings</code> field to the proper value.<br/>
       * Note: If the <code>setNoUnderlyings</code> method has been called there will already be a number of objects in the
       * <code>underlyingInstruments</code> array created.<br/>
       * @return newly created block and added to the array group object
       */
      @FIXVersion(introduced = "4.4")
      public UnderlyingInstrument addUnderlyingInstrument() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method deletes a {@link UnderlyingInstrument} object from the existing array of <code>underlyingInstruments</code>
       * and shrink the static array with 1 place.<br/>
       * If the array does not have the index position then a null object will be returned.)<br/>
       * This method will also update <code>noUnderlyings</code> field to the proper value.<br/>
       * @param index position in array to be deleted starting at 0
       * @return deleted block object
       */
      @FIXVersion(introduced = "4.4")
      public UnderlyingInstrument deleteUnderlyingInstrument(int index) {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Deletes all the {@link UnderlyingInstrument} objects from the <code>underlyingInstruments</code> array
       * (sets the array to 0 length)<br/>
       * This method will also update <code>noUnderlyings</code> field and set it to null.<br/>
       * @return number of elements in array cleared
       */
      @FIXVersion(introduced = "4.4")
      public int clearUnderlyingInstruments() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.NoTradingSessions)
      public Integer getNoTradingSessions() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method sets the number of {@link TradingSessionGroup} groups. It will also create an array
       * of {@link TradingSessionGroup} objects and set the <code>tradingSessionGroups</code> field with this array.
       * The created objects inside the array need to be populated with data for encoding.<br/>
       * If there where already objects in <code>tradingSessionGroups</code> array they will be discarded.<br/>
       * @param noAllocs field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.NoTradingSessions)
      public void setNoTradingSessions(Integer noAllocs) {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Message field getter for {@link TradingSessionGroup} array of groups.
       * @return field array value
       */
      @FIXVersion(introduced="4.4")
      public TradingSessionGroup[] getTradingSessionGroups() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method adds a {@link TradingSessionGroup} object to the existing array of <code>tradingSessionGroups</code>
       * and expands the static array with 1 place.<br/>
       * This method will also update <code>noTradingSessions</code> field to the proper value.<br/>
       * Note: If the <code>setNoTradingSessions</code> method has been called there will already be a number of objects in the
       * <code>tradingSessionGroups</code> array created.<br/>
       * @return newly created block and added to the array group object
       */
      @FIXVersion(introduced="4.4")
      public TradingSessionGroup addTradingSessionGroup() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method deletes a {@link TradingSessionGroup} object from the existing array of <code>tradingSessionGroups</code>
       * and shrink the static array with 1 place.<br/>
       * If the array does not have the index position then a null object will be returned.)<br/>
       * This method will also update <code>noTradingSessions</code> field to the proper value.<br/>
       * @param index position in array to be deleted starting at 0
       * @return deleted block object
       */
      @FIXVersion(introduced="4.4")
      public TradingSessionGroup deleteTradingSessionGroup(int index) {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Deletes all the {@link TradingSessionGroup} objects from the <code>tradingSessionGroups</code> array
       * (sets the array to 0 length)<br/>
       * This method will also update <code>noTradingSessions</code> field and set it to null.<br/>
       * @return number of elements in array cleared
       */
      @FIXVersion(introduced="4.4")
      public int clearTradingSessionGroups() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.TransactTime)
      public Date getTransactTime() {
          return transactTime;
      }
  
      /**
       * Message field setter.
       * @param transactTime field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.TransactTime)
      public void setTransactTime(Date transactTime) {
          this.transactTime = transactTime;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.NoPositions, required=true)
      public Integer getNoPositions() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method sets the number of {@link PositionQtyGroup} components. It will also create an array
       * of {@link PositionQtyGroup} objects and set the <code>positionQtyGroups</code>
       * field with this array.
       * The created objects inside the array need to be populated with data for encoding.<br/>
       * If there where already objects in <code>positionQtyGroups</code> array they will be discarded.<br/>
       * @param noPositions number of MsgTypeGroup objects
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.NoPositions, required=true)
      public void setNoPositions(Integer noPositions) {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Message field getter for {@link PositionQtyGroup} array of groups.
       * @return field array value
       */
      @FIXVersion(introduced = "4.4")
      public PositionQtyGroup[] getPositionQtyGroups() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method adds a {@link PositionQtyGroup} object to the existing array of <code>positionQtyGroups</code>
       * and expands the static array with 1 place.<br/>
       * This method will also update <code>noPositions</code> field to the proper value.<br/>
       * Note: If the <code>setNoTrdRegTimestamps</code> method has been called there will already be a number of objects in the
       * <code>positionQtyGroups</code> array created.<br/>
       * @return newly created block and added to the array group object
       */
      @FIXVersion(introduced = "4.4")
      public PositionQtyGroup addPositionQtyGroup() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method deletes a {@link PositionQtyGroup} object from the existing array of <code>positionQtyGroups</code>
       * and shrink the static array with 1 place.<br/>
       * If the array does not have the index position then a null object will be returned.)<br/>
       * This method will also update <code>noPositions</code> field to the proper value.<br/>
       * @param index position in array to be deleted starting at 0
       * @return deleted block object
       */
      @FIXVersion(introduced = "4.4")
      public PositionQtyGroup deletePositionQtyGroup(int index) {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Deletes all the {@link PositionQtyGroup} objects from the <code>positionQtyGroups</code> array
       * (sets the array to 0 length)<br/>
       * This method will also update <code>noPositions</code> field and set it to null.<br/>
       * @return number of elements in array cleared
       */
      @FIXVersion(introduced = "4.4")
      public int clearPositionQtyGroups() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="5.0")
      @TagNumRef(tagNum=TagNum.NoPosAmt)
      public Integer getNoPosAmt() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method sets the number of {@link PosAmtGroup} groups. It will also create an array
       * of {@link PosAmtGroup} objects and set the <code>posAmtGroups</code> field with this array.
       * The created objects inside the array need to be populated with data for encoding.<br/>
       * If there where already objects in <code>posAmtGroups</code> array they will be discarded.<br/>
       * @param noPosAmt field value
       */
      @FIXVersion(introduced="5.0")
      @TagNumRef(tagNum=TagNum.NoPosAmt)
      public void setNoPosAmt(Integer noPosAmt) {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Message field getter for {@link PosAmtGroup} array of groups.
       * @return field array value
       */
      @FIXVersion(introduced="5.0")
      public PosAmtGroup[] getPosAmtGroups() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method adds a {@link PosAmtGroup} object to the existing array of <code>posAmtGroups</code>
       * and expands the static array with 1 place.<br/>
       * This method will also update <code>noPosAmt</code> field to the proper value.<br/>
       * Note: If the <code>setNoPosAmt</code> method has been called there will already be a number of objects in the
       * <code>posAmtGroups</code> array created.<br/>
       * @return newly created block and added to the array group object
       */
      @FIXVersion(introduced="5.0")
      public PosAmtGroup addPosAmtGroup() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * This method deletes a {@link PosAmtGroup} object from the existing array of <code>posAmtGroups</code>
       * and shrink the static array with 1 place.<br/>
       * If the array does not have the index position then a null object will be returned.)<br/>
       * This method will also update <code>noPosAmt</code> field to the proper value.<br/>
       * @param index position in array to be deleted starting at 0
       * @return deleted block object
       */
      @FIXVersion(introduced="5.0")
      public PosAmtGroup deletePosAmtGroup(int index) {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Deletes all the {@link PosAmtGroup} objects from the <code>posAmtGroups</code> array
       * (sets the array to 0 length)<br/>
       * This method will also update <code>noPosAmt</code> field and set it to null.<br/>
       * @return number of elements in array cleared
       */
      @FIXVersion(introduced="5.0")
      public int clearPosAmtGroups() {
          throw new UnsupportedOperationException(getUnsupportedTagMessage());
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.AdjustmentType)
      public AdjustmentType getAdjustmentType() {
          return adjustmentType;
      }
  
      /**
       * Message field setter.
       * @param adjustmentType field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.AdjustmentType)
      public void setAdjustmentType(AdjustmentType adjustmentType) {
          this.adjustmentType = adjustmentType;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.ContraryInstructionIndicator)
      public Boolean getContraryInstructionIndicator() {
          return contraryInstructionIndicator;
      }
  
      /**
       * Message field setter.
       * @param contraryInstructionIndicator field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.ContraryInstructionIndicator)
      public void setContraryInstructionIndicator(Boolean contraryInstructionIndicator) {
          this.contraryInstructionIndicator = contraryInstructionIndicator;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.PriorSpreadIndicator)
      public Boolean getPriorSpreadIndicator() {
          return priorSpreadIndicator;
      }
  
      /**
       * Message field setter.
       * @param priorSpreadIndicator field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.PriorSpreadIndicator)
      public void setPriorSpreadIndicator(Boolean priorSpreadIndicator) {
          this.priorSpreadIndicator = priorSpreadIndicator;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.ThresholdAmount)
      public Double getThresholdAmount() {
          return thresholdAmount;
      }
  
      /**
       * Message field setter.
       * @param thresholdAmount field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.ThresholdAmount)
      public void setThresholdAmount(Double thresholdAmount) {
          this.thresholdAmount = thresholdAmount;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.Text)
      public String getText() {
          return text;
      }
  
      /**
       * Message field setter.
       * @param text field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.Text)
      public void setText(String text) {
          this.text = text;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.EncodedTextLen)
      public Integer getEncodedTextLen() {
          return encodedTextLen;
      }
  
      /**
       * Message field setter.
       * @param encodedTextLen field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.EncodedTextLen)
      public void setEncodedTextLen(Integer encodedTextLen) {
          this.encodedTextLen = encodedTextLen;
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.EncodedText)
      public byte[] getEncodedText() {
          return encodedText;
      }
  
      /**
       * Message field setter.
       * @param encodedText field value
       */
      @FIXVersion(introduced="4.4")
      @TagNumRef(tagNum=TagNum.EncodedText)
      public void setEncodedText(byte[] encodedText) {
          this.encodedText = encodedText;
          if (encodedTextLen == null) {
              encodedTextLen = new Integer(encodedText.length);
          }
      }
  
      /**
       * Message field getter.
       * @return field value
       */
      @FIXVersion(introduced="5.0")
      @TagNumRef(tagNum=TagNum.SettlCurrency)
      public Currency getSettlCurrency() {
          return settlCurrency;
      }
  
      /**
       * Message field setter.
       * @param settlCurrency field value
       */
      @FIXVersion(introduced="5.0")
      @TagNumRef(tagNum=TagNum.SettlCurrency)
      public void setSettlCurrency(Currency settlCurrency) {
          this.settlCurrency = settlCurrency;
      }
      
      // </editor-fold>
  
      // <editor-fold defaultstate="collapsed" desc="Protected Methods">
  
      @Override
      protected void validateRequiredTags() throws TagNotPresentException {
          StringBuilder errorMsg = new StringBuilder("Tag value(s) for");
          boolean hasMissingTag = false;
          if (posTransType == null) {
              errorMsg.append(" [PosTransType]");
              hasMissingTag = true;
          }
          if (posMaintAction == null) {
              errorMsg.append(" [PosMaintAction]");
              hasMissingTag = true;
          }
          if (clearingBusinessDate == null) {
              errorMsg.append(" [ClearingBusinessDate]");
              hasMissingTag = true;
          }
          if (parties == null || parties.getNoPartyIDs() == null) {
              errorMsg.append(" [Parties]");
              hasMissingTag = true;
          }
          if (instrument == null || instrument.getSymbol() == null || instrument.getSymbol().trim().isEmpty()) {
              errorMsg.append(" [Symbol]");
              hasMissingTag = true;
          }
          if (noPositions == null || positionQtyGroups == null || positionQtyGroups.length == 0) {
              errorMsg.append(" [NoPositions]");
              hasMissingTag = true;
          }
          errorMsg.append(" is missing.");
          if (hasMissingTag) {
              throw new TagNotPresentException(errorMsg.toString());
          }
      }
  
      @Override
      protected byte[] encodeFragmentAll() throws TagNotPresentException, BadFormatMsgException {
          if (validateRequired) {
              validateRequiredTags();
          }
          byte[] result = new byte[0];
          ByteArrayOutputStream bao = new ByteArrayOutputStream();
          try {
              TagEncoder.encode(bao, TagNum.PosReqID, posReqID);
              if (posTransType != null) {
                  TagEncoder.encode(bao, TagNum.PosTransType, posTransType.getValue());
              }
              if (posMaintAction != null) {
                  TagEncoder.encode(bao, TagNum.PosMaintAction, posMaintAction.getValue());
              }
              TagEncoder.encode(bao, TagNum.OrigPosReqRefID, origPosReqRefID);
              TagEncoder.encode(bao, TagNum.PosMaintRptRefID, posMaintRptRefID);
              TagEncoder.encodeDate(bao, TagNum.ClearingBusinessDate, clearingBusinessDate);
              TagEncoder.encode(bao, TagNum.SettlSessID, settlSessID);
              TagEncoder.encode(bao, TagNum.SettlSessSubID, settlSessSubID);
              if (parties != null) {
                  bao.write(parties.encode(MsgSecureType.ALL_FIELDS));
              }
              TagEncoder.encode(bao, TagNum.Account, account);
              if (acctIDSource != null) {
                  TagEncoder.encode(bao, TagNum.AcctIDSource, acctIDSource.getValue());
              }
              if (accountType != null) {
                  TagEncoder.encode(bao, TagNum.AccountType, accountType.getValue());
              }
              if (instrument != null) {
                  bao.write(instrument.encode(MsgSecureType.ALL_FIELDS));
              }
              if (currency != null) {
                  TagEncoder.encode(bao, TagNum.Currency, currency.getValue());
              }
              if (noLegs != null) {
                  TagEncoder.encode(bao, TagNum.NoLegs, noLegs);
                  if (instrumentLegs != null && instrumentLegs.length == noLegs.intValue()) {
                      for (InstrumentLeg instrumentLeg : instrumentLegs) {
                          bao.write(instrumentLeg.encode(MsgSecureType.ALL_FIELDS));
                      }
                  } else {
                      String error = "InstrumentLegs field has been set but there is no data or the number of components does not match.";
                      LOGGER.severe(error);
                      throw new BadFormatMsgException(SessionRejectReason.IncorrectCountForGroups, getHeader().getMsgType(),
                          TagNum.NoLegs.getValue(), error);
                  }
              }
              if (noUnderlyings != null) {
                  TagEncoder.encode(bao, TagNum.NoUnderlyings, noUnderlyings);
                  if (underlyingInstruments != null && underlyingInstruments.length == noUnderlyings.intValue()) {
                      for (int i = 0; i < noUnderlyings.intValue(); i++) {
                          if (underlyingInstruments[i] != null) {
                              bao.write(underlyingInstruments[i].encode(MsgSecureType.ALL_FIELDS));
                          }
                      }
                  } else {
                      String error = "UnderlyingInstrument field has been set but there is no data or the number of groups does not match.";
                      LOGGER.severe(error);
                      throw new BadFormatMsgException(SessionRejectReason.IncorrectCountForGroups, getHeader().getMsgType(),
                              TagNum.NoUnderlyings.getValue(), error);
                  }
              }
              if (noTradingSessions != null && noTradingSessions.intValue() > 0) {
                  TagEncoder.encode(bao, TagNum.NoTradingSessions, noTradingSessions);
                  if (tradingSessionGroups != null && tradingSessionGroups.length == noTradingSessions.intValue()) {
                      for (int i = 0; i < noTradingSessions.intValue(); i++) {
                          if (tradingSessionGroups[i] != null) {
                              bao.write(tradingSessionGroups[i].encode(MsgSecureType.ALL_FIELDS));
                          }
                      }
                  } else {
                      String error = "TradingSessionsGroup field has been set but there is no data or the number of groups does not match.";
                      LOGGER.severe(error);
                      throw new BadFormatMsgException(SessionRejectReason.IncorrectCountForGroups, getHeader().getMsgType(),
                              TagNum.NoTradingSessions.getValue(), error);
                  }
              }
              TagEncoder.encodeUtcTimestamp(bao, TagNum.TransactTime, transactTime);
              if (noPositions != null) {
                  TagEncoder.encode(bao, TagNum.NoPositions, noPositions);
                  if (positionQtyGroups != null && positionQtyGroups.length == noPositions.intValue()) {
                      for (int i = 0; i < noPositions.intValue(); i++) {
                          if (positionQtyGroups[i] != null) {
                              bao.write(positionQtyGroups[i].encode(MsgSecureType.ALL_FIELDS));
                          }
                      }
                  } else {
                      String error = "PositionQtyGroups field has been set but there is no data or the number of groups does not match.";
                      LOGGER.severe(error);
                      throw new BadFormatMsgException(SessionRejectReason.IncorrectCountForGroups, getHeader().getMsgType(),
                              TagNum.NoPositions.getValue(), error);
                  }
              }
              if (noPosAmt != null) {
                  TagEncoder.encode(bao, TagNum.NoPosAmt, noPosAmt);
                  if (posAmtGroups != null && posAmtGroups.length == noPosAmt.intValue()) {
                      for (int i = 0; i < noPosAmt.intValue(); i++) {
                          if (posAmtGroups[i] != null) {
                              bao.write(posAmtGroups[i].encode(MsgSecureType.ALL_FIELDS));
                          }
                      }
                  } else {
                      String error = "PosAmtGroups field has been set but there is no data or the number of groups does not match.";
                      LOGGER.severe(error);
                      throw new BadFormatMsgException(SessionRejectReason.IncorrectCountForGroups, getHeader().getMsgType(),
                              TagNum.NoPosAmt.getValue(), error);
                  }
              }
              if (adjustmentType != null) {
                  TagEncoder.encode(bao, TagNum.AdjustmentType, adjustmentType.getValue());
              }
              TagEncoder.encode(bao, TagNum.ContraryInstructionIndicator, contraryInstructionIndicator);
              TagEncoder.encode(bao, TagNum.PriorSpreadIndicator, priorSpreadIndicator);
              TagEncoder.encode(bao, TagNum.ThresholdAmount, thresholdAmount);
              TagEncoder.encode(bao, TagNum.Text, text);
              if (encodedTextLen != null && encodedTextLen.intValue() > 0) {
  