Skip to content

Instantly share code, notes, and snippets.

@stuartrexking
Created January 24, 2012 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartrexking/1671252 to your computer and use it in GitHub Desktop.
Save stuartrexking/1671252 to your computer and use it in GitHub Desktop.
Mkae this leaner
private void mapCover(ProfileDocument profileDocument, UpdateProfile updateProfile) {
boolean updateTitle = StringUtils.isNotBlank(updateProfile.getCoverTitle());
boolean updateCoverMedia = CollectionUtils.isMapNotEmpty(updateProfile.getCoverMedia());
if (updateTitle || updateCoverMedia) {
UserCoverDocument document = profileDocument.getCover();
if (null == document) {
document = new UserCoverDocument();
profileDocument.setCover(document);
}
document.setCover_title(updateProfile.getCoverTitle());
if (updateCoverMedia) {
document.setCover_media(CollectionUtils.asStringMap(updateProfile.getCoverMedia()));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment