Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement serializer #20

Closed
brusherru opened this issue Jun 17, 2016 · 2 comments
Closed

Implement serializer #20

brusherru opened this issue Jun 17, 2016 · 2 comments

Comments

@brusherru
Copy link
Contributor

brusherru commented Jun 17, 2016

Implement serializer classes.
For a beginning just Serializer (abstract) and LocalStorageSerializer.

Serializer works only with Services and works with serverState (composition of all service states).

@brusherru brusherru self-assigned this Jun 17, 2016
@brusherru
Copy link
Contributor Author

brusherru commented Jun 17, 2016

Class diagram:
"+" — public property / method
"-" — private property / method
"#" — protected property / method

Serializer

- serverState : ServerStateObject — stores serverState, that loaded from resource
- currentState : ServerStateObject — current serverState (immutable), that will be changed by Services and could be saved to resource
+ hasChanges() : Boolean — method that diffs serverState and currentState. Maybe useful to prevent unnecessary saves, disable "save" button and etc
+ load( ids: Array<number> ) : ServerStateObject — method that will be called by Application (or another head class) to load ServerState for all opened patches
+ get( serviceName: string, id?: number ) : ServiceStateObject — method that will be called by Services to load serviceState (return only part of ServerState)
+ save() : ResponceObject — save json data to resource
# _store(response: ResponseObject) : ResponseObject — save json data to resource (contains logic where to save and how)
# _restore(response: ResponseObject) : ResponseObject — loads json data from resource (called by getPatches)
- _fromJSON() : Object — parse json data into object ()
- _toJSON() : String - JSON.stringify(object)
- _createResponse() : ResponseObject — creates empty response with status pending

ResponseObject

status: ResponseStates — enum ResponseStates { pending, success, fail }
data: any — could contain object with some data, error message / error number and etc

@nkrkv
Copy link
Member

nkrkv commented Jun 21, 2016

No longer relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants