So I created a new application, which simulates the creation of a developer and uses it to back everything up to Google App Engine. I use Generic Classes, so no matter what fields the developer's class will have, everything will work just fine. I do this by creating a JSON file with the fields of the class:
private <T> String createJsonFile(Class<T> Kind) { String json; /*Get all fields, including the private ones*/ Field[] fields = Kind.getDeclaredFields(); int fieldsNo = fields.length; /*For each field, add to the JSON String the field's name*/ for (Field field : fields) { fieldsNo--; json += "\"" + field.getName() + "\""; if (fieldsNo != 0) json += ","; } return json; }So these are the steps that I should follow while redesigning the application:
- Create JSON file from Class.
- Create SQLite Database with this structure (the table should have the same fields).
- Update the server concerning the schema.
- POST the JSON file
- Add one item to SQLite Database.
- Read/Modify/Delete items from SQLite Database.
- Synchronize the server when needed.
These are small steps which I began already to implement. The last step can be further divided into smaller steps, but this is what I plan for now. It shouldn't be to difficult to implement, considering that most of it I already have, but I need to reorganize things.
An image with how should all look like is this one:
No comments:
Post a Comment