Class JCoHelper.RecordWrapper

  • Enclosing class:
    JCoHelper

    public static final class JCoHelper.RecordWrapper
    extends java.lang.Object
    Wraps around a JCo record and decorates the record with convenient methods to set the record's data.
    An important feature is that changelists (the X-structures) are maintained transparently and that you are able to directly pass the higher level internet sales data structures to the JCo struct.
    Secondly the handling of boolean values is improved (no more "X").
    Version:
    1.0
    • Constructor Summary

      Constructors 
      Constructor Description
      RecordWrapper​(com.sap.conn.jco.JCoRecord record)
      Creates a new wrapper around the JCo structure.
      RecordWrapper​(com.sap.conn.jco.JCoRecord record, com.sap.conn.jco.JCoRecord changeList)
      Creates a new wrapper around the JCo record.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean getBoolean​(java.lang.String field)
      Returns the value of the specified field as a Java language boolean primitive type.
      com.sap.conn.jco.JCoRecord getChangeList()
      Returns the JCO.Record that is wrapped by this class and is used as a X-Structure.
      com.sap.conn.jco.JCoRecord getRecord()
      Returns the JCO.Record that is wrapped by this class.
      java.lang.String getString​(java.lang.String field)
      Returns the value of the specified field as a Java language String object.
      TechKey getTechKey​(java.lang.String field)
      Returns the value of the specified field as a TechKey object.
      void setValue​(boolean value, java.lang.String field)
      Sets the given field of the JCo structure to the provided value.
      void setValue​(boolean value, java.lang.String field, boolean maintainChange)
      Sets the given field of the JCo structure to the provided value.
      void setValue​(double value, java.lang.String field)
      Sets the given field of the JCo structure to the provided value.
      void setValue​(double value, java.lang.String field, boolean maintainChange)
      Sets the given field of the JCo structure to the provided value.
      void setValue​(int value, java.lang.String field)
      Sets the given field of the JCo structure to the provided value.
      void setValue​(int value, java.lang.String field, boolean maintainChange)
      Sets the given field of the JCo structure to the provided value.
      void setValue​(TechKey techkey, java.lang.String field)
      Sets the given field of the JCo structure to the value of the provided technical key (the TechKey is an abstraction of the SAP GUI).
      void setValue​(TechKey techkey, java.lang.String field, boolean maintainChange)
      Sets the given field of the JCo record to the value of the provided technical key (the TechKey is an abstraction of the SAP GUI).
      void setValue​(java.lang.String value, java.lang.String field)
      Sets the given field of the JCo structure to the provided value.
      void setValue​(java.lang.String value, java.lang.String field, boolean maintainChange)
      Sets the given field of the JCo structure to the provided value.
      void setValueFilledLeft​(java.lang.String value, java.lang.String field, java.lang.String filler)
      Sets the given field of the JCo structure to the provided value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RecordWrapper

        public RecordWrapper​(com.sap.conn.jco.JCoRecord record,
                             com.sap.conn.jco.JCoRecord changeList)
        Creates a new wrapper around the JCo record.
        Parameters:
        record - The record to store the data in
        changeList - Changelist used by the X-structures
      • RecordWrapper

        public RecordWrapper​(com.sap.conn.jco.JCoRecord record)
        Creates a new wrapper around the JCo structure.
        Parameters:
        record - The record to store the data in
    • Method Detail

      • getRecord

        public com.sap.conn.jco.JCoRecord getRecord()
        Returns the JCO.Record that is wrapped by this class.
        Returns:
        the wrapped JCoRecord
      • getChangeList

        public com.sap.conn.jco.JCoRecord getChangeList()
        Returns the JCO.Record that is wrapped by this class and is used as a X-Structure.
        Returns:
        the wrapped JCoRecord
      • setValue

        public void setValue​(java.lang.String value,
                             java.lang.String field)
        Sets the given field of the JCo structure to the provided value. The changelist, if present, is automatically maintained.
        Parameters:
        value - Value to be set
        field - JCo field to be filled with the value
      • setValueFilledLeft

        public void setValueFilledLeft​(java.lang.String value,
                                       java.lang.String field,
                                       java.lang.String filler)
        Sets the given field of the JCo structure to the provided value. The value is filled up with filler to the left The changelist, if present, is automatically maintained.
        Parameters:
        value - Value to be set
        field - JCo field to be filled with the value
        filler - The single-char-string to fill up value to the left
      • setValue

        public void setValue​(java.lang.String value,
                             java.lang.String field,
                             boolean maintainChange)
        Sets the given field of the JCo structure to the provided value. The changelist, if present, is only maintained if the maintainChange flag is set to true.
        Parameters:
        value - Value to be set
        field - JCo field to be filled with the value
        maintainChange - Indicates whether the changelist should be maintained or not
      • setValue

        public void setValue​(int value,
                             java.lang.String field)
        Sets the given field of the JCo structure to the provided value. The changelist, if present, is automatically maintained.
        Parameters:
        value - Value to be set
        field - JCo field to be filled with the value
      • setValue

        public void setValue​(double value,
                             java.lang.String field)
        Sets the given field of the JCo structure to the provided value. The changelist, if present, is automatically maintained.
        Parameters:
        value - Value to be set
        field - JCo field to be filled with the value
      • setValue

        public void setValue​(int value,
                             java.lang.String field,
                             boolean maintainChange)
        Sets the given field of the JCo structure to the provided value. The changelist, if present, is only maintained if the maintainChange flag is set to true.
        Parameters:
        value - Value to be set
        field - JCo field to be filled with the value
        maintainChange - Indicates whether the changelist should be maintained or not
      • setValue

        public void setValue​(double value,
                             java.lang.String field,
                             boolean maintainChange)
        Sets the given field of the JCo structure to the provided value. The changelist, if present, is only maintained if the maintainChange flag is set to true.
        Parameters:
        value - Value to be set
        field - JCo field to be filled with the value
        maintainChange - Indicates whether the changelist should be maintained or not
      • setValue

        public void setValue​(boolean value,
                             java.lang.String field)
        Sets the given field of the JCo structure to the provided value. The changelist, if present, is automatically maintained.
        Parameters:
        value - Value to be set
        field - JCo field to be filled with the value
      • setValue

        public void setValue​(boolean value,
                             java.lang.String field,
                             boolean maintainChange)
        Sets the given field of the JCo structure to the provided value. The changelist, if present, is only maintained if the maintainChange flag is set to true.
        Parameters:
        value - Value to be set
        field - JCo field to be filled with the value
        maintainChange - Indicates whether the changelist should be maintained or not
      • setValue

        public void setValue​(TechKey techkey,
                             java.lang.String field)
        Sets the given field of the JCo structure to the value of the provided technical key (the TechKey is an abstraction of the SAP GUI).
        The changelist, if present, is automatically maintained.
        If the provided key is null nothing is done and the method returns immediately.
        Parameters:
        techkey - Technical key to be set
        field - JCo field to be filled with the value
      • setValue

        public void setValue​(TechKey techkey,
                             java.lang.String field,
                             boolean maintainChange)
        Sets the given field of the JCo record to the value of the provided technical key (the TechKey is an abstraction of the SAP GUI).
        The changelist, if present, is only maintained if the maintainChange flag is set to true.
        If the provided tech key is null nothing is done and the method returns immediately.
        Parameters:
        techkey - Technical key to be set
        field - JCo field to be filled with the value
        maintainChange - Indicates whether the changelist should be maintained or not
      • getTechKey

        public TechKey getTechKey​(java.lang.String field)
        Returns the value of the specified field as a TechKey object.
        Parameters:
        field - JCo field to be retrieved
        Returns:
        TechKey constructed from the value of the given field
      • getString

        public java.lang.String getString​(java.lang.String field)
        Returns the value of the specified field as a Java language String object.
        Parameters:
        field - JCo field to be retrieved
        Returns:
        String constructed from the value of the given field
      • getBoolean

        public boolean getBoolean​(java.lang.String field)
        Returns the value of the specified field as a Java language boolean primitive type.
        Parameters:
        field - JCo field to be retrieved
        Returns:
        Boolean constructed from the value of the given field