-
Notifications
You must be signed in to change notification settings - Fork 187
Instructions for adding new fields
As of version 5.0 it seems like a good idea to update this section. Rather than writing exhaustive documentation, I will link to specific commits where a field was added. If necessary I will add a field to demonstrate. This is a work in progress.
this commit shows how new fields (price & format) were obtained from Amazon. Ignore the SearchManager changes — they were about handling ASINs better. Other search providers follow a similar pattern.
Note that this commit all fields added in this commit already had key names defined in CatalogueDBAdapter.java. See “Repairing the Damage” below for a brief dicussion of using DOM_[ name ] instead of KEY_[ name ].
This commit shows all changes needed to support a new field within the application.
It does not include the code for retrieving that field from the internet (not all can be), and does not (oops) include export/import code.
This commit shows the changes need to support export/import/archival.
Note that no changes are needed for import so long as the column name matches the field name. Since Archival uses CSV exports, there are also no changes to the archive.
BookRowView.java was changed just because it makes code more readable and efficient.
This commit shows how to add ‘Suggestions’ to the Language AutoText field.
(It also contains some minor layout cleanups).
This small commit shows the simple changes needed to support ‘Update From Internet’, assuming one of the data sources provides the field.
This commit shows adding a new sort/style for the ‘Language’ field.
The basic approach is search for the text ‘NEWKIND’ and do what it says.
It is more complex when searching sub-tables etc, but see the other fields for examples.
Note: This commit had some deletions of specific static imports (replace with one wildcard), mainly to reduce maintenance in the future.
Early in adding the field I chose to be lazy and add KEY_LANGUAGE to CataogueDBAdapter; in recent versions I have been trying to use code in DatabaseDefinitions to manage domains and tables. It allows us to use one source for data fields and their definitions.
In this commit I just deleted KEY_LANGUAGE and repaired the resulting breakages by creating and using a DOM_LANGUAGE object.
This is considerably changed as of (somewhere around) v3.4. See notes below.
CatalogueDBAdapter
- Add to CREATE
- Add to onUpgrade
- Add to exportBooks
- (3.4) Add to getBookFields
- Add to fetchAllBooks (3.4: not needed)
- Add to fetchAllBooksByAuthor (3.4: not needed)
- Add to fetchAllBooksByLoan (3.4: not needed)
- Add to fetchAllBooksBySeries (3.4: not needed)
- Add to fetchBook (3.4: not needed)
- Add to fetchBookByISBN (3.4: not needed)
- fetchBookByISBNOrCombo (3.4: not needed)
- Add to searchBooks (3.4: not needed)
- Add to createBook (3.4: not needed)
- Add to updateBook (3.4: not needed)
edit_book / edit_book_notes.xml
- Update edit_book.xml
BookEditFields / BookEditNotes / BookEditAnthology
- Add private class variable (3.4: not needed)
- Add to onCreate (3.4: add a field to myFields — see, eg, KEY_PUBLISHER — may want validator, formatter etc)
- Update populateFields (from database) (3.4: not needed, if it’s just a ‘simple’ field)
- Update populateFields (from variable / activity – Fields only) (3.4: not needed, if it’s just a ‘simple’ field)
- Update saveState (3.4: not needed, if it’s just a ‘simple’ field)
BookISBNSearch
- Update comment in go
- Update searchGoogle
- Update searchAmazon
LibraryThingManager (3.4)
update SearchLibraryThingEntryHandler
SearchAmazonHandler
- Create public class variable (not in 3.4)
- update GetBook
SearchGoogleBooksEntryHandler
- Create public class variable (not in 3.4)
- update GetBook
FieldVisibility
- Add to setupFields (fields, fieldRs and compulsary)
AdminstrationFunctions
- Add to exportData (title and rows; moved in 3.4 – now in ExportThread.java)
- Add to ImportData (not needed in 3.4)