product.tex 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. \section{Product}
  2. \label{sec:product}
  3. \salespoint{} is intended as framework for point-of-sale applications.
  4. The items for sale are called ``products'' and represented by instances of classes who implement the \code{Product} interface.
  5. A general overview of the \salespoint{} products subsystem is given in Figure \ref{product_overview}.
  6. To represent different kinds of products, \code{PersistentProduct} can be sub-classed; see Section \ref{jpa-types} for more information.
  7. \code{PersistentProduct}s are aggregated by \code{PersistentCatalog} (see Section \ref{sec:catalog}).
  8. \begin{figure}
  9. \centering
  10. \includegraphics[width=1.0\textwidth]{images/Product_Overview.eps}
  11. \label{product_overview}
  12. \caption{Product - Class Overview}
  13. \end{figure}
  14. \code{Product}s are supposed to be an abstraction, like an item on display or a picture in a catalog.
  15. \code{ProductInstance}s are used to represent the actual item you get, when you a buy a product.
  16. \code{Product}s are identified using a \code{ProductIndentifier}, whereas \code{ProductInstance}s are identified by a \code{SerialNumber}.
  17. \code{ProductInstance}s can be thought of as identifiable instances of a certain product, which are identical apart from their \code{SerialNumber}.
  18. \\
  19. To conviently handle products, which are essentially the same but differ in certain aspects, such as color or size \salespoint{} has the concept of a \code{ProductFeature}.
  20. \code{ProductFeature}s are specified by a \code{featureType}, for example color or size, and a corresponding \code{value}, for example ``black'' or ``blue'' for the feature ``color''.
  21. Additionally a \code{ProductFeature} may reference a \code{Money} object, to describe an increase or decrease in price of a \code{Product}, if it has a certain \code{ProductFeature}.
  22. Alternatively, a change in price can be expressed as a percentage of the price of the \code{Product}.
  23. An example: A class \code{Shoe} extends \code{PersistentProduct} and has a \code{Set<ProductFeature>} containg the values 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 of the \code{productType} ``size''.
  24. The set of \code{ProductFeature}s declared in \code{PersistentProduct} defines, which \code{ProductFeature}s can be aggregated by the corresponding \code{ProductInstance}.
  25. An instance of \code{Shoe} represents a specific model a vendor might have.
  26. Additionally, a class \code{ShoeInstance} may sub-class \code{PersistentProductInstance}.
  27. An instance of \code{ShoeInstance} represents a specific pair of shoes.
  28. \code{ProductInstance} also aggregates \code{ProductFeature}s, but in contrast to \code{Product} exactly one \code{ProductFeature} is allowed for any \code{featureType}.
  29. In other words: a shoe has a size - exactly one size.
  30. \\
  31. %\subsection{\code{ServiceType} - Realizing Services}
  32. %The interface \code{ServiceType} is implemented by the class \code{PersistentServiceType}. With this class you can realize services in your implementation, which represents a process
  33. %or activity that is offered for sale, for example a haircut on a barber shop or a driving lesson on a driving school.\\
  34. %Every \code{PersistentServiceType} has a name and a price and can contains a start time and an end time. Between these dates the \code{PersistentServiceType} can be executed. If these dates
  35. %don't exist, the \code{PersistentServiceType} always is offered.
  36. %\subsection{\code{Service} - Representing ServiceTypes}
  37. %The interface \code{Service} is implemented by \code{PersistentService}, which represents one specified \code{PersistentServiceType}. The \code{PersistentService} has a
  38. %start time and an end time like its \code{PersistentServiceType}. The start time must be after the start time of \code{PersistentServiceType} and before the end time of
  39. %\code{PersistentService}. The end time must be before the end time of \code{PersistentServiceType}.\\
  40. %Otherwise it will be thrown exceptions:
  41. %\begin{itemize}
  42. %\item \code{IllegalArgumentException}: If the \code{Service} end before it starts.
  43. %\item \code{IllegalArgumentException}: If the \code{Service} begin before the period of \code{ServiceType} has begun.
  44. %\item \code{IllegalArgumentException}: If the \code{ServiceType} end after the period of \code{ServiceType} was finished.
  45. %\end{itemize}
  46. %Also you can cancelled the \code{PersistentService} with the method \code{public void cancelServiceInstance()} and so the end time is now and you can get the
  47. %\code{ServiceDeliveryStatus} of the \code{PersistentService} at every time.
  48. %
  49. %\subsection{\code{ServiceDeliveryStatus}}
  50. %The \code{ServiceDeliverystatus} is an enumeration with follow attributes:
  51. %\begin{itemize}
  52. %\item \code{SCHEDULED}: If the start of the \code{Service} is in the future.
  53. %\item \code{EXECUTING}: If the \code{Service} is executing now.
  54. %\item \code{CANCELLED}: If the \code{Service} was cancelled.
  55. %\item \code{COMPLETED}: If the \code{Service} is completed, so the end of the \code{Service} is in the past and it wasn't cancelled.
  56. %\end{itemize}
  57. %TODO collapse Product with MeasuredProduct and be done with it.
  58. Not all items might by sold by number.
  59. Other units, such as litres, kilo grams, or meters are conceivable.
  60. To accomodate for the sell of such items, the \code{MeasuredProduct} interface was created.
  61. %TODO why has a catalog an amount?
  62. Implemented by \code{PersistentMeasuredProduct}, a \code{MeasuredProduct} is specified by a name, price and quantity available.
  63. %remove the stupid price shit. nobody needs it anyway.
  64. When an amount from a \code{MeasuredProduct} is removed or added, the \code{price} attribute is automatically modified to represent the total monetary value of the \code{MeasuredProduct}.
  65. The \code{getUnitPrice()} method can be used to access the price of a single unit.
  66. \code{MeasuredProduct}s bought by customers are represented by classes implementing the \code{MeasuredProductInstance} interface.
  67. An instance of a \code{MeasuredProductInstance} stands for a certain amount of a product.
  68. %TODO rename methods, clean shit up.
  69. When instanciating an object of a class implementing \code{MeasuredProductInstance}, the corresponding \code{MeasuredProduct} has to be known.
  70. Furthermore, the amount of the product represented by the new instance of \code{MeasuredProductInstance} is removed from the \code{MeasuredProduct} instance.
  71. %TODO do not throw exception from ctors vs early fail
  72. If an instance is to be created, which would remove a higher quantity than is available in the \code{MeasuredProduct}, the instantiation fails with an exception.