Last active
August 20, 2016 07:53
-
-
Save codingtim/356436e0ae450e4ee077 to your computer and use it in GitHub Desktop.
second
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EntityServiceImpl implements EntityService { | |
private EntityRepository repository; | |
private ImageService imageService; | |
@Override | |
public void update(String id, UpdateData updateData) { | |
Entity entity = repository.find(id); | |
ImageEntity image = imageService.getImage(updateData.getImageUrl()); | |
UpdateData updateDataWithImage = updateData.addImage(image); | |
ImageEntity previous = entity.getImage(); | |
entity.update(updateDataWithImage); | |
imageService.removeImage(previous); | |
repository.save(entity); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment