Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## examples.e2e.common
Class BuyerFactory

    java.lang.Object
      |
      +--examples.e2e.common.BuyerFactory

public class BuyerFactory
extends java.lang.Object

This class provides various methods for obtaining, deleting and parsing XML and data files for the portal application.

Field Summary
`static java.lang.String` | `DATA_LOCATION_PROPERTY` The value of this system property is used to determine the location of XML files containing application data.
`static java.lang.String` | `PO_ACK_DATA_FILE` The name of the file produced by the workflow engine containing acknowledged purchase order data.
`static java.lang.String` | `PO_ACK_FILE` The name of the file produced by the workflow engine containing an acknowledged purchase order.
`static java.lang.String` | `PO_DATA_FILE` The name of the file produced by the workflow engine containing purchase order data.
`static java.lang.String` | `PO_FILE` The name of the file produced by the workflow engine containing a purchase order.
`static java.lang.String` | `QUOTE_FILE` The name of the file produced by the workflow engine containing a collection of quotes in response to a query for price and availability (`QPA`).
`static java.lang.String` | `STATIC_PO_BASE_NAME` The base file name for XML documents containing static purchase orders.
`static java.lang.String` | `XML_SUFFIX` The value of this constant is ".xml".
`static java.lang.String` | `xmlDateFormatString` Used to format and parse date strings in XML documents.

Method Summary
`static QPA` | `createQPA(java.lang.String productId, java.lang.String requestId, java.lang.String description, Money desiredUnitPrice, long desiredQty, java.util.Calendar creationDate, java.util.Calendar desiredDate)` Returns a ``QPA`` object populated from the method parameters.
`static void` | `deletePoXML()` This method deletes the purchase order XML and data files for the application.
`static void` | `deleteXML()` This method deletes the XML and data files for the application.
`static boolean` | `doesPOAckXMLExist()` Returns true if the PO_ACK_FILE exists and is a file (not a directory).
`static boolean` | `doesQuoteXMLExist()` Returns true if the QUOTE_FILE exists and is a file (not a directory).
`static java.lang.String` | `getDataLocation()` Returns the path to the data directory.
`static org.xml.sax.InputSource` | `getPOSource()` Obtains an `org.xml.sax.InputSource` based on the following rules: If the PO_ACK_FILE exists its `InputSource` is returned.
`static org.xml.sax.InputSource` | `getQuoteSource()` Obtains an `org.xml.sax.InputSource` corresponding to the QUOTE_FILE.
`static org.xml.sax.InputSource` | `getSource(java.lang.ClassLoader classloader, java.lang.String name)` Obtains the `InputSource` corresponding to the specified file name.
`static java.util.List` | `getStaticPOSources()` Returns a `List` of `InputSource` objects for the static purchase order source files present in the data directory.
`static PO` | `parsePO(org.xml.sax.InputSource source)` Returns a `List` of ``PO`` objects populated from the data supplied in the XML document.
`static java.util.List` | `parsePOs(java.util.List srcs)` Returns a `List` of ``PO`` objects populated from the data supplied in the XML document.
`static java.util.List` | `parseQuote(org.xml.sax.InputSource source)` Returns a `List` of `PurchaseQuote` objects populated from the data supplied in the XML document specified as an `org.xml.sax.InputSource`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### xmlDateFormatString

    public static final java.lang.String xmlDateFormatString

  Used to format and parse date strings in XML documents. Dates should be constructed in the form "yyyyMMdd" (see java.text.SimpleDateFormat for details) to be successfully parsed.

### STATIC_PO_BASE_NAME

    public static final java.lang.String STATIC_PO_BASE_NAME

  The base file name for XML documents containing static purchase orders. Files are located using the value of the system property defined by the constant DATA_LOCATION_PROPERTY as a path. The value of this constant is "staticPO".
  See Also:
    `DATA_LOCATION_PROPERTY`, `getStaticPOSources()`

