Skip to content

Instantly share code, notes, and snippets.

@codingtim
Last active June 29, 2017 17:03
Show Gist options
  • Save codingtim/90ba3c4e7d429717f704 to your computer and use it in GitHub Desktop.
Save codingtim/90ba3c4e7d429717f704 to your computer and use it in GitHub Desktop.
third
public class EntityServiceImpl implements EntityService {
private EntityRepository repository;
private ImageService imageService;
private EntityObservers entityObservers;
@Override
public void update(String id, UpdateData updateData) {
Entity entity = repository.find(id);
UpdateData updateDataWithImage = updateData.addImage(imageService.getImage(updateData.getImageUrl()));
Entity updatedEntity = entity.update(updateDataWithImage);
repository.save(updatedEntity);
entityObservers.notifyUpdated(entity, updatedEntity);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment