From: <die...@us...> - 2011-04-01 13:45:57
|
Revision: 3405 http://openutils.svn.sourceforge.net/openutils/?rev=3405&view=rev Author: diego_schivo Date: 2011-04-01 13:45:51 +0000 (Fri, 01 Apr 2011) Log Message: ----------- TAGCLOUD-14 tagcloud building logic Modified Paths: -------------- trunk/openutils-mgnltagcloud/src/main/java/net/sourceforge/openutils/mgnltagcloud/dialog/TagCloudDialog.java Modified: trunk/openutils-mgnltagcloud/src/main/java/net/sourceforge/openutils/mgnltagcloud/dialog/TagCloudDialog.java =================================================================== --- trunk/openutils-mgnltagcloud/src/main/java/net/sourceforge/openutils/mgnltagcloud/dialog/TagCloudDialog.java 2011-04-01 13:40:56 UTC (rev 3404) +++ trunk/openutils-mgnltagcloud/src/main/java/net/sourceforge/openutils/mgnltagcloud/dialog/TagCloudDialog.java 2011-04-01 13:45:51 UTC (rev 3405) @@ -205,60 +205,63 @@ tagCloudName += "_" + locale; } } - + if (StringUtils.isNotBlank(tagCloudName)) { TagCloud tagCloudOriginal = TagCloudManager.getInstance().getTagCloud(tagCloudName); - if (tagCloudOriginal == null) + if (tagCloudOriginal != null) { - log.error("No tag cloud configured with name : {}", tagCloudName); - return null; + try + { + tagCloud = (TagCloud) BeanUtils.cloneBean(tagCloudOriginal); + tagCloud.setTags(new HashMap<String, Integer>()); + } + catch (IllegalAccessException e) + { + // should never happen + } + catch (InstantiationException e) + { + // should never happen + } + catch (InvocationTargetException e) + { + // should never happen + } + catch (NoSuchMethodException e) + { + // should never happen + } } - try + else if (StringUtils.isNotBlank(this.getConfigValue("tagCloudName"))) { - tagCloud = (TagCloud) BeanUtils.cloneBean(tagCloudOriginal); + log.warn("No tag cloud configured with name : {}", tagCloudName); } - catch (IllegalAccessException e) + + if (tagCloud == null) { - // should never happen + tagCloud = new TagCloud(); + if (StringUtils.isNotBlank(this.getConfigValue("tagCloudRepository"))) + { + tagCloud.setRepository(this.getConfigValue("tagCloudRepository")); + } + if (StringUtils.isNotBlank(this.getConfigValue("tagCloudPath"))) + { + tagCloud.setPath(this.getConfigValue("tagCloudPath")); + } + if (StringUtils.isNotBlank(this.getConfigValue("tagCloudProperty"))) + { + tagCloud.setPropertyName(this.getConfigValue("tagCloudProperty")); + } + else + { + // Set the actual node name, it's useful in some cases + tagCloud.setPropertyName(this.getName()); + } } - catch (InstantiationException e) - { - // should never happen - } - catch (InvocationTargetException e) - { - // should never happen - } - catch (NoSuchMethodException e) - { - // should never happen - } - tagCloud.setTags(new HashMap<String, Integer>()); + tagCloud.setCount(10000); + TagCloudManager.getInstance().calculateTagCloud(tagCloud); } - else - { - tagCloud = new TagCloud(); - if (StringUtils.isNotBlank(this.getConfigValue("tagCloudRepository"))) - { - tagCloud.setRepository(this.getConfigValue("tagCloudRepository")); - } - if (StringUtils.isNotBlank(this.getConfigValue("tagCloudPath"))) - { - tagCloud.setPath(this.getConfigValue("tagCloudPath")); - } - if (StringUtils.isNotBlank(this.getConfigValue("tagCloudProperty"))) - { - tagCloud.setPropertyName(this.getConfigValue("tagCloudProperty")); - } - else - { - // Set the actual node name, it's useful in some cases - tagCloud.setPropertyName(this.getName()); - } - } - tagCloud.setCount(10000); - TagCloudManager.getInstance().calculateTagCloud(tagCloud); return tagCloud; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |