wiki:S2S_PERSIST_MODEL_R0
Last modified 16 years ago Last modified on 12/28/08 23:15:59

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

Error: Macro TicketQuery(summary=S2S_PERSIST_MODEL_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

The purpose of this task is to provide a model for storing the book object. The implementation will be easier using the properties we have.

Task requirements

  • create book data access object with properties so that a book can be saved, edited and removed
  • the code should be refactored - the persistence module should use the properties and extends BaseProObject
  • do not forget to write the tests needed in the design phase

Task result

  • book data object classes with corresponding table in the database
  • refactored code which uses the properties

Implementation idea

  • refactor the code first
  • create Book entity which represents the book
  • create BookDao in org.sophie2.persistence.dao package with the needed properties for managing the book
  • see the implementation idea of the S2S_PERSISTENCE_COMMONS_R0 task

S2S_PERSISTENCE_COMMONS_R0
S2S_CORE_MODEL_R0

How to demo

Show the new classes and run the tests.

Design

  • The whole package org.sophie2.server.persistence should be refactored to work with the ProLib objects as entities.
  • After the refactoring of the org.sophie2.server.persistence, the org.sophie2.server will need some refactoring.
  • Then to the refactored entities should be added a Book entity and Book Data Access object to manage it.

The new UML Class diagram of the persistence model looks like this:
source:/trunk/sophie2-platform/modules/org.sophie2.server/doc/S2S_PERSIST_MODEL_R0.jpg

  • Using the ProLib the persistence management with the JDBC lib should be generalized to methods like save, pesist, search, delete, etc... for the

most simple actions.

  • The persistable AbstractEntities should be annotated with the new annotation @Persistable and the tables they are mapped should be pointed.
  • The related in relation of the type many to many AbstractEntities should be annotated with the new annotation @ManyToMany and the intermediate tables and their id field names there should be pointed.
  • There will be problem with the Date field(dateUploaded) in the new Book entity, think of resolutions.
  • To the database schema should be added SERVER_BOOK table for basic storation of the book. This schema should be design by the following diagram:

source:/trunk/sophie2-platform/modules/org.sophie2.server/doc/S2S_PERSIST_MODEL_R0_DATABASE_DIAGRAM.jpg

  • The SERVER_BOOK table will be basic at this point, only a relation to the SERVER_USER's username will exist.
  • There is a problem with the JavaDB, it does not have Boolean/Bool/Bit type, we should resolve it.
  • Here are the refactored tests for the persistence module and the new ones testing the new logic: 766,773

trunk/sophie2-platform/modules/org.sophie2.server.persistence/src/test/java/org/sophie2/server/persistence/EmbeddedDatabaseManagerTest.java@773
trunk/sophie2-platform/modules/org.sophie2.server.persistence/src/test/java/org/sophie2/server/persistence/dao/GroupDaoTest.java@773
trunk/sophie2-platform/modules/org.sophie2.server.persistence/src/test/java/org/sophie2/server/persistence/dao/UserDaoTest.java@773
trunk/sophie2-platform/modules/org.sophie2.server.persistence/src/test/java/org/sophie2/server/persistence/dao/BookDaoTest.java@773

Implementation

The implementation is in 766, 767 and 773.

Testing

Comments

(Write comments for this or later revisions here.)