### QUOTE_FILE

    public static final java.lang.String QUOTE_FILE

  The name of the file produced by the workflow engine containing a collection of quotes in response to a query for price and availability (`QPA`). The file is located using the value of the system property defined by the constant DATA_LOCATION_PROPERTY as a path. The value of this constant is "E2E_AggregatedQPAResponse.xml".
  See Also:
    `DATA_LOCATION_PROPERTY`

### PO_FILE

    public static final java.lang.String PO_FILE

  The name of the file produced by the workflow engine containing a purchase order. The file is located using the value of the system property defined by the constant DATA_LOCATION_PROPERTY as a path. The value of this constant is "E2E_PO.xml".
  See Also:
    `DATA_LOCATION_PROPERTY`

### PO_DATA_FILE

    public static final java.lang.String PO_DATA_FILE

  The name of the file produced by the workflow engine containing purchase order data. The file is located using the value of the system property defined by the constant DATA_LOCATION_PROPERTY as a path. The value of this constant is "E2E_PO.data".
  See Also:
    `DATA_LOCATION_PROPERTY`

### PO_ACK_FILE

    public static final java.lang.String PO_ACK_FILE

  The name of the file produced by the workflow engine containing an acknowledged purchase order. The file is located using the value of the system property defined by the constant DATA_LOCATION_PROPERTY as a path. The value of this constant is "E2E_POAcknowledgement.xml".
  See Also:
    `DATA_LOCATION_PROPERTY`

### PO_ACK_DATA_FILE

    public static final java.lang.String PO_ACK_DATA_FILE

  The name of the file produced by the workflow engine containing acknowledged purchase order data. The file is located using the value of the system property defined by the constant DATA_LOCATION_PROPERTY as a path. The value of this constant is "E2E_POAcknowledgement.data".
  See Also:
    `DATA_LOCATION_PROPERTY`

### XML_SUFFIX

    public static final java.lang.String XML_SUFFIX

  The value of this constant is ".xml".

### DATA_LOCATION_PROPERTY

    public static final java.lang.String DATA_LOCATION_PROPERTY

  The value of this system property is used to determine the location of XML files containing application data. In most cases, these files are generated by the workflow engine in response to a query or submission.
  See Also:
    `STATIC_PO_BASE_NAME`, `QUOTE_FILE`, `PO_FILE`, `PO_ACK_FILE`, `getQuoteSource()`, `getPOSource()`, `getStaticPOSources()`

Method Detail

### createQPA

    public static QPA createQPA(java.lang.String productId,
                                java.lang.String requestId,
                                java.lang.String description,
                                Money desiredUnitPrice,
                                long desiredQty,
                                java.util.Calendar creationDate,
                                java.util.Calendar desiredDate)

  Returns a ``QPA`` object populated from the method parameters.

  Parameters:
    `productId` - the identifier for the product to be quoted.
    `requestId` - the unique identifier for this QPA request.
    `description` - the product description.
    `desiredUnitPrice` - the price the buyer would like to pay for the product.
    `desiredQty` - the quantity of product the buyer would like quoted.
    `creationDate` - the creation date for this QPA.
    `desiredDate` - the date the purchaser desires to receive the product.
  Returns:
    a ``QPA`` object.
  See Also:
    `QPA`

### parseQuote

    public static java.util.List parseQuote(org.xml.sax.InputSource source)
                                     throws ParsingException

  Returns a `List` of `PurchaseQuote` objects populated from the data supplied in the XML document specified as an `org.xml.sax.InputSource`.

  Parameters:
    `source` - `org.xml.sax.InputSource` XML to be parsed.
  Returns:
    a `List` of `PurchaseQuote` objects.
  Throws:
    ParsingException - if the XML cannot be parsed successfully.
  See Also:
    `PurchaseQuote`

### parsePO

    public static PO parsePO(org.xml.sax.InputSource source)
                      throws ParsingException

  Returns a `List` of ``PO`` objects populated from the data supplied in the XML document.

  Parameters:
    `source` - xml `InputSource` to use to create `PurchaseQuote`s.

