wiki:BASE_BOOK_COMMONS_R0
Last modified 16 years ago Last modified on 01/06/09 14:04:38

Error: Macro BackLinksMenu(None) failed
compressed data is corrupt

Error: Macro TicketQuery(summary=BASE_BOOK_COMMONS_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|) failed
current transaction is aborted, commands ignored until end of transaction block

Analysis

Overview

Manipulating with books is the main goal of sophie2. A book should hold pages, pages can be added or removed from a book. A book should be viewable, savable, exportable.

Task requirements

  • Define the connections between books and other related objects (pages, some book repository)
  • Define actions related to books
    • for the book itself
      • create
      • destroy
      • copy
      • save/load
      • export
      • import
    • for the objects inside
      • add pages
      • remove pages
      • (re)order pages
      • group pages in chapters
      • set a page to be the cover of the book
    • other actions
      • merge two/many books in one
      • split a book in two/many
  • Decide which connections and actions are basic and obligatory and which are optional. Define a class hierarchy that supports the basic connections and actions. In this task a class hierarchy for books should be created. It should contain all interfaces, classes, fields common for all possible kinds of books (if any more than one)

Task result

  • The result should include
    • class diagrams
    • source code

Implementation idea

  • first identify the classes and the relations between them
  • implement the hierarchy
  • implement the functionality

BASE_MODEL_PAGE_ELEMENTS_R0
BASE_PERSISTENCE_COMMONS_R0
BASE_PERSISTENCE_INTERMEDIATE_STORAGE_R0

How to demo

  • show the class diagram and explain the role of the components and how they are related
  • show where the implemented packages and classes are

Design

The Book object model is stored in module org.sophie2.base.model.book. Here's the class diagram for the main classes:
source:/trunk/sophie2-platform/doc/uml-design-diagrams/Book-Object-Model.png

Each book contains zero or more pages that can be accessed by the page() method in the Book class. Other properties of the book are also stored in the model - the current page, the page size, the title, the version and the container file. These all can be accessed by methods of the Book class, as seen in the diagram. There are additional methods for creating/deleting books and for reordering the pages.

The pages are represented by the Page class. Each page has associated styles - represented by BackgroundStyle, BorderStyle and ShadowStyle classes. The page contains 0 or more frames, represented by the Frame class. More thorough description of these should be provided in the BASE_MODEL_PAGE_ELEMENTS_R0 task.

The basic actions for books are found in the following classes:
Book.java
Page.java

Some of the actions stated in the analysis section are provided by the BookLogic class - such as adding/removing pages since this depends on the BookView.

  • Currently we have the following functionality for books:
    • Creating and deleting books.
    • Adding/removing/reordering the pages of a book.
  • Some things will not be implemented in this task:
    • copying books requires the PRO_LIB_UTILS_R0.
    • saving/loading books will be implemented in the BASE_PERSISTENCE_COMMONS_R0 task.
    • importing/exporting will be implemented at Iteration05 - then there are tasks for that.
    • grouping in chapters is scheduled for Iteration06.
    • other things might be implemented in the next revisions of this task.

Unit tests can be found here:
BookUnitTest.java
PageUnitTest.java

Implementation

Done according to the design, included mainly code refactoring. Changesets:
953
968
993

Reimplemented, considering pap's notes in the ticket:

  • Updated the UML diagram.
  • Refactored BookUnitTest and PageUnitTests.
  • Deleted integrations tests - they duplicated the functionality of the existing unit tests.
  • Final modifiers fixed.
  • Refactored Book and Page classes according to the notes (the check in the frame method is necessary due to an error in the properties library).
  • Got rid of the version property of books.
  • Basic functionality for copying of books added.

Here are the new changesets:
1110
1114
1115
1146

Testing

Comments

(Write comments for this or later revisions here.)