From: <car...@us...> - 2010-04-23 14:04:39
|
Revision: 2294 http://openutils.svn.sourceforge.net/openutils/?rev=2294&view=rev Author: carlocolombo Date: 2010-04-23 14:04:33 +0000 (Fri, 23 Apr 2010) Log Message: ----------- [MEDIA-127]Check if parameter passed starts with / and exist in jcr media repostitory, if exist return the rappresented content. Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java 2010-04-23 08:09:17 UTC (rev 2293) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java 2010-04-23 14:04:33 UTC (rev 2294) @@ -96,9 +96,9 @@ } if (obj instanceof String) { - String uuid = (String) obj; + String mediaIdentifier = (String) obj; - if (StringUtils.isBlank(uuid)) + if (StringUtils.isBlank(mediaIdentifier)) { return null; } @@ -106,15 +106,25 @@ HierarchyManager hm = MgnlContext.getHierarchyManager(MediaModule.REPO); try { - return hm.getContentByUUID(StringUtils.trim(uuid)); + if (mediaIdentifier.startsWith("/")) + { + if (hm.isExist(mediaIdentifier)) + { + return hm.getContent(mediaIdentifier); + } + } + else + { + return hm.getContentByUUID(StringUtils.trim(mediaIdentifier)); + } } catch (ItemNotFoundException e) { - log.debug("Node with UUID \"" + uuid + "\" not found"); + log.debug("Node \"" + mediaIdentifier + "\" not found"); } catch (RepositoryException e) { - log.error(e.getClass().getName() + " getting node with UUID \"" + uuid + "\"", e); + log.error(e.getClass().getName() + " getting node \"" + mediaIdentifier + "\"", e); } } else if (obj instanceof Content) @@ -220,7 +230,7 @@ if (tags == null) { return null; - + } return StringUtils.split(tags, ","); } @@ -344,7 +354,7 @@ { return null; } - + // MEDIA-90 may be simply a url if (media.getNodeData(BaseTypeHandler.ORGINAL_NODEDATA_NAME).getType() == PropertyType.BINARY) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |