Inherits from NSObject
Declared in SBRepository.h
SBRepository.m

Overview

SBRepository class description.

Tasks

Class Methods

bookFromSBBook:

Creates new Book object in the database and inserts it into the collection of active user.

+ (Book *)bookFromSBBook:(SBBook *)book

Parameters

book

Book object to be inserted.

Return Value

Created NSManagedObject.

Discussion

Creates new Book object in the database and inserts it into the collection of active user.

Declared In

SBRepository.h

booksForUser:

Queries books for a user.

+ (NSArray *)booksForUser:(User *)user

Parameters

user

User for requested books.

Return Value

Array of Books queried.

Discussion

Queries books for a user.

Declared In

SBRepository.h

favoriteListForUser:

Queries favorite books of a user.

+ (NSFetchedResultsController *)favoriteListForUser:(User *)user

Parameters

user

User for requested favorite books.

Return Value

List of favorite books as NSFetchedResultsController.

Discussion

Queries favorite books of a user.

Declared In

SBRepository.h

getBookWithISBN:forUser:

Queries books with ISBN and user.

+ (Book *)getBookWithISBN:(NSString *)isbn forUser:(User *)user

Parameters

isbn

ISBN for requested book.

user

User for requested book.

Return Value

Requested NSManagedObject. nil if not found.

Discussion

Queries books with ISBN and user.

Declared In

SBRepository.h

getUserWithEmail:withPassword:

Queries users with email and password.

+ (User *)getUserWithEmail:(NSString *)email withPassword:(NSString *)password

Parameters

email

Email of the user.

password

Password of the user.

Return Value

Requested NSManagedObject. nil if not found.

Discussion

Queries users with email and password.

Declared In

SBRepository.h

readListForUser:

Queries books in the readlist of a user.

+ (NSFetchedResultsController *)readListForUser:(User *)user

Parameters

user

User for requested books.

Return Value

List of books in the readlist as NSFetchedResultsController.

Discussion

Queries books in the readlist of a user.

Declared In

SBRepository.h

sharedRepository

Returns the singleton repository object.

+ (SBRepository *)sharedRepository

Return Value

Shared repository object.

Discussion

Returns the singleton repository object.

Declared In

SBRepository.h

toWishlistFromSBBook:

Creates new Book object in the database and inserts it into wishlist of active user.

+ (Book *)toWishlistFromSBBook:(SBBook *)book

Parameters

book

Book object to be inserted.

Return Value

Created NSManagedObject.

Discussion

Creates new Book object in the database and inserts it into wishlist of active user.

Declared In

SBRepository.h

trackForBook:lendDate:toWhom:comment:

Creates and returns a Track object in the repository.

+ (Track *)trackForBook:(Book *)book lendDate:(NSDate *)date toWhom:(NSString *)borrower comment:(NSString *)comment

Parameters

book

Book object which you keep track of.

date

Date the Book has lent.

borrower

Person to whom the Book has lent.

comment

Comment about track record.

Return Value

Created NSManagedObject.

Discussion

Creates and returns a Track object in the repository.

Declared In

SBRepository.h

userWithEmail:withName:withSurname:withPassword:

Creates and returns a User object in the repository.

+ (User *)userWithEmail:(NSString *)email withName:(NSString *)name withSurname:(NSString *)surname withPassword:(NSString *)password

Parameters

email

Email of the user.

name

Name of the user.

surname

Surname of the user.

password

Password of the user.

Return Value

Created NSManagedObject.

Discussion

Creates and returns a User object in the repository.

Declared In

SBRepository.h

wishListForUser:

Queries books in the wishlist of a user.

+ (NSFetchedResultsController *)wishListForUser:(User *)user

Parameters

user

User for requested books.

Return Value

List of books in the wishlist as NSFetchedResultsController.

Discussion

Queries books in the wishlist of a user.

Declared In

SBRepository.h