Using design-patterns to transform web-service model classes into local model classes and vise versa

Posted by Daniil Petrov on Programmers See other posts from Programmers or by Daniil Petrov
Published on 2014-08-25T12:15:36Z Indexed on 2014/08/25 16:27 UTC
Read the original article Hit count: 1235

There is a web-application built with play framework 1.2.7. It contains less than 10 model classes. The main purpose of the application is a lightweight access to a complex remote application (more than 50 model classes). The remote application has its own SOAP API and we use it for synchronization of data.

There is a scheduled job in the web-app which makes requests to the remote app. It gets bunches of objects from the remote model and populates corresponding objects of the local model. Currently, there are two groups of classes - the local model and the remote model (generated from wsdl schema). It is not allowed to make any modifications to the remote model. Transformations are being made in the scheduled job class. When it gets objects from the remote app it creates local objects.

Recently, it was decided to add a possibility to modify the remote objects. It requires more transformations on our side. We need to transform from remote to local model when reading objects and from local to remote when changing objects.

I wonder if this would be possible to use some design-patterns to reduce a number of transformations?

© Programmers or respective owner

Related posts about java

Related posts about design-patterns