DataCellDateYYYYMMDD Class

This class handles conversion to and from the date data type in the common YYYYMMDD format to the schema language date data type in ISO 8601 date format, that is, YYYY-MM-DD. In keeping with our strategy of using schema validation as our primary data validation mechanism, I include error checking sufficient to prevent only most runtime exceptions.

Logic for the DataCellDateYYYYMMDD fromXML Method
Arguments:
  None

Returns:
  Error status or throws exception

IF Buffer Length != 10
  Return error
ENDIF
Month <- Cell Buffer characters at offsets 5 and 6
Day <- Cell Buffer characters at offsets 8 and 9
Year <- Cell Buffer characters at offsets 0 through 3
Cell Buffer <- Year + Month + Day
Return success

Logic for the DataCellDateYYYYMMDD toXML Method
Arguments:
  None

Returns:
  Error status or throws exception

Cell Buffer < trim leading and trailing whitespace from
    Cell Buffer
IF Buffer Length != 8
  Return error
ENDIF
Year <- Cell Buffer characters at offsets 0 through 3
Month <- Cell Buffer characters at offsets 4 and 5
Day <- Cell Buffer characters at offsets 6 and 7
Cell Buffer <- Year + "-" + Month + "-" + Day
Return success

The prepareOutput method performs left-justification and fills as necessary with the specified fill character. This date data type may not be truncated, so there is no code that deals with truncation. In addition, since the fromXML method ensures that we have the correct length we're not concerned with exceeding the specified length.

Logic for the DataCellDateYYYYMMDD prepareOutput Method
Arguments:
  None

Returns:
  Status or throws exception

Length <- Call Grammar Element's getAttribute for "Length"
Call fillField, passing 'L' for left justification, and Length
Return success

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset