[go: nahoru, domu]

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 f5425b4 commit fe5748a
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 fe5748a

Please sign in to comment.