Java Code Examples for com.xnx3.StringUtil#Utf8ToString

The following examples show how to use com.xnx3.StringUtil#Utf8ToString . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeFu.java    From wangmarket with Apache License 2.0 4 votes vote down vote up
/**
 * 创建站点的栏目导航数据缓存
 * @param siteColumnlist
 */
public void siteColumn(List<com.xnx3.wangmarket.admin.entity.SiteColumn> siteColumnlist, com.xnx3.wangmarket.admin.entity.Site site) {
	createCacheObject("siteColumn");
	int siteid = 0;
	String content = "";
	for (int i = 0; i < siteColumnlist.size(); i++) {
		SiteColumn column = siteColumnlist.get(i);
		if(siteid == 0){
			siteid = column.getSiteid();
		}

		//根据type,来判断url的值
		if(column.getType() == column.TYPE_NEWS){
			column.setUrl("/newsList.do?cid="+column.getId());
		}else if (column.getType() == SiteColumn.TYPE_IMAGENEWS) {
			column.setUrl("/imageNewsList.do?cid="+column.getId());
		}else if (column.getType() == SiteColumn.TYPE_PAGE) {
			column.setUrl(AttachmentFile.netUrl()+"site/"+site.getId()+"/html/"+column.getId()+".html");
		}else if (column.getType() == SiteColumn.TYPE_LEAVEWORD) {
			column.setUrl("/leaveword.do?siteid="+siteid);
		}else if (column.getType() == SiteColumn.TYPE_HREF) {
			//5是超链接,忽略过
		}else if (column.getType() == SiteColumn.TYPE_HREF) {
			column.setUrl("#");
		}
		
		if(column.getIcon() == null || column.getIcon().length() == 0){
			column.setIcon(AttachmentFile.netUrl()+G.DEFAULT_SITE_COLUMN_ICON_URL);
		}
		String icon = column.getIcon().indexOf("://")==-1? AttachmentFile.netUrl()+"site/"+site.getId()+"/column_icon/"+column.getIcon():column.getIcon();
		content = content+" siteColumn["+i+"] = new Array();"
						+ " siteColumn["+i+"]['id'] = '"+column.getId()+"'; "
						+ " siteColumn["+i+"]['name'] = '"+StringUtil.Utf8ToString(column.getName())+"'; "
						+ " siteColumn["+i+"]['url'] = '"+column.getUrl()+"'; "
						+ " siteColumn["+i+"]['type'] = '"+column.getType()+"'; "
						+ " siteColumn["+i+"]['icon'] = '"+icon+"'; ";
	}
	
	if(siteid > 0){
		appendContent(content);
		generateCacheFile(site);
	}
}
 
Example 2
Source File: Site.java    From wangmarket with Apache License 2.0 4 votes vote down vote up
/**
 * 创建站点的栏目导航数据缓存
 * @param siteColumnlist
 */
public void siteColumn(List<com.xnx3.wangmarket.admin.entity.SiteColumn> siteColumnlist, com.xnx3.wangmarket.admin.entity.Site site) {
	createCacheObject("siteColumn");
	int siteid = 0;
	String content = "";
	for (int i = 0; i < siteColumnlist.size(); i++) {
		SiteColumn column = siteColumnlist.get(i);
		if(siteid == 0){
			siteid = column.getSiteid();
		}

		//根据type,来判断url的值
		if(column.getType() == column.TYPE_NEWS){
			column.setUrl("/newsList.do?cid="+column.getId());
		}else if (column.getType() == SiteColumn.TYPE_IMAGENEWS) {
			column.setUrl("/imageNewsList.do?cid="+column.getId());
		}else if (column.getType() == SiteColumn.TYPE_PAGE) {
			column.setUrl(AttachmentFile.netUrl()+"site/"+site.getId()+"/html/"+column.getId()+".html");
		}else if (column.getType() == SiteColumn.TYPE_LEAVEWORD) {
			column.setUrl("/leaveword.do?siteid="+siteid);
		}else if (column.getType() == SiteColumn.TYPE_HREF) {
			//5是超链接,忽略过
		}else if (column.getType() == SiteColumn.TYPE_HREF) {
			column.setUrl("#");
		}
		
		if(column.getIcon() == null || column.getIcon().length() == 0){
			column.setIcon(AttachmentFile.netUrl()+G.DEFAULT_SITE_COLUMN_ICON_URL);
		}
		String icon = column.getIcon().indexOf("://")==-1? AttachmentFile.netUrl()+"site/"+site.getId()+"/column_icon/"+column.getIcon():column.getIcon();
		content = content+" siteColumn["+i+"] = new Array();"
						+ " siteColumn["+i+"]['id'] = '"+column.getId()+"'; "
						+ " siteColumn["+i+"]['name'] = '"+StringUtil.Utf8ToString(column.getName())+"'; "
						+ " siteColumn["+i+"]['url'] = '"+column.getUrl()+"'; "
						+ " siteColumn["+i+"]['type'] = '"+column.getType()+"'; "
						+ " siteColumn["+i+"]['icon'] = '"+icon+"'; ";
	}
	
	if(siteid > 0){
		appendContent(content);
		generateCacheFile(site);
	}
}