### parsePOs

    public static java.util.List parsePOs(java.util.List srcs)
                                   throws ParsingException

  Returns a `List` of ``PO`` objects populated from the data supplied in the XML document.

  Parameters:
    `srcs` - xml `InputSource` to use to create `PurchaseQuote`s.

### getQuoteSource

    public static org.xml.sax.InputSource getQuoteSource()

  Obtains an `org.xml.sax.InputSource` corresponding to the QUOTE_FILE.

  Returns:
    an `InputSource` or null if the file does not exist.
  See Also:
    `QUOTE_FILE`

### getPOSource

    public static org.xml.sax.InputSource getPOSource()

  Obtains an `org.xml.sax.InputSource` based on the following rules: If the PO_ACK_FILE exists its `InputSource` is returned. If the PO_ACK_FILE does not exist but PO_FILE does exist, an `InputSource` corresponding to PO_FILE will be returned. Null will be returned otherwise

  Returns:
    an `InputSource` or null if the files does not exist.
  See Also:
    `PO_FILE`, `PO_ACK_FILE`

### getStaticPOSources

    public static java.util.List getStaticPOSources()

  Returns a `List` of `InputSource` objects for the static purchase order source files present in the data directory. Static purchase order source files are of the form: STATIC_PO_BASE_NAME<n>XML_SUFFIX where `n` is a positive integer. When searching for files, this method sets `n` to zero and attempts to find the first file. If finding the file is succesful `n` is incremented and the method tries to find the next file. The method quits when a file cannot be found.

  Returns:
    a `List` of `InputSource`s will be returned, one for each static source present. If no static source files exist than null will be returned.
  See Also:
    `STATIC_PO_BASE_NAME`, `XML_SUFFIX`

### getSource

    public static org.xml.sax.InputSource getSource(java.lang.ClassLoader classloader,
                                                    java.lang.String name)

  Obtains the `InputSource` corresponding to the specified file name. The specified classloader and its classpath are used when attempting to locate the file.

  Parameters:
    `classloader` - a classloader to use to locate the file
    `name` - the name of the file to locate
  Returns:
    the corresponding `InputSource` or null if the classloader was unable to locate the file.

### deleteXML

    public static void deleteXML()
                          throws java.lang.NullPointerException,
                                 java.lang.SecurityException,
                                 java.lang.RuntimeException

  This method deletes the XML and data files for the application.

  See Also:
    `QUOTE_FILE`, `PO_FILE`, `PO_DATA_FILE`, `PO_ACK_FILE`, `PO_ACK_DATA_FILE`

### deletePoXML

    public static void deletePoXML()
                            throws java.lang.NullPointerException,
                                   java.lang.SecurityException,
                                   java.lang.RuntimeException

  This method deletes the purchase order XML and data files for the application.

  See Also:
    `PO_FILE`, `PO_DATA_FILE`, `PO_ACK_FILE`, `PO_ACK_DATA_FILE`

### doesQuoteXMLExist

    public static boolean doesQuoteXMLExist()

  Returns true if the QUOTE_FILE exists and is a file (not a directory).

  See Also:
    `QUOTE_FILE`

### doesPOAckXMLExist

    public static boolean doesPOAckXMLExist()

  Returns true if the PO_ACK_FILE exists and is a file (not a directory).

  See Also:
    `PO_ACK_FILE`

### getDataLocation

    public static java.lang.String getDataLocation()
                                            throws java.lang.NullPointerException,
                                                   java.lang.SecurityException,
                                                   java.lang.RuntimeException

  Returns the path to the data directory. The path is determined by the value of the system property defined by the constant DATA_LOCATION_PROPERTY.

  Returns:
    a non-null path to the data directory or throws an exception if unable to obtain the system property or the value of the property is null.
  Throws:
    java.lang.NullPointerException - if the value of the property is null.
    java.lang.SecurityException - if denied access to the value of the property in the system properties.
    java.lang.RuntimeException - for any other error accessing or obtaining the system properties.
  See Also:
    `DATA_LOCATION_PROPERTY`

Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 BEA Systems, Inc. All Rights Reserved