From: <mol...@us...> - 2009-09-06 19:40:24
|
Revision: 1433 http://openutils.svn.sourceforge.net/openutils/?rev=1433&view=rev Author: molaschi Date: 2009-09-06 19:40:12 +0000 (Sun, 06 Sep 2009) Log Message: ----------- javadocs Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/save/MediaCustomSaveHandler.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/MediaModuleVersionHandler.java 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/tree/JcrBrowserWithNodeTypeTreeConfiguration.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaBrowserConfiguration.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaModuleTree.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaModuleTreeConfiguration.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaModuleTreeMVCHandler.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/BadImageFormatException.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/MediaLoadUtils.java Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/save/MediaCustomSaveHandler.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/save/MediaCustomSaveHandler.java 2009-09-06 07:54:02 UTC (rev 1432) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/save/MediaCustomSaveHandler.java 2009-09-06 19:40:12 UTC (rev 1433) @@ -46,6 +46,8 @@ /** + * {@link FieldSaveHandler} implementation that calls the onSavingPropertyMedia method on the handler of target media + * type when a media is associated to a page * @author molaschi * @version $Id$ */ Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/MediaModuleVersionHandler.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/MediaModuleVersionHandler.java 2009-09-06 07:54:02 UTC (rev 1432) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/MediaModuleVersionHandler.java 2009-09-06 19:40:12 UTC (rev 1433) @@ -27,16 +27,12 @@ import info.magnolia.cms.core.Content; import info.magnolia.cms.core.NodeData; -import info.magnolia.cms.core.SystemProperty; import info.magnolia.cms.core.search.Query; import info.magnolia.cms.core.search.QueryManager; import info.magnolia.cms.core.search.QueryResult; import info.magnolia.module.InstallContext; -import info.magnolia.module.delta.Delta; -import info.magnolia.module.delta.DeltaBuilder; import info.magnolia.module.delta.Task; import info.magnolia.module.delta.TaskExecutionException; -import info.magnolia.module.model.Version; import it.openutils.mgnltasks.NodeSortTask; import it.openutils.mgnltasks.SimpleModuleVersionHandler; @@ -51,12 +47,12 @@ import net.sourceforge.openutils.mgnlmedia.media.lifecycle.MediaModule; import net.sourceforge.openutils.mgnlmedia.media.types.impl.BaseTypeHandler; -import org.apache.commons.lang.ObjectUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** + * Module version handler for media module * @author manuel * @version $Id */ 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 2009-09-06 07:54:02 UTC (rev 1432) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java 2009-09-06 19:40:12 UTC (rev 1433) @@ -33,8 +33,6 @@ import info.magnolia.context.MgnlContext; import java.awt.Point; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -58,6 +56,7 @@ /** + * Class that holds media el functions methods * @author molaschi * @version $Id$ */ @@ -107,7 +106,8 @@ } /** - * Get localized description for a media + * Get localized description for a media. If the locale is "it", it searches for a nodedata called description-it, + * or (if not found) description-en or (if not found) description. * @param media media * @param locale language * @return description @@ -131,7 +131,7 @@ } /** - * Get localized description for a media + * Get description for a media * @param media media * @return description */ @@ -141,7 +141,8 @@ } /** - * Get localized title for a media + * Get localized title for a media. If the locale is "it", it searches for a nodedata called title-it, or (if not + * found) title-en or (if not found) title. * @param media media * @param locale language * @return title @@ -165,7 +166,7 @@ } /** - * Get localized title for a media + * Get title for a media * @param media media * @return title */ @@ -175,7 +176,8 @@ } /** - * Get localized tags for a media + * Get localized tags for a media. If the locale is "it", it searches for a nodedata called tags-it, or (if not + * found) tags-en or (if not found) tags. * @param media media * @param locale language * @return tags @@ -200,7 +202,7 @@ } /** - * Get localized tags for a media + * Get tags for a media * @param media media * @return tags */ @@ -220,8 +222,9 @@ } /** - * Get url for a media + * Get url for a media, passing some parameters * @param media media + * @param options optional parameters * @return url */ public static String getUrl2(Content media, Map<String, String> options) @@ -235,8 +238,9 @@ } /** - * @param media - * @return String the thumbnail url for this media, null otherwise + * Get url to thumbnail + * @param media media to get the url for + * @return the thumbnail url for this media, null otherwise */ public static String getThumbnail(Content media) { @@ -249,8 +253,9 @@ } /** - * @param media - * @return String the type of this media if existing, null otherwise + * Get media type + * @param media media to get the type + * @return the type of this media if existing, null otherwise */ public static String getType(Content media) { @@ -262,8 +267,9 @@ } /** - * @param media - * @return + * Get all resolution strings (i.e. 'o200x350;background=45A97B') that generates cached resolutions + * @param media media to get the resolutions + * @return all resolution strings */ @SuppressWarnings("unchecked") public static String[] listResolutions(Content media) @@ -277,7 +283,14 @@ { if (item.getName().startsWith("res-")) { - res.add(StringUtils.substringAfter(item.getName(), "-")); + if (item.getAttribute(ImageUtils.RESOLUTION_PROPERTY) != null) + { + res.add(item.getAttribute(ImageUtils.RESOLUTION_PROPERTY)); + } + else + { + res.add(StringUtils.substringAfter(item.getName(), "-")); + } } } @@ -375,8 +388,9 @@ } /** - * @param media - * @return String the preview url for this media if existing, null otherwise + * Get url to media preview + * @param media media + * @return the preview url for this media if existing, null otherwise */ public static String getPreview(Content media) { @@ -389,7 +403,8 @@ } /** - * @param media + * Get an array of String(s) containing a list of web pages where this media is used, an empty array otherwise + * @param media media to search in web pages * @return an array of String(s) containing a list of web pages where this media is used, an empty array otherwise * @throws IllegalArgumentException if media is null */ Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/JcrBrowserWithNodeTypeTreeConfiguration.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/JcrBrowserWithNodeTypeTreeConfiguration.java 2009-09-06 07:54:02 UTC (rev 1432) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/JcrBrowserWithNodeTypeTreeConfiguration.java 2009-09-06 19:40:12 UTC (rev 1433) @@ -39,6 +39,8 @@ /** + * Custom JCR tree browser configuration that adds management of media custom nodetypes (mgnl:media mgnl:resolutions) + * and adds a column showing node type * @author molaschi * @version $Id$ */ Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaBrowserConfiguration.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaBrowserConfiguration.java 2009-09-06 07:54:02 UTC (rev 1432) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaBrowserConfiguration.java 2009-09-06 19:40:12 UTC (rev 1433) @@ -38,6 +38,7 @@ /** + * Tree Configuration that shows folders and media but no resolutions * @author molaschi * @version $Id$ */ Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaModuleTree.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaModuleTree.java 2009-09-06 07:54:02 UTC (rev 1432) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaModuleTree.java 2009-09-06 19:40:12 UTC (rev 1433) @@ -43,6 +43,7 @@ /** + * The tree for media folders browsing * @author molaschi * @version $Id$ */ Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaModuleTreeConfiguration.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaModuleTreeConfiguration.java 2009-09-06 07:54:02 UTC (rev 1432) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaModuleTreeConfiguration.java 2009-09-06 19:40:12 UTC (rev 1433) @@ -48,6 +48,7 @@ /** + * Custom Tree configuration for media folders browsing * @author molaschi * @version $Id$ */ Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaModuleTreeMVCHandler.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaModuleTreeMVCHandler.java 2009-09-06 07:54:02 UTC (rev 1432) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tree/MediaModuleTreeMVCHandler.java 2009-09-06 19:40:12 UTC (rev 1433) @@ -34,6 +34,7 @@ /** + * Extends {@link AdminTreeMVCHandler} to include custom js and to route activate command to activateMedia command * @author molaschi * @version $Id$ */ Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/BadImageFormatException.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/BadImageFormatException.java 2009-09-06 07:54:02 UTC (rev 1432) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/BadImageFormatException.java 2009-09-06 19:40:12 UTC (rev 1433) @@ -26,6 +26,7 @@ package net.sourceforge.openutils.mgnlmedia.media.utils; /** + * Exception for images with unknown format * @author fgiust * @version $Id$ */ Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java 2009-09-06 07:54:02 UTC (rev 1432) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java 2009-09-06 19:40:12 UTC (rev 1433) @@ -25,24 +25,6 @@ */ package net.sourceforge.openutils.mgnlmedia.media.utils; -/** - * Copyright Openmind http://www.openmindonline.it - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - import info.magnolia.cms.beans.runtime.FileProperties; import info.magnolia.cms.core.Content; import info.magnolia.cms.core.HierarchyManager; @@ -94,6 +76,7 @@ /** + * Main utility class that works with images and media nodes * @author molaschi * @version $Id$ */ @@ -107,7 +90,7 @@ private static SimpleDateFormat sdf; - private static String RESOLUTION_PROPERTY = "resolution"; + public static String RESOLUTION_PROPERTY = "resolution"; private static final String[] extensions = new String[]{"jpg", "gif", "png" }; @@ -386,6 +369,11 @@ } } + /** + * Get resolution nodedata name for a given resolution string + * @param resolution resolution string + * @return resolution nodedata name + */ public static String getResolutionPath(String resolution) { if (resolution.indexOf(';') > 0) @@ -397,6 +385,13 @@ return resolution; } + /** + * Get an inputstream for an image and the target file extension + * @param image image to get the inputstream from + * @param extension target file extension + * @return inputstream + * @throws IOException + */ public static InputStream getStream(BufferedImage image, String extension) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); @@ -432,11 +427,24 @@ return new ByteArrayInputStream(bos.toByteArray()); } + /** + * Check if the resolution for a media is already present. Otherwise create it + * @param media media to check the resolutoin on + * @param resolutionTarget target resolution + * @return false if resolution doesn't exist and there is a problem in generate it; true otherwise + */ public static boolean checkOrCreateResolution(final Content media, final String resolutionTarget) { return checkOrCreateResolution(media, resolutionTarget, BaseTypeHandler.ORGINAL_NODEDATA_NAME); } + /** + * Check if the resolution for a media is already present. Otherwise create it + * @param media media to check the resolutoin on + * @param resolutionTarget target resolution + * @param nodeDataName nodedata where the image to resize is stored + * @return false if resolution doesn't exist and there is a problem in generate it; true otherwise + */ public static boolean checkOrCreateResolution(final Content media, final String resolutionTarget, final String nodeDataName) { @@ -587,10 +595,10 @@ return true; } -/** + /** * Get image for a resolution * @param original original image - * @param resolution resolution (if it starts with '<' does a fitIn else a fillAndCropCentered + * @param resolution resolution * @return new image */ public static BufferedImage getImageForResolution(BufferedImage original, String resolution) @@ -663,6 +671,12 @@ return img; } + /** + * Get file extension for a resolution stored in a media node + * @param media media + * @param resolution resolution + * @return file extension for a resolution stored in a media node + */ public static String getExtension(Content media, String resolution) { try @@ -678,8 +692,9 @@ } /** - * @param image - * @return + * Create a buffered image from the binary data stored in nodedata + * @param image nodedata + * @return buffered image from the binary data stored in nodedata */ public static BufferedImage createBufferedImage(NodeData image) { @@ -708,6 +723,11 @@ } } + /** + * Parse resolution string for required size + * @param res resolution string + * @return required size parsed from given resolution string + */ public static java.awt.Point parseForSize(String res) { Point size = new Point(); Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/MediaLoadUtils.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/MediaLoadUtils.java 2009-09-06 07:54:02 UTC (rev 1432) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/MediaLoadUtils.java 2009-09-06 19:40:12 UTC (rev 1433) @@ -52,6 +52,7 @@ /** + * Utility Class that manages loading files into media repository * @author fgiust * @version $Id$ */ @@ -63,6 +64,16 @@ */ private static Logger log = LoggerFactory.getLogger(MediaLoadUtils.class); + /** + * Load a file in media repository + * @param inputStream file input stream + * @param parent parent folder node + * @param filename filename + * @param overwrite overwrite if already exists? + * @return create media node + * @throws RepositoryException exception working on media repository + * @throws IOException exception working with file stream + */ public static Content loadEntry(InputStream inputStream, String parent, String filename, boolean overwrite) throws RepositoryException, IOException { @@ -135,6 +146,14 @@ return null; } + /** + * Get the content node matching required path using hierarchy manager. If the required path doesn't exist create + * it. + * @param mgr hierarchy manager + * @param path path to get or create + * @return content to required path + * @throws RepositoryException exception getting or creating path + */ public static Content getOrCreateFullPath(HierarchyManager mgr, String path) throws RepositoryException { String[] contentNodeNames = path.split("/"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |