Created
November 20, 2015 10:49
-
-
Save codingtim/c033a2625a3d461ede11 to your computer and use it in GitHub Desktop.
first
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); | |
entity.setDescription(updateData.getDescription()); | |
entity.setTitle(updateData.getTitle()); | |
ImageEntity image = imageService.getImage(updateData.getImageUrl()); | |
ImageEntity previous = entity.getImage(); | |
entity.setImage(image); | |
imageService.removeImage(previous); | |
repository.save(entity); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment