Skip to content

Instantly share code, notes, and snippets.

@codingtim
Created November 20, 2015 10:49
Show Gist options
  • Save codingtim/c033a2625a3d461ede11 to your computer and use it in GitHub Desktop.
Save codingtim/c033a2625a3d461ede11 to your computer and use it in GitHub Desktop.
first
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