Skip to content

Commit

Permalink
new BlogUtils.getHostNameFromAccountMap function
Browse files Browse the repository at this point in the history
  • Loading branch information
maxme committed Jan 28, 2015
1 parent 185582c commit 706a65f
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,25 @@ public int compare(Object blog1, Object blog2) {
/**
* Return a blog name or blog url (host part only) if trimmed name is an empty string
*/
public static String getBlogNameFromAccountMap(Map<String, Object> account) {
String blogName = StringUtils.unescapeHTML(MapUtils.getMapStr(account, "blogName"));
public static String getBlogNameOrHostNameFromAccountMap(Map<String, Object> account) {
String blogName = getBlogNameFromAccountMap(account);
if (blogName.trim().length() == 0) {
blogName = StringUtils.getHost(MapUtils.getMapStr(account, "url"));
}
return blogName;
}
}

/**
* Return a blog name or blog url (host part only) if trimmed name is an empty string
*/
public static String getBlogNameFromAccountMap(Map<String, Object> account) {
return StringUtils.unescapeHTML(MapUtils.getMapStr(account, "blogName"));
}

/**
* Return blog url (host part only) if trimmed name is an empty string
*/
public static String getHostNameFromAccountMap(Map<String, Object> account) {
return StringUtils.getHost(MapUtils.getMapStr(account, "url"));
}
}

0 comments on commit 706a65f

Please sign in to comment.