You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
(39) |
Dec
(10) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(19) |
Feb
(150) |
Mar
(10) |
Apr
|
May
(8) |
Jun
(11) |
Jul
(27) |
Aug
(52) |
Sep
(35) |
Oct
(30) |
Nov
(18) |
Dec
(4) |
2008 |
Jan
(76) |
Feb
(121) |
Mar
(39) |
Apr
(55) |
May
(18) |
Jun
(49) |
Jul
(32) |
Aug
(4) |
Sep
(10) |
Oct
|
Nov
(3) |
Dec
(33) |
2009 |
Jan
(19) |
Feb
(87) |
Mar
(69) |
Apr
(38) |
May
(47) |
Jun
(20) |
Jul
(5) |
Aug
(76) |
Sep
(145) |
Oct
(34) |
Nov
(8) |
Dec
(68) |
2010 |
Jan
(150) |
Feb
(379) |
Mar
(191) |
Apr
(100) |
May
(525) |
Jun
(269) |
Jul
(127) |
Aug
(190) |
Sep
(190) |
Oct
(29) |
Nov
(147) |
Dec
(83) |
2011 |
Jan
(188) |
Feb
(81) |
Mar
(43) |
Apr
(97) |
May
(63) |
Jun
(129) |
Jul
(17) |
Aug
(124) |
Sep
(6) |
Oct
(20) |
Nov
(67) |
Dec
(23) |
2012 |
Jan
(6) |
Feb
(14) |
Mar
(181) |
Apr
(64) |
May
(102) |
Jun
(47) |
Jul
(26) |
Aug
(3) |
Sep
(1) |
Oct
(14) |
Nov
(13) |
Dec
(23) |
2013 |
Jan
(4) |
Feb
(14) |
Mar
(18) |
Apr
(14) |
May
(27) |
Jun
(27) |
Jul
(5) |
Aug
(2) |
Sep
(74) |
Oct
(79) |
Nov
(21) |
Dec
(97) |
2014 |
Jan
(6) |
Feb
(3) |
Mar
(8) |
Apr
|
May
(5) |
Jun
|
Jul
(9) |
Aug
(6) |
Sep
(3) |
Oct
(10) |
Nov
(6) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
(1) |
Apr
(25) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <fg...@us...> - 2009-11-26 12:32:44
|
Revision: 1502 http://openutils.svn.sourceforge.net/openutils/?rev=1502&view=rev Author: fgiust Date: 2009-11-26 12:32:37 +0000 (Thu, 26 Nov 2009) Log Message: ----------- [maven-release-plugin] prepare release openutils-deployment-2.1.3 Modified Paths: -------------- trunk/openutils-deployment/pom.xml Modified: trunk/openutils-deployment/pom.xml =================================================================== --- trunk/openutils-deployment/pom.xml 2009-11-26 12:29:48 UTC (rev 1501) +++ trunk/openutils-deployment/pom.xml 2009-11-26 12:32:37 UTC (rev 1502) @@ -7,7 +7,7 @@ </parent> <artifactId>openutils-deployment</artifactId> <name>openutils deployment tools</name> - <version>2.1.3-SNAPSHOT</version> + <version>2.1.3</version> <description>Openutils deployment tools</description> <licenses> <license> @@ -114,4 +114,10 @@ <properties> <spring.version>2.5.6</spring.version> </properties> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-deployment-2.1.3</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-deployment-2.1.3</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-deployment-2.1.3</url> + </scm> </project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fg...@us...> - 2009-11-26 12:29:59
|
Revision: 1501 http://openutils.svn.sourceforge.net/openutils/?rev=1501&view=rev Author: fgiust Date: 2009-11-26 12:29:48 +0000 (Thu, 26 Nov 2009) Log Message: ----------- DEPLOY-2 Nested property support for Property annotation Modified Paths: -------------- trunk/openutils-deployment/src/main/java/it/openutils/deployment/spring/EnvironmentPropertyConfigurer.java trunk/openutils-deployment/src/main/java/it/openutils/deployment/spring/PropertyAnnotationsUtils.java trunk/openutils-deployment/src/site/changes/changes.xml trunk/openutils-deployment/src/test/java/it/openutils/deployment/spring/PropertyInjectBeanPostProcessorTest.java trunk/openutils-deployment/src/test/java/it/openutils/deployment/spring/SampleBean.java trunk/openutils-deployment/src/test/resources/environment.properties trunk/openutils-deployment/src/test/resources/spring-tests.xml Added Paths: ----------- trunk/openutils-deployment/src/test/resources/environment-base.properties Property Changed: ---------------- trunk/openutils-deployment/ Property changes on: trunk/openutils-deployment ___________________________________________________________________ Modified: svn:ignore - .wtpmodules target .classpath .project .settings .checkstyle pom.xml.releaseBackup release.properties + .wtpmodules target .classpath .project .settings .checkstyle pom.xml.releaseBackup release.properties test-output temp-testng-customsuite.xml Modified: trunk/openutils-deployment/src/main/java/it/openutils/deployment/spring/EnvironmentPropertyConfigurer.java =================================================================== --- trunk/openutils-deployment/src/main/java/it/openutils/deployment/spring/EnvironmentPropertyConfigurer.java 2009-10-27 15:06:20 UTC (rev 1500) +++ trunk/openutils-deployment/src/main/java/it/openutils/deployment/spring/EnvironmentPropertyConfigurer.java 2009-11-26 12:29:48 UTC (rev 1501) @@ -23,6 +23,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.net.UnknownHostException; +import java.util.HashSet; import java.util.Iterator; import java.util.Properties; @@ -42,6 +43,7 @@ import org.springframework.core.io.Resource; import org.springframework.core.io.UrlResource; import org.springframework.util.ResourceUtils; +import org.springframework.util.StringValueResolver; import org.springframework.web.context.WebApplicationContext; @@ -95,6 +97,8 @@ */ private boolean exposeSystemProperties; + private String nullValue; + /** * Setter for <code>fileLocation</code>. * @param fileLocation The fileLocation to set. @@ -133,6 +137,13 @@ this.exposeSystemProperties = exposeSystemProperties; } + @Override + public void setNullValue(String nullValue) + { + this.nullValue = nullValue; + super.setNullValue(nullValue); + } + /** * {@inheritDoc} */ @@ -373,7 +384,7 @@ public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException { - PropertyAnnotationsUtils.autowireProperties(bean, properties); + PropertyAnnotationsUtils.autowireProperties(bean, new PlaceholderResolvingStringValueResolver(properties)); return true; } @@ -413,4 +424,25 @@ { return bean; } + + /** + * BeanDefinitionVisitor that resolves placeholders in String values, delegating to the + * <code>parseStringValue</code> method of the containing class. + */ + protected class PlaceholderResolvingStringValueResolver implements StringValueResolver + { + + private final Properties props; + + public PlaceholderResolvingStringValueResolver(Properties props) + { + this.props = props; + } + + public String resolveStringValue(String strVal) throws BeansException + { + String value = parseStringValue(strVal, this.props, new HashSet()); + return (value.equals(nullValue) ? null : value); + } + } } Modified: trunk/openutils-deployment/src/main/java/it/openutils/deployment/spring/PropertyAnnotationsUtils.java =================================================================== --- trunk/openutils-deployment/src/main/java/it/openutils/deployment/spring/PropertyAnnotationsUtils.java 2009-10-27 15:06:20 UTC (rev 1500) +++ trunk/openutils-deployment/src/main/java/it/openutils/deployment/spring/PropertyAnnotationsUtils.java 2009-11-26 12:29:48 UTC (rev 1501) @@ -17,10 +17,10 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import java.util.Properties; import org.springframework.beans.SimpleTypeConverter; import org.springframework.util.ReflectionUtils; +import org.springframework.util.StringValueResolver; /** @@ -38,7 +38,7 @@ // don't instantiate } - public static void autowireProperties(final Object bean, final Properties properties) + public static void autowireProperties(final Object bean, final StringValueResolver valueResolver) { ReflectionUtils.doWithFields(bean.getClass(), new ReflectionUtils.FieldCallback() { @@ -54,7 +54,7 @@ "PropertyAutowired annotation is not supported on static fields"); } - Object strValue = properties.get(annotation.value()); + Object strValue = valueResolver.resolveStringValue("${" + annotation.value() + "}"); if (strValue != null) { @@ -64,6 +64,8 @@ } } } + }); } + } Modified: trunk/openutils-deployment/src/site/changes/changes.xml =================================================================== --- trunk/openutils-deployment/src/site/changes/changes.xml 2009-10-27 15:06:20 UTC (rev 1500) +++ trunk/openutils-deployment/src/site/changes/changes.xml 2009-11-26 12:29:48 UTC (rev 1501) @@ -8,7 +8,12 @@ <author email="fgiust(at)users.sourceforge.net">Fabrizio Giustina</author> </properties> <body> - <release version="2.1.2" date="in svn" description=""> + + <!-- + MOVED To JIRA + don't update this file anymore, just create issues and mark versions in jira + --> + <release version="2.1.2" date="2009-05-09" description=""> <action type="update" dev="fgiust">EnvironmentLog4jConfigListener now exposes a "server" System property also when log4jExposeWebAppRoot is set to false</action> </release> Modified: trunk/openutils-deployment/src/test/java/it/openutils/deployment/spring/PropertyInjectBeanPostProcessorTest.java =================================================================== --- trunk/openutils-deployment/src/test/java/it/openutils/deployment/spring/PropertyInjectBeanPostProcessorTest.java 2009-10-27 15:06:20 UTC (rev 1500) +++ trunk/openutils-deployment/src/test/java/it/openutils/deployment/spring/PropertyInjectBeanPostProcessorTest.java 2009-11-26 12:29:48 UTC (rev 1501) @@ -52,4 +52,10 @@ Assert.assertEquals("property", System.getProperty("stringProperty")); } + @Test + public void testNestedProperty() + { + Assert.assertEquals("property replaced doublenested", testBean.getNestedProperty()); + } + } Modified: trunk/openutils-deployment/src/test/java/it/openutils/deployment/spring/SampleBean.java =================================================================== --- trunk/openutils-deployment/src/test/java/it/openutils/deployment/spring/SampleBean.java 2009-10-27 15:06:20 UTC (rev 1500) +++ trunk/openutils-deployment/src/test/java/it/openutils/deployment/spring/SampleBean.java 2009-11-26 12:29:48 UTC (rev 1501) @@ -32,6 +32,9 @@ @Property("stringProperty") private String stringProperty; + @Property("nested") + private String nestedProperty; + /** * Returns the intProperty. * @return the intProperty @@ -49,4 +52,14 @@ { return stringProperty; } + + /** + * Returns the nestedProperty. + * @return the nestedProperty + */ + public String getNestedProperty() + { + return nestedProperty; + } + } Added: trunk/openutils-deployment/src/test/resources/environment-base.properties =================================================================== --- trunk/openutils-deployment/src/test/resources/environment-base.properties (rev 0) +++ trunk/openutils-deployment/src/test/resources/environment-base.properties 2009-11-26 12:29:48 UTC (rev 1501) @@ -0,0 +1 @@ +base=doublenested \ No newline at end of file Property changes on: trunk/openutils-deployment/src/test/resources/environment-base.properties ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/openutils-deployment/src/test/resources/environment.properties =================================================================== --- trunk/openutils-deployment/src/test/resources/environment.properties 2009-10-27 15:06:20 UTC (rev 1500) +++ trunk/openutils-deployment/src/test/resources/environment.properties 2009-11-26 12:29:48 UTC (rev 1501) @@ -1,2 +1,4 @@ intProperty=2 stringProperty=property +sub= replaced +nested= property ${sub} ${base} \ No newline at end of file Modified: trunk/openutils-deployment/src/test/resources/spring-tests.xml =================================================================== --- trunk/openutils-deployment/src/test/resources/spring-tests.xml 2009-10-27 15:06:20 UTC (rev 1500) +++ trunk/openutils-deployment/src/test/resources/spring-tests.xml 2009-11-26 12:29:48 UTC (rev 1501) @@ -5,7 +5,7 @@ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <bean id="environmentProperties" class="it.openutils.deployment.spring.EnvironmentPropertyConfigurer"> - <property name="fileLocation" value="classpath:environment.properties" /> + <property name="fileLocation" value="classpath:environment-base.properties, classpath:environment.properties" /> <property name="ignoreUnresolvablePlaceholders" value="true" /> <property name="exposeSystemProperties" value="true" /> </bean> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gca...@us...> - 2009-10-27 15:06:27
|
Revision: 1500 http://openutils.svn.sourceforge.net/openutils/?rev=1500&view=rev Author: gcatania Date: 2009-10-27 15:06:20 +0000 (Tue, 27 Oct 2009) Log Message: ----------- BSHD-2 removed unnecessary qualifiers Modified Paths: -------------- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java Modified: trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java 2009-10-27 15:03:56 UTC (rev 1499) +++ trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java 2009-10-27 15:06:20 UTC (rev 1500) @@ -31,7 +31,7 @@ * @param orders the orders to apply with respect to entity class properties * @return the list of all entity instances (never null), ordered accordingly */ - List<T> findAll(final Order[] orders); + List<T> findAll(Order[] orders); /** * Retrieve all entities handled by this DAO that match the input query string. @@ -58,7 +58,7 @@ * @param paramTypes the Hibernate types of <code>paramValues</code> * @return a list of distinct entity instances (never null) */ - List<T> find(final String query, final Object[] paramValues, final Type[] paramTypes); + List<T> find(String query, Object[] paramValues, Type[] paramTypes); /** * Retrieve the entities handled by this DAO whose property values match, via <code>equals()</code>, @@ -66,7 +66,7 @@ * @param filter an instance of this DAO's entity class to be used as filter * @return a list of distinct entity instances (never null) */ - List<T> findFiltered(final T filter); + List<T> findFiltered(T filter); /** * Retrieve the entities handled by this DAO whose property values match, via <code>equals()</code>, @@ -76,7 +76,7 @@ * @param orders the orders to apply with respect to entity class properties * @return a list of distinct entity instances (never null) */ - List<T> findFiltered(final T filter, final Order[] orders); + List<T> findFiltered(T filter, Order[] orders); /** * Retrieve the entities handled by this DAO whose property values match, via <code>equals()</code>, @@ -88,7 +88,7 @@ * pagination * @return a list of distinct entity instances (never null) */ - List<T> findFiltered(final T filter, final int maxResults, final int page); + List<T> findFiltered(T filter, int maxResults, int page); /** * Retrieve the entities handled by this DAO whose property values match, via <code>equals()</code> or via a @@ -98,7 +98,7 @@ * that will be used for comparing values of the corresponding property * @return a list of distinct entity instances (never null) */ - List<T> findFiltered(final T filter, Map<String, ? extends FilterMetadata> metadata); + List<T> findFiltered(T filter, Map<String, ? extends FilterMetadata> metadata); /** * Retrieve the entities handled by this DAO whose property values match, via <code>equals()</code> or via a @@ -112,8 +112,7 @@ * pagination * @return a list of distinct entity instances (never null) */ - List<T> findFiltered(final T filter, Map<String, ? extends FilterMetadata> metadata, final int maxResults, - final int page); + List<T> findFiltered(T filter, Map<String, ? extends FilterMetadata> metadata, int maxResults, int page); /** * Retrieve the first entity instance that matches the input <code>filter</code>, if existing. @@ -121,7 +120,7 @@ * @return the first matching instance of the entity class managed by this DAO, or <code>null</code> if none found * @see #findFiltered(T) */ - T findFilteredFirst(final T filter); + T findFilteredFirst(T filter); /** * Retrieve the first entity instance that matches the input <code>filter</code>, if existing. @@ -130,7 +129,7 @@ * @return the first matching instance of the entity class managed by this DAO, or <code>null</code> if none found * @see #findFiltered(T, Order...) */ - T findFilteredFirst(final T filter, final Order[] orders); + T findFilteredFirst(T filter, Order[] orders); /** * Retrieve the first entity instance that matches the input <code>filter</code> and the additional input @@ -140,7 +139,7 @@ * @return the first matching instance of the entity class managed by this DAO, or <code>null</code> if none found * @see #findFiltered(T, List) */ - T findFilteredFirst(final T filter, final List< ? extends Criterion> criteria); + T findFilteredFirst(T filter, List< ? extends Criterion> criteria); /** * Load object matching the given key and return it. Throw an exception if not found. @@ -184,7 +183,7 @@ * depending upon the value of its identifier property. * @param obj Object */ - void saveOrUpdate(final T obj); + void saveOrUpdate(T obj); /** * Used by the base DAO classes but here for your modification. Remove a persistent instance from the datastore. The @@ -193,7 +192,7 @@ * @param key key * @return true if the object was successfully deleted, false otherwise */ - boolean delete(final K key); + boolean delete(K key); /** * Re-reads the state of the given instance from the underlying database. This method is useful in certain special @@ -234,7 +233,7 @@ * @param criteria Additional Criterion conditions * @return a list of all instances */ - List<T> findAll(final Order[] orderProperties, List< ? extends Criterion> criteria); + List<T> findAll(Order[] orderProperties, List< ? extends Criterion> criteria); /** * Retrieve the entities handled by this DAO whose property values match, via <code>equals()</code> or via a @@ -250,8 +249,8 @@ * pagination * @return a list of distinct entity instances (never null) */ - List<T> findFiltered(final T filter, final Order[] orders, final Map<String, ? extends FilterMetadata> metadata, - final int maxResults, final int page); + List<T> findFiltered(T filter, Order[] orders, Map<String, ? extends FilterMetadata> metadata, int maxResults, + int page); /** * Retrieve the entities handled by this DAO whose property values match, via <code>equals()</code> or via a @@ -268,8 +267,8 @@ * @param criteria a list of additional Hibernate criteria * @return a list of distinct entity instances (never null) */ - List<T> findFiltered(final T filter, final Order[] orders, final Map<String, ? extends FilterMetadata> metadata, - final int maxResults, final int page, List< ? extends Criterion> criteria); + List<T> findFiltered(T filter, Order[] orders, Map<String, ? extends FilterMetadata> metadata, int maxResults, + int page, List< ? extends Criterion> criteria); /** * Retrieve a set of properties from the entities returned by @@ -286,8 +285,7 @@ * @param properties the names of the properties to return * @return a list of distinct entity instances (never null) */ - List< ? > findFilteredProperties(final T filter, final Order[] orders, - final Map<String, ? extends FilterMetadata> metadata, final int maxResults, final int page, - List< ? extends Criterion> criteria, List<String> properties); + List< ? > findFilteredProperties(T filter, Order[] orders, Map<String, ? extends FilterMetadata> metadata, + int maxResults, int page, List< ? extends Criterion> criteria, List<String> properties); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gca...@us...> - 2009-10-27 15:04:07
|
Revision: 1499 http://openutils.svn.sourceforge.net/openutils/?rev=1499&view=rev Author: gcatania Date: 2009-10-27 15:03:56 +0000 (Tue, 27 Oct 2009) Log Message: ----------- BSHD-2 javadocs and parameter values Modified Paths: -------------- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java Modified: trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java 2009-10-27 14:46:06 UTC (rev 1498) +++ trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java 2009-10-27 15:03:56 UTC (rev 1499) @@ -14,144 +14,160 @@ /** * @author Fabrizio Giustina * @version $Id$ - * @param <T> Persistence class - * @param <K> Object Key + * @param <T> the persistence entity class that this DAO will handle + * @param <K> the class of <code>T</code>'s id property */ public interface HibernateDAO<T, K extends Serializable> { /** - * Return all objects related to the implementation of this DAO with no filter. - * @return a list of all instances + * Retrieve all entities handled by this DAO, in no particular order. + * @return the list of all entity instances (never null) */ List<T> findAll(); /** - * Return all objects related to the implementation of this DAO with no filter. - * @param orderProperties <code>desc</code> or <code>asc</code> - * @return a list of all instances + * Retrieve all entities handled by this DAO, ordered according to the input <code>orders</code>. + * @param orders the orders to apply with respect to entity class properties + * @return the list of all entity instances (never null), ordered accordingly */ - List<T> findAll(final Order[] orderProperties); + List<T> findAll(final Order[] orders); /** - * Execute a query. - * @param query a query expressed in Hibernate's query language - * @return a distinct list of instances (or arrays of instances) + * Retrieve all entities handled by this DAO that match the input query string. + * @param query an HQL query + * @return a list of distinct entity instances (never null) */ List<T> find(String query); /** - * Execute a query. - * @param query a query expressed in Hibernate's query language - * @param obj filter value - * @param type filter type - * @return a distinct list of instances (or arrays of instances) + * Retrieve all entities handled by this DAO that match the input query string, accepting one query parameter and + * the corresponding type. + * @param query an HQL query + * @param paramValue the value of a parameter to be set in the query + * @param paramType the Hibernate type of <code>paramValue</code> + * @return a list of distinct entity instances (never null) */ - List<T> find(String query, Object obj, Type type); + List<T> find(String query, Object paramValue, Type paramType); /** - * Execute a query. - * @param query a query expressed in Hibernate's query language - * @param obj filter values - * @param type filter types - * @return a distinct list of instances (or arrays of instances) + * Retrieve all entities handled by this DAO that match the input query string, accepting one query parameter and + * the corresponding type. + * @param query an HQL query + * @param paramValues the parameter values to be set in the query + * @param paramTypes the Hibernate types of <code>paramValues</code> + * @return a list of distinct entity instances (never null) */ - List<T> find(final String query, final Object[] obj, final Type[] type); + List<T> find(final String query, final Object[] paramValues, final Type[] paramTypes); /** - * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. - * @param filter an instance of the object with the properties you wish to filter on. - * @return list of objects + * Retrieve the entities handled by this DAO whose property values match, via <code>equals()</code>, + * <code>filter</code>'s non-null property values. + * @param filter an instance of this DAO's entity class to be used as filter + * @return a list of distinct entity instances (never null) */ List<T> findFiltered(final T filter); /** - * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. - * @param filter an instance of the object with the properties you wish to filter on. - * @param orderProperties the name of the property used for ordering - * @return list of objects + * Retrieve the entities handled by this DAO whose property values match, via <code>equals()</code>, + * <code>filter</code>'s non-null property values. The result list is ordered according to the input + * <code>orders</code> parameter. + * @param filter an instance of this DAO's entity class to be used as filter + * @param orders the orders to apply with respect to entity class properties + * @return a list of distinct entity instances (never null) */ - List<T> findFiltered(final T filter, final Order[] orderProperties); + List<T> findFiltered(final T filter, final Order[] orders); /** - * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. - * @param filter an instance of the object with the properties you wish to filter on. - * @param maxResults maximum number of results - * @param page result page (first result is maxResults * page) - * @return list of objects + * Retrieve the entities handled by this DAO whose property values match, via <code>equals()</code>, + * <code>filter</code>'s non-null property values. + * @param filter an instance of this DAO's entity class to be used as filter + * @param maxResults the maximum number of results to be fetched + * @param page the zero-based page number to use when displaying paginated results (the first entity returned is the + * one at position <code>maxResults * page</code> in the complete list of results), or <code>0</code> for no + * pagination + * @return a list of distinct entity instances (never null) */ List<T> findFiltered(final T filter, final int maxResults, final int page); /** - * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. - * @param filter an instance of the object with the properties you wish to filter on. - * @param metadata filter metadata - * @return list of objects + * Retrieve the entities handled by this DAO whose property values match, via <code>equals()</code> or via a + * specified <code>FilterMetadata</code> object, <code>filter</code>'s non-null property values. + * @param filter an instance of this DAO's entity class to be used as filter + * @param metadata a map that matches names of entity class properties to <code>FilterMetadata</code> modifiers, + * that will be used for comparing values of the corresponding property + * @return a list of distinct entity instances (never null) */ List<T> findFiltered(final T filter, Map<String, ? extends FilterMetadata> metadata); /** - * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. - * @param filter an instance of the object with the properties you wish to filter on. - * @param metadata filter metadata - * @param maxResults maximum number of results - * @param page result page (first result is maxResults * page) - * @return list of objects + * Retrieve the entities handled by this DAO whose property values match, via <code>equals()</code> or via a + * specified <code>FilterMetadata</code> object, <code>filter</code>'s non-null property values. + * @param filter an instance of this DAO's entity class to be used as filter + * @param metadata a map that matches names of entity class properties to <code>FilterMetadata</code> modifiers, + * that will be used for comparing values of the corresponding property + * @param maxResults the maximum number of results to be fetched + * @param page the zero-based page number to use when displaying paginated results (the first entity returned is the + * one at position <code>maxResults * page</code> in the complete list of results), or <code>0</code> for no + * pagination + * @return a list of distinct entity instances (never null) */ List<T> findFiltered(final T filter, Map<String, ? extends FilterMetadata> metadata, final int maxResults, final int page); /** - * Return the first object related to the implementation of this DAO filtered using properties of the provided - * instance. - * @param filter an instance of the object with the properties you wish to filter on. - * @return first object in the collection + * Retrieve the first entity instance that matches the input <code>filter</code>, if existing. + * @param filter an instance of this DAO's entity class to be used as filter + * @return the first matching instance of the entity class managed by this DAO, or <code>null</code> if none found + * @see #findFiltered(T) */ T findFilteredFirst(final T filter); /** - * Return the first object related to the implementation of this DAO filtered using properties of the provided - * instance. - * @param filter an instance of the object with the properties you wish to filter on. - * @return first object in the collection + * Retrieve the first entity instance that matches the input <code>filter</code>, if existing. + * @param filter an instance of this DAO's entity class to be used as filter + * @param orders the orders to apply with respect to entity class properties + * @return the first matching instance of the entity class managed by this DAO, or <code>null</code> if none found + * @see #findFiltered(T, Order...) */ - T findFilteredFirst(final T filter, final Order[] order); + T findFilteredFirst(final T filter, final Order[] orders); /** - * Return the first object related to the implementation of this DAO filtered using properties of the provided - * instance. - * @param filter an instance of the object with the properties you wish to filter on. - * @param criteria additional criterion - * @return first object in the collection + * Retrieve the first entity instance that matches the input <code>filter</code> and the additional input + * <code>criteria</code>, if existing. + * @param filter an instance of this DAO's entity class to be used as filter + * @param criteria a list of additional Hibernate criteria + * @return the first matching instance of the entity class managed by this DAO, or <code>null</code> if none found + * @see #findFiltered(T, List) */ T findFilteredFirst(final T filter, final List< ? extends Criterion> criteria); /** * Load object matching the given key and return it. Throw an exception if not found. - * @param key serializable key - * @return Object + * @param key the id of the entity instance to load + * @return the found entity instance (never null) */ T load(K key); /** * Load object matching the given key and return it. Lazy object will be initialized. - * @param key serializable key - * @return Object + * @param key the id of the entity instance to load + * @return the found entity instance, or null if none found */ T loadIfAvailable(K key); /** * Load object matching the given key and return it. Lazy object will be initialized. - * @param key serializable key - * @return Object + * @param key the id of the entity instance to load + * @return the found entity instance (never null) */ T get(K key); /** * Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the * identifier property if the assigned generator is used.) - * @param obj Object - * @return generated id + * @param obj the entity instance to save + * @return the id generated for the persisted instance */ K save(T obj); @@ -180,30 +196,31 @@ boolean delete(final K key); /** - * Re-read the state of the given instance from the underlying database. It is inadvisable to use this to implement - * long-running sessions that span many business tasks. This method is, however, useful in certain special - * circumstances. For example + * Re-reads the state of the given instance from the underlying database. This method is useful in certain special + * circumstances, for example: * <ul> - * <li>where a database trigger alters the object state upon insert or update - * <li>after executing direct SQL (eg. a mass update) in the same session - * <li>after inserting a <tt>Blob</tt> or <tt>Clob</tt> + * <li>when a database trigger is known to alter the object state right after <code>INSERT</code> or + * <code>UPDATE</code> statements + * <li>after some operation (e.g. a mass update) has been executed via direct SQL in the same session + * <li>after modifying a database field of type <tt>Blob</tt> or <tt>Clob</tt> * </ul> - * @param obj Object + * However, use of this method in long-running sessions that span many business tasks is discouraged. + * @param obj the entity instance to refresh */ void refresh(T obj); /** * Remove the given object from the Session cache. - * @param obj Object + * @param obj the entity instance to remove */ void evict(T obj); /** - * Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent - * instance currently associated with the session, it will be loaded. Return the persistent instance. If the given - * instance is unsaved, save a copy of and return it as a newly persistent instance. The given instance does not - * become associated with the session. This operation cascades to associated instances if the association is mapped - * with <tt>cascade="merge"</tt>.<br> + * Copies the state of the given object onto the persistent object with the same identifier, and returns the updated + * persistent instance. If there is no persistent instance currently associated with the session, a new one will be + * loaded. If the given instance is unsaved, saves a copy of and return it as a newly persisted instance. The given + * instance does not become associated with the session. This operation cascades to associated instances if the + * association is mapped with <code>cascade="merge"</code>.<br> * <br> * The semantics of this method are defined by JSR-220. * @param obj a detached instance with state to be copied @@ -220,45 +237,57 @@ List<T> findAll(final Order[] orderProperties, List< ? extends Criterion> criteria); /** - * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. - * @param filter an instance of the object with the properties you wish to filter on. - * @param customOrder order criterias - * @param metadata filter metadata - * @param maxResults maximum number of results - * @param page result page (first result is maxResults * page) - * @return list of objects + * Retrieve the entities handled by this DAO whose property values match, via <code>equals()</code> or via a + * specified <code>FilterMetadata</code> object, <code>filter</code>'s non-null property values. The result list is + * ordered according to the <code>orders</code> parameter. + * @param filter an instance of this DAO's entity class to be used as filter + * @param orders the orders to apply with respect to entity class properties + * @param metadata a map that matches names of entity class properties to <code>FilterMetadata</code> modifiers, + * that will be used for comparing values of the corresponding property + * @param maxResults the maximum number of results to be fetched + * @param page the zero-based page number to use when displaying paginated results (the first entity returned is the + * one at position <code>maxResults * page</code> in the complete list of results), or <code>0</code> for no + * pagination + * @return a list of distinct entity instances (never null) */ - List<T> findFiltered(final T filter, final Order[] customOrder, - final Map<String, ? extends FilterMetadata> metadata, final int maxResults, final int page); + List<T> findFiltered(final T filter, final Order[] orders, final Map<String, ? extends FilterMetadata> metadata, + final int maxResults, final int page); /** - * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. - * @param filter an instance of the object with the properties you wish to filter on. - * @param customOrder order criterias - * @param metadata filter metadata - * @param maxResults maximum number of results - * @param page result page (first result is maxResults * page) - * @param additionalCriteria additional criteria - * @return list of objects + * Retrieve the entities handled by this DAO whose property values match, via <code>equals()</code> or via a + * specified <code>FilterMetadata</code> object, <code>filter</code>'s non-null property values, and the input + * <code>criteria</code>. + * @param filter an instance of this DAO's entity class to be used as filter + * @param orders the orders to apply with respect to entity class properties + * @param metadata a map that matches names of entity class properties to <code>FilterMetadata</code> modifiers, + * that will be used for comparing values of the corresponding property + * @param maxResults the maximum number of results to be fetched + * @param page the zero-based page number to use when displaying paginated results (the first entity returned is the + * one at position <code>maxResults * page</code> in the complete list of results), or <code>0</code> for no + * pagination + * @param criteria a list of additional Hibernate criteria + * @return a list of distinct entity instances (never null) */ - List<T> findFiltered(final T filter, final Order[] customOrder, - final Map<String, ? extends FilterMetadata> metadata, final int maxResults, final int page, - List< ? extends Criterion> additionalCriteria); + List<T> findFiltered(final T filter, final Order[] orders, final Map<String, ? extends FilterMetadata> metadata, + final int maxResults, final int page, List< ? extends Criterion> criteria); /** - * Return properties from all objects related to the implementation of this DAO filtered using properties of the - * provided instance. - * @param filter an instance of the object with the properties you wish to filter on. - * @param customOrder order criterias - * @param metadata filter metadata - * @param maxResults maximum number of results - * @param page result page (first result is maxResults * page) - * @param additionalCriteria additional criteria - * @param properties properties to be returned - * @return list of properties from all objects + * Retrieve a set of properties from the entities returned by + * {@link #findFiltered(Object, Order[], Map, int, int, List)} + * @param filter an instance of this DAO's entity class to be used as filter + * @param orders the orders to apply with respect to entity class properties + * @param metadata a map that matches names of entity class properties to <code>FilterMetadata</code> modifiers, + * that will be used for comparing values of the corresponding property + * @param maxResults the maximum number of results to be fetched + * @param page the zero-based page number to use when displaying paginated results (the first entity returned is the + * one at position <code>maxResults * page</code> in the complete list of results), or <code>0</code> for no + * pagination + * @param criteria a list of additional Hibernate criteria + * @param properties the names of the properties to return + * @return a list of distinct entity instances (never null) */ - List< ? > findFilteredProperties(final T filter, final Order[] customOrder, + List< ? > findFilteredProperties(final T filter, final Order[] orders, final Map<String, ? extends FilterMetadata> metadata, final int maxResults, final int page, - List< ? extends Criterion> additionalCriteria, List<String> properties); + List< ? extends Criterion> criteria, List<String> properties); } Modified: trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2009-10-27 14:46:06 UTC (rev 1498) +++ trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2009-10-27 15:03:56 UTC (rev 1499) @@ -71,9 +71,9 @@ /** * {@inheritDoc} */ - public List<T> findAll(Order[] orderProperties) + public List<T> findAll(Order[] orders) { - return getThis().findAll(orderProperties, Collections.<Criterion> emptyList()); + return getThis().findAll(orders, Collections.<Criterion> emptyList()); } /** @@ -88,16 +88,16 @@ /** * {@inheritDoc} */ - public List<T> find(String query, Object obj, Type type) + public List<T> find(String query, Object paramValue, Type paramType) { - return getThis().find(query, new Object[]{obj }, new Type[]{type }); + return getThis().find(query, new Object[]{paramValue }, new Type[]{paramType }); } /** * {@inheritDoc} */ @SuppressWarnings("unchecked") - public List<T> find(final String query, final Object[] obj, final Type[] type) + public List<T> find(final String query, final Object[] paramValues, final Type[] paramTypes) { return (List<T>) getHibernateTemplate().execute(new HibernateCallback() { @@ -105,7 +105,7 @@ public Object doInHibernate(final Session ses) throws HibernateException { // hibernate 3 - return ses.createQuery(query).setParameters(obj, type).list(); + return ses.createQuery(query).setParameters(paramValues, paramTypes).list(); } }); } @@ -121,9 +121,9 @@ /** * {@inheritDoc} */ - public List<T> findFiltered(T filter, Order[] orderProperties) + public List<T> findFiltered(T filter, Order[] orders) { - return findFiltered(filter, orderProperties, getDefaultFilterMetadata(), Integer.MAX_VALUE, 0); + return findFiltered(filter, orders, getDefaultFilterMetadata(), Integer.MAX_VALUE, 0); } /** @@ -161,9 +161,9 @@ /** * {@inheritDoc} */ - public T findFilteredFirst(T filter, final Order[] order) + public T findFilteredFirst(T filter, final Order[] orders) { - return getFirstInCollection(findFiltered(filter, order, getDefaultFilterMetadata(), 1, 0)); + return getFirstInCollection(findFiltered(filter, orders, getDefaultFilterMetadata(), 1, 0)); } /** @@ -296,7 +296,7 @@ * {@inheritDoc} */ @SuppressWarnings("unchecked") - public List<T> findAll(final Order[] orderProperties, final List< ? extends Criterion> criteria) + public List<T> findAll(final Order[] orders, final List< ? extends Criterion> criteria) { return (List<T>) getHibernateTemplate().execute(new HibernateCallback() { @@ -304,11 +304,11 @@ public Object doInHibernate(final Session ses) throws HibernateException { Criteria crit = ses.createCriteria(getReferenceClass()); - if (null != orderProperties) + if (null != orders) { - for (int j = 0; j < orderProperties.length; j++) + for (int j = 0; j < orders.length; j++) { - crit.addOrder(orderProperties[j]); + crit.addOrder(orders[j]); } } @@ -343,36 +343,22 @@ * {@inheritDoc} */ @SuppressWarnings("unchecked") - public List<T> findFiltered(T filter, Order[] customOrder, Map<String, ? extends FilterMetadata> metadata, - int maxResults, int page, List< ? extends Criterion> additionalCriteria) + public List<T> findFiltered(T filter, Order[] orders, Map<String, ? extends FilterMetadata> metadata, + int maxResults, int page, List< ? extends Criterion> criteria) { return (List<T>) getHibernateTemplate().execute( - new HibernateCallbackForExecution( - filter, - page, - maxResults, - metadata, - customOrder, - additionalCriteria, - Collections.<String> emptyList())); + new HibernateCallbackForExecution(filter, page, maxResults, metadata, orders, criteria, Collections + .<String> emptyList())); } /** * {@inheritDoc} */ - public List< ? > findFilteredProperties(T filter, Order[] customOrder, - Map<String, ? extends FilterMetadata> metadata, int maxResults, int page, - List< ? extends Criterion> additionalCriteria, List<String> properties) + public List< ? > findFilteredProperties(T filter, Order[] orders, Map<String, ? extends FilterMetadata> metadata, + int maxResults, int page, List< ? extends Criterion> criteria, List<String> properties) { return (List< ? >) getHibernateTemplate().execute( - new HibernateCallbackForExecution( - filter, - page, - maxResults, - metadata, - customOrder, - additionalCriteria, - properties)); + new HibernateCallbackForExecution(filter, page, maxResults, metadata, orders, criteria, properties)); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gca...@us...> - 2009-10-27 14:46:22
|
Revision: 1498 http://openutils.svn.sourceforge.net/openutils/?rev=1498&view=rev Author: gcatania Date: 2009-10-27 14:46:06 +0000 (Tue, 27 Oct 2009) Log Message: ----------- BSHD-2 reordered methods Modified Paths: -------------- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java Modified: trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java 2009-10-23 08:13:33 UTC (rev 1497) +++ trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAO.java 2009-10-27 14:46:06 UTC (rev 1498) @@ -21,13 +21,6 @@ { /** - * Execute a query. - * @param query a query expressed in Hibernate's query language - * @return a distinct list of instances (or arrays of instances) - */ - List<T> find(String query); - - /** * Return all objects related to the implementation of this DAO with no filter. * @return a list of all instances */ @@ -41,12 +34,11 @@ List<T> findAll(final Order[] orderProperties); /** - * Return all objects related to the implementation of this DAO with no filter. - * @param orderProperties <code>desc</code> or <code>asc</code> - * @param criteria Additional Criterion conditions - * @return a list of all instances + * Execute a query. + * @param query a query expressed in Hibernate's query language + * @return a distinct list of instances (or arrays of instances) */ - List<T> findAll(final Order[] orderProperties, List< ? extends Criterion> criteria); + List<T> find(String query); /** * Execute a query. @@ -67,123 +59,49 @@ List<T> find(final String query, final Object[] obj, final Type[] type); /** - * Re-read the state of the given instance from the underlying database. It is inadvisable to use this to implement - * long-running sessions that span many business tasks. This method is, however, useful in certain special - * circumstances. For example - * <ul> - * <li>where a database trigger alters the object state upon insert or update - * <li>after executing direct SQL (eg. a mass update) in the same session - * <li>after inserting a <tt>Blob</tt> or <tt>Clob</tt> - * </ul> - * @param obj Object - */ - void refresh(T obj); - - /** - * Remove the given object from the Session cache. - * @param obj Object - */ - void evict(T obj); - - /** - * Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent - * instance currently associated with the session, it will be loaded. Return the persistent instance. If the given - * instance is unsaved, save a copy of and return it as a newly persistent instance. The given instance does not - * become associated with the session. This operation cascades to associated instances if the association is mapped - * with <tt>cascade="merge"</tt>.<br> - * <br> - * The semantics of this method are defined by JSR-220. - * @param obj a detached instance with state to be copied - * @return an updated persistent instance - */ - T merge(T obj); - - /** * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. * @param filter an instance of the object with the properties you wish to filter on. - * @param maxResults maximum number of results - * @param page result page (first result is maxResults * page) * @return list of objects */ - List<T> findFiltered(final T filter, final int maxResults, final int page); + List<T> findFiltered(final T filter); /** * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. * @param filter an instance of the object with the properties you wish to filter on. - * @param metadata filter metadata - * @param maxResults maximum number of results - * @param page result page (first result is maxResults * page) + * @param orderProperties the name of the property used for ordering * @return list of objects */ - List<T> findFiltered(final T filter, Map<String, ? extends FilterMetadata> metadata, final int maxResults, - final int page); + List<T> findFiltered(final T filter, final Order[] orderProperties); /** * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. * @param filter an instance of the object with the properties you wish to filter on. - * @param customOrder order criterias - * @param metadata filter metadata * @param maxResults maximum number of results * @param page result page (first result is maxResults * page) * @return list of objects */ - List<T> findFiltered(final T filter, final Order[] customOrder, - final Map<String, ? extends FilterMetadata> metadata, final int maxResults, final int page); + List<T> findFiltered(final T filter, final int maxResults, final int page); /** * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. * @param filter an instance of the object with the properties you wish to filter on. - * @param customOrder order criterias * @param metadata filter metadata - * @param maxResults maximum number of results - * @param page result page (first result is maxResults * page) - * @param additionalCriteria additional criteria * @return list of objects */ - List<T> findFiltered(final T filter, final Order[] customOrder, - final Map<String, ? extends FilterMetadata> metadata, final int maxResults, final int page, - List< ? extends Criterion> additionalCriteria); + List<T> findFiltered(final T filter, Map<String, ? extends FilterMetadata> metadata); /** - * Return properties from all objects related to the implementation of this DAO filtered using properties of the - * provided instance. + * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. * @param filter an instance of the object with the properties you wish to filter on. - * @param customOrder order criterias * @param metadata filter metadata * @param maxResults maximum number of results * @param page result page (first result is maxResults * page) - * @param additionalCriteria additional criteria - * @param properties properties to be returned - * @return list of properties from all objects - */ - List< ? > findFilteredProperties(final T filter, final Order[] customOrder, - final Map<String, ? extends FilterMetadata> metadata, final int maxResults, final int page, - List< ? extends Criterion> additionalCriteria, List<String> properties); - - /** - * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. - * @param filter an instance of the object with the properties you wish to filter on. * @return list of objects */ - List<T> findFiltered(final T filter); + List<T> findFiltered(final T filter, Map<String, ? extends FilterMetadata> metadata, final int maxResults, + final int page); /** - * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. - * @param filter an instance of the object with the properties you wish to filter on. - * @param orderProperties the name of the property used for ordering - * @return list of objects - */ - List<T> findFiltered(final T filter, final Order[] orderProperties); - - /** - * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. - * @param filter an instance of the object with the properties you wish to filter on. - * @param metadata filter metadata - * @return list of objects - */ - List<T> findFiltered(final T filter, Map<String, ? extends FilterMetadata> metadata); - - /** * Return the first object related to the implementation of this DAO filtered using properties of the provided * instance. * @param filter an instance of the object with the properties you wish to filter on. @@ -209,15 +127,6 @@ T findFilteredFirst(final T filter, final List< ? extends Criterion> criteria); /** - * Used by the base DAO classes but here for your modification. Remove a persistent instance from the datastore. The - * argument may be an instance associated with the receiving Session or a transient instance with an identifier - * associated with existing persistent state. - * @param key key - * @return true if the object was successfully deleted, false otherwise - */ - boolean delete(final K key); - - /** * Load object matching the given key and return it. Throw an exception if not found. * @param key serializable key * @return Object @@ -239,11 +148,12 @@ T get(K key); /** - * Used by the base DAO classes but here for your modification Either save() or update() the given instance, - * depending upon the value of its identifier property. + * Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the + * identifier property if the assigned generator is used.) * @param obj Object + * @return generated id */ - void saveOrUpdate(final T obj); + K save(T obj); /** * Used by the base DAO classes but here for your modification Update the persistent state associated with the given @@ -254,11 +164,101 @@ void update(T obj); /** - * Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the - * identifier property if the assigned generator is used.) + * Used by the base DAO classes but here for your modification Either save() or update() the given instance, + * depending upon the value of its identifier property. * @param obj Object - * @return generated id */ - K save(T obj); + void saveOrUpdate(final T obj); + /** + * Used by the base DAO classes but here for your modification. Remove a persistent instance from the datastore. The + * argument may be an instance associated with the receiving Session or a transient instance with an identifier + * associated with existing persistent state. + * @param key key + * @return true if the object was successfully deleted, false otherwise + */ + boolean delete(final K key); + + /** + * Re-read the state of the given instance from the underlying database. It is inadvisable to use this to implement + * long-running sessions that span many business tasks. This method is, however, useful in certain special + * circumstances. For example + * <ul> + * <li>where a database trigger alters the object state upon insert or update + * <li>after executing direct SQL (eg. a mass update) in the same session + * <li>after inserting a <tt>Blob</tt> or <tt>Clob</tt> + * </ul> + * @param obj Object + */ + void refresh(T obj); + + /** + * Remove the given object from the Session cache. + * @param obj Object + */ + void evict(T obj); + + /** + * Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent + * instance currently associated with the session, it will be loaded. Return the persistent instance. If the given + * instance is unsaved, save a copy of and return it as a newly persistent instance. The given instance does not + * become associated with the session. This operation cascades to associated instances if the association is mapped + * with <tt>cascade="merge"</tt>.<br> + * <br> + * The semantics of this method are defined by JSR-220. + * @param obj a detached instance with state to be copied + * @return an updated persistent instance + */ + T merge(T obj); + + /** + * Return all objects related to the implementation of this DAO with no filter. + * @param orderProperties <code>desc</code> or <code>asc</code> + * @param criteria Additional Criterion conditions + * @return a list of all instances + */ + List<T> findAll(final Order[] orderProperties, List< ? extends Criterion> criteria); + + /** + * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. + * @param filter an instance of the object with the properties you wish to filter on. + * @param customOrder order criterias + * @param metadata filter metadata + * @param maxResults maximum number of results + * @param page result page (first result is maxResults * page) + * @return list of objects + */ + List<T> findFiltered(final T filter, final Order[] customOrder, + final Map<String, ? extends FilterMetadata> metadata, final int maxResults, final int page); + + /** + * Return all objects related to the implementation of this DAO filtered using properties of the provided instance. + * @param filter an instance of the object with the properties you wish to filter on. + * @param customOrder order criterias + * @param metadata filter metadata + * @param maxResults maximum number of results + * @param page result page (first result is maxResults * page) + * @param additionalCriteria additional criteria + * @return list of objects + */ + List<T> findFiltered(final T filter, final Order[] customOrder, + final Map<String, ? extends FilterMetadata> metadata, final int maxResults, final int page, + List< ? extends Criterion> additionalCriteria); + + /** + * Return properties from all objects related to the implementation of this DAO filtered using properties of the + * provided instance. + * @param filter an instance of the object with the properties you wish to filter on. + * @param customOrder order criterias + * @param metadata filter metadata + * @param maxResults maximum number of results + * @param page result page (first result is maxResults * page) + * @param additionalCriteria additional criteria + * @param properties properties to be returned + * @return list of properties from all objects + */ + List< ? > findFilteredProperties(final T filter, final Order[] customOrder, + final Map<String, ? extends FilterMetadata> metadata, final int maxResults, final int page, + List< ? extends Criterion> additionalCriteria, List<String> properties); + } Modified: trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java =================================================================== --- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2009-10-23 08:13:33 UTC (rev 1497) +++ trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2009-10-27 14:46:06 UTC (rev 1498) @@ -63,15 +63,6 @@ /** * {@inheritDoc} */ - @SuppressWarnings("unchecked") - public List<T> find(String query) - { - return getHibernateTemplate().find(query); - } - - /** - * {@inheritDoc} - */ public List<T> findAll() { return findAll(getDefaultOrder()); @@ -89,32 +80,9 @@ * {@inheritDoc} */ @SuppressWarnings("unchecked") - public List<T> findAll(final Order[] orderProperties, final List< ? extends Criterion> criteria) + public List<T> find(String query) { - return (List<T>) getHibernateTemplate().execute(new HibernateCallback() - { - - public Object doInHibernate(final Session ses) throws HibernateException - { - Criteria crit = ses.createCriteria(getReferenceClass()); - if (null != orderProperties) - { - for (int j = 0; j < orderProperties.length; j++) - { - crit.addOrder(orderProperties[j]); - } - - } - if (criteria != null) - { - for (Criterion criterion : criteria) - { - crit.add(criterion); - } - } - return crit.list(); - } - }); + return getHibernateTemplate().find(query); } /** @@ -145,6 +113,70 @@ /** * {@inheritDoc} */ + public List<T> findFiltered(T filter) + { + return findFiltered(filter, getDefaultFilterMetadata()); + } + + /** + * {@inheritDoc} + */ + public List<T> findFiltered(T filter, Order[] orderProperties) + { + return findFiltered(filter, orderProperties, getDefaultFilterMetadata(), Integer.MAX_VALUE, 0); + } + + /** + * {@inheritDoc} + */ + public List<T> findFiltered(T filter, int maxResults, int page) + { + return findFiltered(filter, getDefaultFilterMetadata(), maxResults, page); + } + + /** + * {@inheritDoc} + */ + public List<T> findFiltered(T filter, Map<String, ? extends FilterMetadata> metadata) + { + return findFiltered(filter, metadata, Integer.MAX_VALUE, 0); + } + + /** + * {@inheritDoc} + */ + public List<T> findFiltered(T filter, Map<String, ? extends FilterMetadata> metadata, int maxResults, int page) + { + return findFiltered(filter, getDefaultOrder(), metadata, maxResults, page); + } + + /** + * {@inheritDoc} + */ + public T findFilteredFirst(T filter) + { + return getFirstInCollection(findFiltered(filter, 1, 0)); + } + + /** + * {@inheritDoc} + */ + public T findFilteredFirst(T filter, final Order[] order) + { + return getFirstInCollection(findFiltered(filter, order, getDefaultFilterMetadata(), 1, 0)); + } + + /** + * {@inheritDoc} + */ + public T findFilteredFirst(T filter, List< ? extends Criterion> criteria) + { + return getFirstInCollection(findFiltered(filter, getDefaultOrder(), getDefaultFilterMetadata(), 1, 0, criteria)); + } + + /** + * {@inheritDoc} + */ public T load(K key) { @SuppressWarnings("unchecked") @@ -187,9 +219,10 @@ /** * {@inheritDoc} */ - public void saveOrUpdate(T obj) + @SuppressWarnings("unchecked") + public K save(T obj) { - getHibernateTemplate().saveOrUpdate(obj); + return (K) getHibernateTemplate().save(obj); } /** @@ -203,6 +236,14 @@ /** * {@inheritDoc} */ + public void saveOrUpdate(T obj) + { + getHibernateTemplate().saveOrUpdate(obj); + } + + /** + * {@inheritDoc} + */ public boolean delete(final K key) { @@ -255,78 +296,37 @@ * {@inheritDoc} */ @SuppressWarnings("unchecked") - public K save(T obj) + public List<T> findAll(final Order[] orderProperties, final List< ? extends Criterion> criteria) { - return (K) getHibernateTemplate().save(obj); - } + return (List<T>) getHibernateTemplate().execute(new HibernateCallback() + { - /** - * {@inheritDoc} - */ - public T findFilteredFirst(T filter) - { - return getFirstInCollection(findFiltered(filter, 1, 0)); - } + public Object doInHibernate(final Session ses) throws HibernateException + { + Criteria crit = ses.createCriteria(getReferenceClass()); + if (null != orderProperties) + { + for (int j = 0; j < orderProperties.length; j++) + { + crit.addOrder(orderProperties[j]); + } - /** - * {@inheritDoc} - */ - public T findFilteredFirst(T filter, final Order[] order) - { - return getFirstInCollection(findFiltered(filter, order, getDefaultFilterMetadata(), 1, 0)); + } + if (criteria != null) + { + for (Criterion criterion : criteria) + { + crit.add(criterion); + } + } + return crit.list(); + } + }); } /** * {@inheritDoc} */ - public T findFilteredFirst(T filter, List< ? extends Criterion> criteria) - { - return getFirstInCollection(findFiltered(filter, getDefaultOrder(), getDefaultFilterMetadata(), 1, 0, criteria)); - } - - /** - * {@inheritDoc} - */ - public List<T> findFiltered(T filter) - { - return findFiltered(filter, getDefaultFilterMetadata()); - } - - /** - * {@inheritDoc} - */ - public List<T> findFiltered(T filter, Order[] orderProperties) - { - return findFiltered(filter, orderProperties, getDefaultFilterMetadata(), Integer.MAX_VALUE, 0); - } - - /** - * {@inheritDoc} - */ - public List<T> findFiltered(T filter, Map<String, ? extends FilterMetadata> metadata) - { - return findFiltered(filter, metadata, Integer.MAX_VALUE, 0); - } - - /** - * {@inheritDoc} - */ - public List<T> findFiltered(T filter, int maxResults, int page) - { - return findFiltered(filter, getDefaultFilterMetadata(), maxResults, page); - } - - /** - * {@inheritDoc} - */ - public List<T> findFiltered(T filter, Map<String, ? extends FilterMetadata> metadata, int maxResults, int page) - { - return findFiltered(filter, getDefaultOrder(), metadata, maxResults, page); - } - - /** - * {@inheritDoc} - */ public List<T> findFiltered(T filter, Order[] customOrder, Map<String, ? extends FilterMetadata> metadata, int maxResults, int page) { @@ -376,12 +376,12 @@ } /** - * Return the specific Object class that will be used for class-specific implementation of this DAO. - * @return the reference Class + * Sets the aopenabled. + * @param aopenabled the aopenabled to set */ - protected Class<T> getReferenceClass() + public void setAopenabled(boolean aopenabled) { - return referenceClass; + this.aopenabled = aopenabled; } public void setReferenceClass(Class<T> referenceClass) @@ -390,6 +390,15 @@ } /** + * Return the specific Object class that will be used for class-specific implementation of this DAO. + * @return the reference Class + */ + protected Class<T> getReferenceClass() + { + return referenceClass; + } + + /** * Return a list of <code>Order</code> object to be used for the default ordering of the collection. * @return the property name */ @@ -532,15 +541,6 @@ } /** - * Sets the aopenabled. - * @param aopenabled the aopenabled to set - */ - public void setAopenabled(boolean aopenabled) - { - this.aopenabled = aopenabled; - } - - /** * @return This is needed as for http://opensource.atlassian.com/projects/spring/browse/SPR-2226 */ @SuppressWarnings("unchecked") @@ -572,7 +572,7 @@ * @author carone * @version $Id$ */ - private class HibernateCallbackForExecution implements HibernateCallback + private final class HibernateCallbackForExecution implements HibernateCallback { private T filter; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <die...@us...> - 2009-10-23 08:13:46
|
Revision: 1497 http://openutils.svn.sourceforge.net/openutils/?rev=1497&view=rev Author: diego_schivo Date: 2009-10-23 08:13:33 +0000 (Fri, 23 Oct 2009) Log Message: ----------- MEDIA-31 fixed empty <div> Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/resources/META-INF/tags/media.tag Modified: trunk/openutils-mgnlmedia/src/main/resources/META-INF/tags/media.tag =================================================================== --- trunk/openutils-mgnlmedia/src/main/resources/META-INF/tags/media.tag 2009-10-20 10:12:45 UTC (rev 1496) +++ trunk/openutils-mgnlmedia/src/main/resources/META-INF/tags/media.tag 2009-10-23 08:13:33 UTC (rev 1497) @@ -109,7 +109,7 @@ <c:if test="${!empty(url)}"> <c:set var="previewId" value="preview-${su:randomAlphanumeric(6)}" /> <div id="${previewId}" class="preview"> - <div id="no-player"> + <div id="no-player"><!-- --> </div> </div> <c:if This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-20 10:12:53
|
Revision: 1496 http://openutils.svn.sourceforge.net/openutils/?rev=1496&view=rev Author: molaschi Date: 2009-10-20 10:12:45 +0000 (Tue, 20 Oct 2009) Log Message: ----------- MEDIA-30 fix node name Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media/config.modules.media.processors.image-post.rc.xml Modified: trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media/config.modules.media.processors.image-post.rc.xml =================================================================== --- trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media/config.modules.media.processors.image-post.rc.xml 2009-10-19 15:57:11 UTC (rev 1495) +++ trunk/openutils-mgnlmedia/src/main/resources/mgnl-bootstrap/media/config.modules.media.processors.image-post.rc.xml 2009-10-20 10:12:45 UTC (rev 1496) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<sv:node sv:name="bw" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" +<sv:node sv:name="rc" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:html="http://www.w3.org/TR/REC-html40" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <die...@us...> - 2009-10-19 15:57:25
|
Revision: 1495 http://openutils.svn.sourceforge.net/openutils/?rev=1495&view=rev Author: diego_schivo Date: 2009-10-19 15:57:11 +0000 (Mon, 19 Oct 2009) Log Message: ----------- added trigger editors: media-picker, fckeditor, file-upload Modified Paths: -------------- trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/grid.css trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/LinkField.js Added Paths: ----------- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/fckedit-trigger.gif trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/fileupload-trigger.gif trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/media-trigger.gif trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fckeditor.html trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fileupload.html trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FckEditorField.js trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FileField.js trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/MediaField.js Added: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java =================================================================== --- trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java (rev 0) +++ trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java 2009-10-19 15:57:11 UTC (rev 1495) @@ -0,0 +1,110 @@ +package net.sourceforge.openutils.mgnlcontrols.dialog; + +import info.magnolia.cms.beans.runtime.Document; +import info.magnolia.cms.beans.runtime.MultipartForm; +import info.magnolia.cms.core.Content; +import info.magnolia.cms.core.HierarchyManager; +import info.magnolia.cms.core.ItemType; +import info.magnolia.cms.core.NodeData; +import info.magnolia.cms.core.Path; +import info.magnolia.cms.gui.fckeditor.FCKEditorTmpFiles; +import info.magnolia.cms.security.AccessDeniedException; +import info.magnolia.cms.util.ContentUtil; +import info.magnolia.cms.util.NodeDataUtil; +import info.magnolia.context.MgnlContext; +import info.magnolia.module.admininterface.FieldSaveHandler; +import info.magnolia.module.admininterface.SaveHandlerImpl; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.jcr.RepositoryException; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Needed by file upload. Setup: assign this class name as a "saveHandler" + * property of the grid field's configuration node. + * + * @author dschivo + * + */ +public class DialogGridSaveHandler implements FieldSaveHandler +{ + + public static Logger log = LoggerFactory.getLogger(DialogGridSaveHandler.class); + + @SuppressWarnings("unchecked") + public void save(Content parentNode, Content configNode, String name, MultipartForm form, int type, int valueType, + int isRichEditValue, int encoding) throws RepositoryException, AccessDeniedException + { + HierarchyManager hm = parentNode.getHierarchyManager(); + Content filesNode = ContentUtil.getOrCreateContent(parentNode, name + "_files", ItemType.CONTENTNODE); + String value = form.getParameter(name); + String ctx = MgnlContext.getContextPath(); + String tmpPath = "/tmp/fckeditor/"; + List usedFiles = new ArrayList(); + StringBuffer sbValue = new StringBuffer(value.length()); + StringBuffer sbLine = new StringBuffer(); + for (String line : StringUtils.splitPreserveAllTokens(value, '\n')) + { + for (String token : StringUtils.splitPreserveAllTokens(line, '\t')) + { + if (token.startsWith(ctx)) + { + String link = StringUtils.substringAfter(token, ctx); + if (StringUtils.startsWith(link, tmpPath)) + { + String uuid = StringUtils.substringBetween(link, tmpPath, "/"); + Document doc = FCKEditorTmpFiles.getDocument(uuid); + String fileNodeName = Path.getUniqueLabel(hm, filesNode.getHandle(), "file"); + SaveHandlerImpl.saveDocument(filesNode, doc, fileNodeName, "", ""); + link = filesNode.getHandle() + "/" + fileNodeName + "/" + doc.getFileNameWithExtension(); + token = link; + doc.delete(); + try + { + FileUtils.deleteDirectory(new java.io.File(Path.getTempDirectory() + "/fckeditor/" + uuid)); + } + catch (IOException e) + { + log.error("can't delete tmp file [" + Path.getTempDirectory() + "/fckeditor/" + uuid + "]"); + } + } + } + if (token.startsWith(filesNode.getHandle())) + { + String fileNodeName = StringUtils.removeStart(token, filesNode.getHandle() + "/"); + fileNodeName = StringUtils.substringBefore(fileNodeName, "/"); + usedFiles.add(fileNodeName); + } + if (sbLine.length() > 0) + { + sbLine.append('\t'); + } + sbLine.append(token); + } + if (sbValue.length() > 0) + { + sbValue.append('\n'); + } + sbValue.append(sbLine); + sbLine.setLength(0); + } + for (Iterator iter = filesNode.getNodeDataCollection().iterator(); iter.hasNext();) + { + NodeData fileNodeData = (NodeData) iter.next(); + if (!usedFiles.contains(fileNodeData.getName())) + { + fileNodeData.delete(); + } + } + NodeDataUtil.getOrCreateAndSet(parentNode, name, new String(sbValue)); + } + +} Property changes on: trunk/openutils-mgnlcontrols/src/main/java/net/sourceforge/openutils/mgnlcontrols/dialog/DialogGridSaveHandler.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl =================================================================== --- trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2009-10-19 15:29:31 UTC (rev 1494) +++ trunk/openutils-mgnlcontrols/src/main/resources/dialogs/grid.ftl 2009-10-19 15:57:11 UTC (rev 1495) @@ -9,6 +9,9 @@ <script type="text/javascript" src="${request.contextPath}/.resources/controls/js/LinkField.js"></script> <script type="text/javascript" src="${request.contextPath}/.resources/controls/js/CheckColumn.js"></script> <script type="text/javascript" src="${request.contextPath}/.resources/controls/js/PipeComboBox.js"></script> + <script type="text/javascript" src="${request.contextPath}/.resources/controls/js/MediaField.js"></script> + <script type="text/javascript" src="${request.contextPath}/.resources/controls/js/FckEditorField.js"></script> + <script type="text/javascript" src="${request.contextPath}/.resources/controls/js/FileField.js"></script> <script type="text/javascript"> // <![CDATA[ function gridMoveRow(grid, delta) { @@ -127,6 +130,9 @@ sortable: false, [#if (colmap.type?? && colmap.type = 'link')] editor: new Ed(new LinkField({ + [#if (colmap.repository??)]repository: '${colmap.repository}',[/#if] + [#if (colmap.extension??)]extension: '${colmap.extension}',[/#if] + dummy: undefined })) [#elseif (colmap.type?? && colmap.type = 'date')] renderer: function(value) { @@ -143,6 +149,22 @@ lazyRender: true, listClass: 'x-combo-list-small' })) + [#elseif (colmap.type?? && colmap.type = 'media')] + editor: new Ed(new MediaField({ + [#if (colmap.valueType??)]valueType: '${colmap.valueType}'[/#if] + })), + renderer : function(v, p, record){ + return v ? '<img border="0" alt="" src="${request.contextPath}/mediaObject' + v + '/resolutions/thumbnail/data.jpg"/>' : v; + } + [#elseif (colmap.type?? && colmap.type = 'fckedit')] + editor: new Ed(new FckEditorField({ + })) + [#elseif (colmap.type?? && colmap.type = 'file')] + editor: new Ed(new FileField({ + })), + renderer : function(v, p, record){ + return v ? v.replace(/^.*\//, '') : v; + } [#else] editor: new Ed(new fm.TextField({ allowBlank: true Modified: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/grid.css =================================================================== --- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/grid.css 2009-10-19 15:29:31 UTC (rev 1494) +++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/grid.css 2009-10-19 15:57:11 UTC (rev 1495) @@ -1,4 +1,19 @@ .x-form-field-wrap .x-form-link-trigger { background-image: url(img/link-trigger.gif); cursor: pointer; -} \ No newline at end of file +} + +.x-form-field-wrap .x-form-media-trigger { + background-image: url(img/media-trigger.gif); + cursor: pointer; +} + +.x-form-field-wrap .x-form-fckedit-trigger { + background-image: url(img/fckedit-trigger.gif); + cursor: pointer; +} + +.x-form-field-wrap .x-form-fileupload-trigger { + background-image: url(img/fileupload-trigger.gif); + cursor: pointer; +} Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/fckedit-trigger.gif =================================================================== (Binary files differ) Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/fckedit-trigger.gif ___________________________________________________________________ Added: svn:mime-type + image/gif Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/fileupload-trigger.gif =================================================================== (Binary files differ) Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/fileupload-trigger.gif ___________________________________________________________________ Added: svn:mime-type + image/gif Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/media-trigger.gif =================================================================== (Binary files differ) Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/css/img/media-trigger.gif ___________________________________________________________________ Added: svn:mime-type + image/gif Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fckeditor.html =================================================================== --- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fckeditor.html (rev 0) +++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fckeditor.html 2009-10-19 15:57:11 UTC (rev 1495) @@ -0,0 +1,31 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + <head> + <title>FCK Editor</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <script type="text/javascript" src="../../.magnolia/pages/javascript.js"></script> + <script type="text/javascript" src="../../.resources/admin-js/dialogs/dialogs.js"></script> + <link rel="stylesheet" type="text/css" href="../../.resources/admin-css/admin-all.css" /> + + <script type="text/javascript" src="../../.resources/fckeditor/fckeditor.js"></script> + </head> + <body style="padding:0;margin:0"> + <h1 style="background-color:#F0F2E6; color:#396101; font-size:11pt; border-bottom:1px solid #999;margin:0;padding:3px 10px">FCK Editor</h1> + <p style="margin: 10px"> + <script type="text/javascript"> +var sBasePath = '../../.resources/fckeditor/'; +var oFCKeditor = new FCKeditor('FCKeditor1'); +oFCKeditor.BasePath = sBasePath; +oFCKeditor.Height = 300; +oFCKeditor.Value = window.opener.getFckEditorValue(); +oFCKeditor.Create() ; + </script> + </p> + <div class="mgnlDialogTabsetSaveBar"> + <span class="mgnlControlButton" onclick="window.opener.setFckEditorValue(FCKeditorAPI.GetInstance('FCKeditor1').GetXHTML(true)); mgnlShiftPushButtonClick(this); window.opener.focus(); window.close();" onmouseout="mgnlShiftPushButtonOut(this);" + onmousedown="mgnlShiftPushButtonDown(this);"> + OK + </span> + </div> + </body> +</html> \ No newline at end of file Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fckeditor.html ___________________________________________________________________ Added: svn:mime-type + text/html Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fileupload.html =================================================================== --- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fileupload.html (rev 0) +++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fileupload.html 2009-10-19 15:57:11 UTC (rev 1495) @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + <head> + <title>File upload</title> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <script type="text/javascript" src="../../.magnolia/pages/javascript.js"></script> + <script type="text/javascript" src="../../.resources/admin-js/dialogs/dialogs.js"></script> + <script type="text/javascript"> +function OnUploadCompleted(errorNumber, fileUrl, fileName, customMsg) { + switch (errorNumber) { + case 0: + alert("Your file has been successfully uploaded"); + break; + default: + alert("Error on file upload. Error number: " + errorNumber); + return; + } + window.opener.setFileValue(fileUrl); + window.opener.focus(); + window.close(); +} + </script> + <link rel="stylesheet" type="text/css" href="../../.resources/admin-css/admin-all.css" /> + </head> + <body style="padding:0;margin:0"> + <h1 + style="background-color:#F0F2E6; color:#396101; font-size:11pt; border-bottom:1px solid #999;margin:0;padding:3px 10px"> + File upload + </h1> + + <div id="divUpload"> + <form + action="../../.magnolia/fckeditor/upload?repository=website&path=/temp/it/home/quick-answers&nodeCollection=main&node=0&name=text&type=file" + enctype="multipart/form-data" target="UploadWindow" method="post" id="frmUpload"> + <span fcklang="DlgLnkUpload">Carica</span> + <br /> + <input type="file" name="NewFile" size="40" style="width: 100%;" id="txtUploadFile" /> + <br /> + <br /> + <input type="submit" fcklang="DlgLnkBtnUpload" value="Invia al Server" id="btnUpload" /> + <script type="text/javascript"> + // <!-- + document.write('<iframe name="UploadWindow" style="display: none" src="javascript: void(0);"><\/iframe>'); + // --> + </script> + </form> + </div> + </body> +</html> \ No newline at end of file Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/grid-fileupload.html ___________________________________________________________________ Added: svn:mime-type + text/html Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FckEditorField.js =================================================================== --- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FckEditorField.js (rev 0) +++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FckEditorField.js 2009-10-19 15:57:11 UTC (rev 1495) @@ -0,0 +1,14 @@ +var FckEditorField = Ext.extend(Ext.form.TriggerField, { + + triggerClass: 'x-form-fckedit-trigger', + + onTriggerClick : function() { + if (this.disabled) return; + window.getFckEditorValue = this.getValue.createDelegate(this); + window.setFckEditorValue = function(value) { + this.setValue(value); + }.createDelegate(this); + mgnlOpenWindow('/.resources/controls/grid-fckeditor.html', 880, 380); + } + +}); Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FckEditorField.js ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FileField.js =================================================================== --- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FileField.js (rev 0) +++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FileField.js 2009-10-19 15:57:11 UTC (rev 1495) @@ -0,0 +1,13 @@ +var FileField = Ext.extend(Ext.form.TriggerField, { + + triggerClass: 'x-form-fileupload-trigger', + + onTriggerClick : function() { + if (this.disabled) return; + window.setFileValue = function(value) { + this.setValue(value); + }.createDelegate(this); + mgnlOpenWindow('/.resources/controls/grid-fileupload.html', 400, 150); + } + +}); Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/FileField.js ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/LinkField.js =================================================================== --- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/LinkField.js 2009-10-19 15:29:31 UTC (rev 1494) +++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/LinkField.js 2009-10-19 15:57:11 UTC (rev 1495) @@ -2,9 +2,13 @@ triggerClass : 'x-form-link-trigger', + repository: 'website', + + // extension: undefined, + onTriggerClick : function() { if (this.disabled) return; - mgnlDialogLinkOpenBrowser(this.el.id, 'website', 'html'); + mgnlDialogLinkOpenBrowser(this.el.id, this.repository, this.extension); } }); Added: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/MediaField.js =================================================================== --- trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/MediaField.js (rev 0) +++ trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/MediaField.js 2009-10-19 15:57:11 UTC (rev 1495) @@ -0,0 +1,16 @@ +var MediaField = Ext.extend(Ext.form.TriggerField, { + + triggerClass: 'x-form-media-trigger', + + // valueType: undefined, + + onTriggerClick: function(){ + if (this.disabled) return; + + window.setNewMedia = function(nodeid, uuid, file, thumb){ + this.setValue(this.valueType == 'path' ? thumb.replace(/^.*\/mediaObject\/(.*)\/resolutions\/.*$/, '/$1') : uuid); + }.createDelegate(this); + mgnlOpenWindow('/.magnolia/pages/mediaBrowser.html?nodeid=' + name + '&selectMedia=true&mgnlCK=' + mgnlGetCacheKiller(), 800, 500); + } + +}); Property changes on: trunk/openutils-mgnlcontrols/src/main/resources/mgnl-resources/controls/js/MediaField.js ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 1494 http://openutils.svn.sourceforge.net/openutils/?rev=1494&view=rev Author: diego_schivo Date: 2009-10-19 15:29:31 +0000 (Mon, 19 Oct 2009) Log Message: ----------- fix resizing not performed when requested dimension ratio (oDelta) exactly equals the original one (delta); original image returned only when resized and original dimensions are the same Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/BaseImageResolutionProcessor.java Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/BaseImageResolutionProcessor.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/BaseImageResolutionProcessor.java 2009-10-16 09:53:08 UTC (rev 1493) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/BaseImageResolutionProcessor.java 2009-10-19 15:29:31 UTC (rev 1494) @@ -123,26 +123,30 @@ */ public BufferedImage fill(BufferedImage original, int x, int y, boolean cropCentered) { - float oX = original.getWidth(); - float oY = original.getHeight(); + int oWidth = original.getWidth(); + int oHeight = original.getHeight(); + if (x == oWidth && y == oHeight) + { + // same size + return original; + } + + float oX = oWidth; + float oY = oHeight; float oDelta = oX / oY; float delta = ((float) x) / ((float) y); - if (oDelta > delta) + if (oDelta >= delta) { int newX = (int) (y * oX / oY); BufferedImage filled = ImageUtils.resizeImage(original, newX, y); return cropCentered ? ImageUtils.cropImage(filled, (newX - x) / 2, 0, x, y) : filled; } - else if (oDelta < delta) + else // if (oDelta < delta) { int newY = (int) (x * oY / oX); BufferedImage filled = ImageUtils.resizeImage(original, x, newY); return cropCentered ? ImageUtils.cropImage(filled, 0, (newY - y) / 2, x, y) : filled; } - else - { - return original; - } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-16 09:53:19
|
Revision: 1493 http://openutils.svn.sourceforge.net/openutils/?rev=1493&view=rev Author: molaschi Date: 2009-10-16 09:53:08 +0000 (Fri, 16 Oct 2009) Log Message: ----------- [maven-release-plugin] prepare for next development iteration Modified Paths: -------------- trunk/openutils-mgnlmedia/pom.xml Modified: trunk/openutils-mgnlmedia/pom.xml =================================================================== --- trunk/openutils-mgnlmedia/pom.xml 2009-10-16 09:52:37 UTC (rev 1492) +++ trunk/openutils-mgnlmedia/pom.xml 2009-10-16 09:53:08 UTC (rev 1493) @@ -10,7 +10,7 @@ <name>Magnolia SimpleMedia Module</name> <description>Magnolia SimpleMedia Module: a module for Magnolia CMS for easier management of images and videos with several features.</description> - <version>4.0-b10</version> + <version>4.0-b11-SNAPSHOT</version> <inceptionYear>2008</inceptionYear> <licenses> <license> @@ -157,10 +157,4 @@ </exclusions> </dependency> </dependencies> - - <scm> - <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-mgnlmedia-4.0-b10</connection> - <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-mgnlmedia-4.0-b10</developerConnection> - <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-mgnlmedia-4.0-b10</url> - </scm> </project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-16 09:52:46
|
Revision: 1492 http://openutils.svn.sourceforge.net/openutils/?rev=1492&view=rev Author: molaschi Date: 2009-10-16 09:52:37 +0000 (Fri, 16 Oct 2009) Log Message: ----------- [maven-release-plugin] copy for tag openutils-mgnlmedia-4.0-b10 Added Paths: ----------- tags/openutils-mgnlmedia-4.0-b10/ tags/openutils-mgnlmedia-4.0-b10/pom.xml tags/openutils-mgnlmedia-4.0-b10/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java Removed Paths: ------------- tags/openutils-mgnlmedia-4.0-b10/pom.xml tags/openutils-mgnlmedia-4.0-b10/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java Property changes on: tags/openutils-mgnlmedia-4.0-b10 ___________________________________________________________________ Added: svn:ignore + .settings .checkstyle .classpath .project target test-output temp-testng-customsuite.xml Added: svnmerge-integrated + /branches/openutils-mgnlmedia-3.6.x:1-982,1004 Added: svn:mergeinfo + /branches/openutils-mgnlmedia-3.6.x:1004 Deleted: tags/openutils-mgnlmedia-4.0-b10/pom.xml =================================================================== --- trunk/openutils-mgnlmedia/pom.xml 2009-10-16 09:46:56 UTC (rev 1489) +++ tags/openutils-mgnlmedia-4.0-b10/pom.xml 2009-10-16 09:52:37 UTC (rev 1492) @@ -1,160 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-parent</artifactId> - <version>1.1</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <packaging>jar</packaging> - <artifactId>openutils-mgnlmedia</artifactId> - <name>Magnolia SimpleMedia Module</name> - <description>Magnolia SimpleMedia Module: a module for Magnolia CMS for easier management of images and videos with - several features.</description> - <version>4.0-b10-SNAPSHOT</version> - <inceptionYear>2008</inceptionYear> - <licenses> - <license> - <name>GPLv3</name> - <url>http://www.gnu.org/licenses/gpl-3.0.txt</url> - </license> - </licenses> - <url>http://lab.openmindonline.it/lab/products/media.html</url> - <issueManagement> - <system>jira</system> - <url>http://lab.openmindonline.it/jira/browse/MEDIA</url> - </issueManagement> - <build> - <resources> - <resource> - <filtering>false</filtering> - <directory>src/main/resources</directory> - <includes> - <include>**/*</include> - </includes> - </resource> - <resource> - <filtering>true</filtering> - <directory>src/main/resources</directory> - <includes> - <include>META-INF/magnolia/*</include> - </includes> - </resource> - </resources> - <plugins> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <id>bundle</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - </execution> - </executions> - <configuration> - <descriptors> - <descriptor>${basedir}/src/main/assembly/assembly-bundle.xml</descriptor> - </descriptors> - </configuration> - </plugin> - <plugin> - <groupId>com.google.code.maven-license-plugin</groupId> - <artifactId>maven-license-plugin</artifactId> - <version>1.4.0</version> - <configuration> - <header>src/main/etc/header.txt</header> - <includes> - <include>src/**</include> - </includes> - <excludes> - <exclude>target/**</exclude> - <exclude>src/site/**</exclude> - <exclude>src/main/bundle/**</exclude> - <exclude>src/main/resources/**/*.ftl</exclude> - <exclude>src/main/assembly/**</exclude> - <exclude>src/main/resources/mgnl-bootstrap/**</exclude> - <exclude>src/main/resources/mgnl-nodetypes/**</exclude> - <exclude>src/main/resources/mgnl-resources/media/css/multibox.css</exclude> - <exclude>src/main/resources/mgnl-resources/media/js/multibox/**</exclude> - <exclude>src/main/resources/mgnl-resources/media/js/miframe.js</exclude> - <exclude>src/main/resources/mgnl-resources/media/js/moo*.*</exclude> - <exclude>src/main/resources/mgnl-resources/media/js/swfobject.js</exclude> - </excludes> - <properties> - <year>${project.inceptionYear} - 2009</year> - <name>${project.name}</name> - <description>${project.description}</description> - <url>${project.url}</url> - </properties> - </configuration> - <executions> - <execution> - <goals> - <goal>check</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - <reporting> - <plugins> - <plugin> - <groupId>net.sourceforge.maven-taglib</groupId> - <artifactId>maven-taglib-plugin</artifactId> - </plugin> - </plugins> - </reporting> - <dependencies> - <dependency> - <groupId>info.magnolia</groupId> - <artifactId>magnolia-core</artifactId> - <version>4.0.1</version> - </dependency> - <dependency> - <groupId>info.magnolia</groupId> - <artifactId>magnolia-module-admininterface</artifactId> - <version>4.0.1</version> - </dependency> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-mgnltasks</artifactId> - <version>4.0</version> - </dependency> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-mgnlext</artifactId> - <version>2.1</version> - </dependency> - <dependency> - <groupId>net.sourceforge.openutils</groupId> - <artifactId>openutils-elfunctions</artifactId> - <version>1.0</version> - </dependency> - <dependency> - <groupId>com.drewnoakes</groupId> - <artifactId>metadata-extractor</artifactId> - <version>2.4.0-beta-1</version> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>jsp-api</artifactId> - <version>2.0</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <classifier>jdk15</classifier> - <version>5.1</version> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> -</project> \ No newline at end of file Copied: tags/openutils-mgnlmedia-4.0-b10/pom.xml (from rev 1491, trunk/openutils-mgnlmedia/pom.xml) =================================================================== --- tags/openutils-mgnlmedia-4.0-b10/pom.xml (rev 0) +++ tags/openutils-mgnlmedia-4.0-b10/pom.xml 2009-10-16 09:52:37 UTC (rev 1492) @@ -0,0 +1,166 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-parent</artifactId> + <version>1.1</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <packaging>jar</packaging> + <artifactId>openutils-mgnlmedia</artifactId> + <name>Magnolia SimpleMedia Module</name> + <description>Magnolia SimpleMedia Module: a module for Magnolia CMS for easier management of images and videos with + several features.</description> + <version>4.0-b10</version> + <inceptionYear>2008</inceptionYear> + <licenses> + <license> + <name>GPLv3</name> + <url>http://www.gnu.org/licenses/gpl-3.0.txt</url> + </license> + </licenses> + <url>http://lab.openmindonline.it/lab/products/media.html</url> + <issueManagement> + <system>jira</system> + <url>http://lab.openmindonline.it/jira/browse/MEDIA</url> + </issueManagement> + <build> + <resources> + <resource> + <filtering>false</filtering> + <directory>src/main/resources</directory> + <includes> + <include>**/*</include> + </includes> + </resource> + <resource> + <filtering>true</filtering> + <directory>src/main/resources</directory> + <includes> + <include>META-INF/magnolia/*</include> + </includes> + </resource> + </resources> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>bundle</id> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + <configuration> + <descriptors> + <descriptor>${basedir}/src/main/assembly/assembly-bundle.xml</descriptor> + </descriptors> + </configuration> + </plugin> + <plugin> + <groupId>com.google.code.maven-license-plugin</groupId> + <artifactId>maven-license-plugin</artifactId> + <version>1.4.0</version> + <configuration> + <header>src/main/etc/header.txt</header> + <includes> + <include>src/**</include> + </includes> + <excludes> + <exclude>target/**</exclude> + <exclude>src/site/**</exclude> + <exclude>src/main/bundle/**</exclude> + <exclude>src/main/resources/**/*.ftl</exclude> + <exclude>src/main/assembly/**</exclude> + <exclude>src/main/resources/mgnl-bootstrap/**</exclude> + <exclude>src/main/resources/mgnl-nodetypes/**</exclude> + <exclude>src/main/resources/mgnl-resources/media/css/multibox.css</exclude> + <exclude>src/main/resources/mgnl-resources/media/js/multibox/**</exclude> + <exclude>src/main/resources/mgnl-resources/media/js/miframe.js</exclude> + <exclude>src/main/resources/mgnl-resources/media/js/moo*.*</exclude> + <exclude>src/main/resources/mgnl-resources/media/js/swfobject.js</exclude> + </excludes> + <properties> + <year>${project.inceptionYear} - 2009</year> + <name>${project.name}</name> + <description>${project.description}</description> + <url>${project.url}</url> + </properties> + </configuration> + <executions> + <execution> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + <reporting> + <plugins> + <plugin> + <groupId>net.sourceforge.maven-taglib</groupId> + <artifactId>maven-taglib-plugin</artifactId> + </plugin> + </plugins> + </reporting> + <dependencies> + <dependency> + <groupId>info.magnolia</groupId> + <artifactId>magnolia-core</artifactId> + <version>4.0.1</version> + </dependency> + <dependency> + <groupId>info.magnolia</groupId> + <artifactId>magnolia-module-admininterface</artifactId> + <version>4.0.1</version> + </dependency> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-mgnltasks</artifactId> + <version>4.0</version> + </dependency> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-mgnlext</artifactId> + <version>2.1</version> + </dependency> + <dependency> + <groupId>net.sourceforge.openutils</groupId> + <artifactId>openutils-elfunctions</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>com.drewnoakes</groupId> + <artifactId>metadata-extractor</artifactId> + <version>2.4.0-beta-1</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>jsp-api</artifactId> + <version>2.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <classifier>jdk15</classifier> + <version>5.1</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-mgnlmedia-4.0-b10</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-mgnlmedia-4.0-b10</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-mgnlmedia-4.0-b10</url> + </scm> +</project> \ No newline at end of file Deleted: tags/openutils-mgnlmedia-4.0-b10/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java 2009-10-16 09:46:56 UTC (rev 1489) +++ tags/openutils-mgnlmedia-4.0-b10/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java 2009-10-16 09:52:37 UTC (rev 1492) @@ -1,68 +0,0 @@ -package net.sourceforge.openutils.mgnlmedia.media.processors; - -import java.awt.Color; -import java.awt.image.BufferedImage; -import java.util.Map; - -import net.sourceforge.openutils.mgnlmedia.media.utils.ImageUtils; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.math.NumberUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * Generate rounded corners on images.<br/> - * Activated by declaring the parameter <strong>roundcorners</strong>; its value can be: - * <ul> - * <li>no value or true: processor draws roundcorners with 5px radius</li> - * <li>int value: processor draws roundcorners with passed radius</li> - * </ul> - * If the "background" parameter is specified (hex color), it will be applied when rounding corners.<br/> - * If no "background" parameter is found, if the image format is png a transparent background is applied else a white background is applied. - * @author molaschi - * @version $Id: $ - */ -public class RoundedCornersProcessor implements ImagePostProcessor -{ - - /** - * Logger. - */ - private Logger log = LoggerFactory.getLogger(RoundedCornersProcessor.class); - - /** - * {@inheritDoc} - */ - public BufferedImage processImage(BufferedImage image, int x, int y, Map<String, String> parameters) - { - String roundCorners = parameters.get("roundcorners"); - if (StringUtils.isNotBlank(roundCorners)) - { - int radius = 5; - if (!"true".equals(roundCorners)) - { - radius = NumberUtils.toInt(roundCorners); - } - - Color backgroundColor = null; - String hexColor = parameters.get("background"); - if (StringUtils.isNotBlank(hexColor)) - { - try - { - hexColor = "0x" + (hexColor.startsWith("#") ? hexColor.substring(1) : hexColor); - backgroundColor = Color.decode(hexColor); - } - catch (NumberFormatException e) - { - log.error("Invalid color code: " + hexColor, e); - } - } - return ImageUtils.addRoundedCorners(image, backgroundColor, radius); - } - return image; - } - -} Copied: tags/openutils-mgnlmedia-4.0-b10/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java (from rev 1490, trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java) =================================================================== --- tags/openutils-mgnlmedia-4.0-b10/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java (rev 0) +++ tags/openutils-mgnlmedia-4.0-b10/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java 2009-10-16 09:52:37 UTC (rev 1492) @@ -0,0 +1,93 @@ +/** + * + * Magnolia SimpleMedia Module (http://lab.openmindonline.it/lab/products/media.html) + * Magnolia SimpleMedia Module: a module for Magnolia CMS for easier management of images and videos with + * several features. + * Copyright (C)2008 - 2009, Openmind S.r.l. http://www.openmindonline.it + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * You may obtain a copy of the License at + * + * http://www.gnu.org/licenses/lgpl-2.1.html + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +package net.sourceforge.openutils.mgnlmedia.media.processors; + +import java.awt.Color; +import java.awt.image.BufferedImage; +import java.util.Map; + +import net.sourceforge.openutils.mgnlmedia.media.utils.ImageUtils; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * Generate rounded corners on images.<br/> + * Activated by declaring the parameter <strong>roundcorners</strong>; its value can be: + * <ul> + * <li>no value or true: processor draws roundcorners with 5px radius</li> + * <li>int value: processor draws roundcorners with passed radius</li> + * </ul> + * If the "background" parameter is specified (hex color), it will be applied when rounding corners.<br/> + * If no "background" parameter is found, if the image format is png a transparent background is applied else a white background is applied. + * @author molaschi + * @version $Id: $ + */ +public class RoundedCornersProcessor implements ImagePostProcessor +{ + + /** + * Logger. + */ + private Logger log = LoggerFactory.getLogger(RoundedCornersProcessor.class); + + /** + * {@inheritDoc} + */ + public BufferedImage processImage(BufferedImage image, int x, int y, Map<String, String> parameters) + { + String roundCorners = parameters.get("roundcorners"); + if (StringUtils.isNotBlank(roundCorners)) + { + int radius = 5; + if (!"true".equals(roundCorners)) + { + radius = NumberUtils.toInt(roundCorners); + } + + Color backgroundColor = null; + String hexColor = parameters.get("background"); + if (StringUtils.isNotBlank(hexColor)) + { + try + { + hexColor = "0x" + (hexColor.startsWith("#") ? hexColor.substring(1) : hexColor); + backgroundColor = Color.decode(hexColor); + } + catch (NumberFormatException e) + { + log.error("Invalid color code: " + hexColor, e); + } + } + return ImageUtils.addRoundedCorners(image, backgroundColor, radius); + } + return image; + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-16 09:51:42
|
Revision: 1491 http://openutils.svn.sourceforge.net/openutils/?rev=1491&view=rev Author: molaschi Date: 2009-10-16 09:51:35 +0000 (Fri, 16 Oct 2009) Log Message: ----------- [maven-release-plugin] prepare release openutils-mgnlmedia-4.0-b10 Modified Paths: -------------- trunk/openutils-mgnlmedia/pom.xml Modified: trunk/openutils-mgnlmedia/pom.xml =================================================================== --- trunk/openutils-mgnlmedia/pom.xml 2009-10-16 09:50:20 UTC (rev 1490) +++ trunk/openutils-mgnlmedia/pom.xml 2009-10-16 09:51:35 UTC (rev 1491) @@ -10,7 +10,7 @@ <name>Magnolia SimpleMedia Module</name> <description>Magnolia SimpleMedia Module: a module for Magnolia CMS for easier management of images and videos with several features.</description> - <version>4.0-b10-SNAPSHOT</version> + <version>4.0-b10</version> <inceptionYear>2008</inceptionYear> <licenses> <license> @@ -157,4 +157,10 @@ </exclusions> </dependency> </dependencies> + + <scm> + <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-mgnlmedia-4.0-b10</connection> + <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-mgnlmedia-4.0-b10</developerConnection> + <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-mgnlmedia-4.0-b10</url> + </scm> </project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-16 09:50:28
|
Revision: 1490 http://openutils.svn.sourceforge.net/openutils/?rev=1490&view=rev Author: molaschi Date: 2009-10-16 09:50:20 +0000 (Fri, 16 Oct 2009) Log Message: ----------- fix license header Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java 2009-10-16 09:46:56 UTC (rev 1489) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java 2009-10-16 09:50:20 UTC (rev 1490) @@ -1,3 +1,28 @@ +/** + * + * Magnolia SimpleMedia Module (http://lab.openmindonline.it/lab/products/media.html) + * Magnolia SimpleMedia Module: a module for Magnolia CMS for easier management of images and videos with + * several features. + * Copyright (C)2008 - 2009, Openmind S.r.l. http://www.openmindonline.it + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * You may obtain a copy of the License at + * + * http://www.gnu.org/licenses/lgpl-2.1.html + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ package net.sourceforge.openutils.mgnlmedia.media.processors; import java.awt.Color; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-16 09:47:07
|
Revision: 1489 http://openutils.svn.sourceforge.net/openutils/?rev=1489&view=rev Author: molaschi Date: 2009-10-16 09:46:56 +0000 (Fri, 16 Oct 2009) Log Message: ----------- fix broken javadocs, clean some code and update tld docs Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/commands/MediaActivationCommand.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/dialog/DialogSelectMedia.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/lifecycle/MediaModule.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaSearchPage.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/ImagePostProcessor.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/ImageResolutionProcessor.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/RemoveResolutionsNodeTask.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/RenameThumbToImageTask.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/types/MediaTypeHandler.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/BaseTypeHandler.java trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/ImageTypeHandler.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/JpegUtils.java trunk/openutils-mgnlmedia/src/main/resources/META-INF/media.tld trunk/openutils-mgnlmedia/src/test/java/net/sourceforge/openutils/mgnlmedia/media/utils/FileNodeData.java trunk/openutils-mgnlmedia/src/test/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtilsTest.java Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/commands/MediaActivationCommand.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/commands/MediaActivationCommand.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/commands/MediaActivationCommand.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -116,6 +116,13 @@ } } + /** + * Activate recursive one level + * @param parentPath parent node + * @param node node to activate + * @throws RepositoryException exception + * @throws ExchangeException exception exchanging node + */ @SuppressWarnings("unchecked") public void activateRecursiveOneLevel(String parentPath, Content node) throws RepositoryException, ExchangeException Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/dialog/DialogSelectMedia.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/dialog/DialogSelectMedia.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/dialog/DialogSelectMedia.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -222,9 +222,6 @@ return MessagesUtil.chain("net.sourceforge.openutils.mgnlmedia.media.lang.messages", super.getMessages()); } - /** - * {@inheritDoc} - */ protected String getPath() { return "dialog/selectMedia.ftl"; Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/lifecycle/MediaModule.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/lifecycle/MediaModule.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/lifecycle/MediaModule.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -52,11 +52,18 @@ private static MediaModule instance; + /** + * Constructor + */ public MediaModule() { instance = this; } + /** + * Get instance + * @return media module instance + */ public static MediaModule getInstance() { return instance; Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaSearchPage.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaSearchPage.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaSearchPage.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -159,11 +159,6 @@ return super.show(); } - public String search() - { - return null; - } - /** * Returns the mtc. * @return the mtc Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/ImagePostProcessor.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/ImagePostProcessor.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/ImagePostProcessor.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -38,5 +38,13 @@ public interface ImagePostProcessor { + /** + * Process image + * @param image image to process + * @param x width + * @param y height + * @param parameters parameters map + * @return processed image + */ BufferedImage processImage(BufferedImage image, int x, int y, Map<String, String> parameters); } Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/ImageResolutionProcessor.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/ImageResolutionProcessor.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/ImageResolutionProcessor.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -40,6 +40,14 @@ public interface ImageResolutionProcessor { + /** + * Process image + * @param original original image + * @param x required width + * @param y required height + * @param parameters parameters + * @return resized image + */ BufferedImage getImageForResolution(BufferedImage original, int x, int y, Map<String, String> parameters); } Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/processors/RoundedCornersProcessor.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -13,6 +13,14 @@ /** + * Generate rounded corners on images.<br/> + * Activated by declaring the parameter <strong>roundcorners</strong>; its value can be: + * <ul> + * <li>no value or true: processor draws roundcorners with 5px radius</li> + * <li>int value: processor draws roundcorners with passed radius</li> + * </ul> + * If the "background" parameter is specified (hex color), it will be applied when rounding corners.<br/> + * If no "background" parameter is found, if the image format is png a transparent background is applied else a white background is applied. * @author molaschi * @version $Id: $ */ Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/RemoveResolutionsNodeTask.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/RemoveResolutionsNodeTask.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/RemoveResolutionsNodeTask.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -50,8 +50,7 @@ { /** - * @param taskName - * @param taskDescription + * Constructor */ public RemoveResolutionsNodeTask() { @@ -61,6 +60,7 @@ /** * {@inheritDoc} */ + @SuppressWarnings("unchecked") public void execute(InstallContext installContext) throws TaskExecutionException { HierarchyManager hm = installContext.getHierarchyManager(MediaModule.REPO); Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/RenameThumbToImageTask.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/RenameThumbToImageTask.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/setup/RenameThumbToImageTask.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -53,8 +53,7 @@ { /** - * @param taskName - * @param taskDescription + * Constructor */ public RenameThumbToImageTask() { @@ -64,6 +63,7 @@ /** * {@inheritDoc} */ + @SuppressWarnings("unchecked") public void execute(InstallContext installContext) throws TaskExecutionException { HierarchyManager hm = installContext.getHierarchyManager(MediaModule.REPO); 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-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -42,7 +42,6 @@ import javax.jcr.RepositoryException; import javax.jcr.query.InvalidQueryException; -import javax.servlet.jsp.JspTagException; import net.sourceforge.openutils.mgnlmedia.media.configuration.MediaConfigurationManager; import net.sourceforge.openutils.mgnlmedia.media.configuration.MediaTypeConfiguration; @@ -77,7 +76,7 @@ /** * Get content node for media - * @param uuid media uuid + * @param obj content node or node UUID * @return content node */ public static Content getNode(Object obj) Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/MediaTypeHandler.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/MediaTypeHandler.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/MediaTypeHandler.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -67,7 +67,8 @@ /** * @param media * @param options - * @return + * @param aaaa + * @return url */ String getUrl(Content media, Map<String, String> options); @@ -175,6 +176,8 @@ * @param f file input stream * @param cleanFileName file name without extension * @param extension file extension + * @exception RepositoryException exception working on repository + * @exception AccessDeniedException exception accessing node */ void saveFromZipFile(Content media, File f, String cleanFileName, String extension) throws AccessDeniedException, RepositoryException; Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/BaseTypeHandler.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/BaseTypeHandler.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/BaseTypeHandler.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -60,6 +60,9 @@ public abstract class BaseTypeHandler implements MediaTypeHandler { + /** + * Nodedata name where original media content is saved + */ public static final String ORGINAL_NODEDATA_NAME = "original"; /** @@ -82,7 +85,7 @@ */ public String getNewNodeName(MultipartForm form, HttpServletRequest request) { - return form.getParameter(ORGINAL_NODEDATA_NAME + "_" + FileProperties.PROPERTY_FILENAME); + return request.getParameter(ORGINAL_NODEDATA_NAME + "_" + FileProperties.PROPERTY_FILENAME); } /** Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/ImageTypeHandler.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/ImageTypeHandler.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/types/impl/ImageTypeHandler.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -30,8 +30,6 @@ import net.sourceforge.openutils.mgnlmedia.media.utils.ImageUtils; import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** @@ -43,11 +41,6 @@ { /** - * Logger. - */ - private final Logger log = LoggerFactory.getLogger(ImageTypeHandler.class); - - /** * {@inheritDoc} */ public String getThumbnailUrl(Content media) 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-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -92,6 +92,9 @@ private static SimpleDateFormat sdf; + /** + * Nodedata name where resolution is saved + */ public static String RESOLUTION_PROPERTY = "resolution"; private static final String[] extensions = new String[]{"jpg", "gif", "png" }; @@ -157,6 +160,7 @@ * @param y new height * @param canvasX canvas width * @param canvasY canvas height + * @param background background color * @return resized image */ public static BufferedImage resizeImage(BufferedImage original, int x, int y, int canvasX, int canvasY, @@ -248,49 +252,13 @@ return resizedImage; } - private static int[] convertHexToRGB(String hexColor) - { - String hex = hexColor.trim(); - if (hex.startsWith("#")) - { - hex = hex.substring(1); - } - if (hex.equals("transparent")) - { - return new int[]{0, 0, 0, 0 }; - } - if (hex.length() == 3) - { - // allow three digit codes like for css - hex = String.valueOf(hex.charAt(0)) - + String.valueOf(hex.charAt(0)) - + String.valueOf(hex.charAt(1)) - + String.valueOf(hex.charAt(1)) - + String.valueOf(hex.charAt(2)) - + String.valueOf(hex.charAt(2)); - } - - int[] rgb = new int[4]; - try - { - // Convert rrggbb string to hex ints - rgb[0] = Integer.parseInt(hex.substring(0, 2), 16); - rgb[1] = Integer.parseInt(hex.substring(2, 4), 16); - rgb[2] = Integer.parseInt(hex.substring(4), 16); - rgb[3] = 255; - } - catch (NumberFormatException e) - { - log.error("NumberFormatException occured during text-to-image conversion: " - + "Attempting to convert Hex [" - + hex - + "] color to RGB color: " - + e.getMessage(), e); - rgb = new int[]{255, 0, 0, 255 }; // red - } - return rgb; - } - + /** + * Create rounded corners on image + * @param original original image + * @param backgroundColor optional background color + * @param radius corners radius + * @return image with rounded corners + */ public static BufferedImage addRoundedCorners(BufferedImage original, Color backgroundColor, int radius) { int originalImageType = getType(original.getColorModel()); @@ -450,6 +418,8 @@ * Get an inputstream for an image and the target file extension * @param image image to get the inputstream from * @param extension target file extension + * @param quality image quality + * @param forceProgressive true if image has to be saved as progressive mode * @return inputstream * @throws IOException */ @@ -462,7 +432,7 @@ try { - Iterator writers; + Iterator<ImageWriter> writers; ImageOutputStream imageOutputStream; ImageWriteParam params; ImageWriter imageWriter; @@ -472,7 +442,7 @@ if (writers != null && writers.hasNext()) { // Fetch the first writer in the list - imageWriter = (ImageWriter) writers.next(); + imageWriter = writers.next(); // Specify the parameters according to those the output file will be written @@ -752,6 +722,7 @@ * Get image for a resolution * @param original original image * @param resolution resolution + * @param params parameters * @return new image */ public static BufferedImage getImageForResolution(BufferedImage original, String resolution, Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/JpegUtils.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/JpegUtils.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/JpegUtils.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -70,6 +70,9 @@ * raster data to RGB. Technique due to MArk Stephens. Free for any use. See * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4799903 or * http://www.mail-archive.com/jav...@ca.../msg03247.html + * @param raster raster image + * @param ycckProfile true for YCCK color profile (else CMYK) + * @return image */ public static BufferedImage createJPEG4(Raster raster, boolean ycckProfile) { @@ -144,7 +147,9 @@ } /** + * process image * @param image + * @return image */ public static BufferedImage processNonStandardImage(NodeData image) { @@ -153,13 +158,13 @@ { // Get an ImageReader. ImageInputStream input = ImageIO.createImageInputStream(is2); - Iterator readers = ImageIO.getImageReaders(input); + Iterator<ImageReader> readers = ImageIO.getImageReaders(input); if (readers == null || !readers.hasNext()) { throw new RuntimeException("No ImageReaders found"); } - ImageReader reader = (ImageReader) readers.next(); + ImageReader reader = readers.next(); reader.setInput(input); String format = reader.getFormatName(); Modified: trunk/openutils-mgnlmedia/src/main/resources/META-INF/media.tld =================================================================== --- trunk/openutils-mgnlmedia/src/main/resources/META-INF/media.tld 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/main/resources/META-INF/media.tld 2009-10-16 09:46:56 UTC (rev 1489) @@ -180,6 +180,28 @@ set player skin </td> </tr> + <tr> + <td> + useEm + </td> + <td> + false + </td> + <td> + if true, and ignoreDimensions is not true it will apply style attribute on img tags with sidth and height in "em". the em values will be computed using as width in pixel * emRatio (see next attribute) + </td> + </tr> + <tr> + <td> + emRatio + </td> + <td> + false + </td> + <td> + float value to convert dimensions from px to em + </td> + </tr> </table> For videos or mp3s it needs the following scripts loaded in page: Modified: trunk/openutils-mgnlmedia/src/test/java/net/sourceforge/openutils/mgnlmedia/media/utils/FileNodeData.java =================================================================== --- trunk/openutils-mgnlmedia/src/test/java/net/sourceforge/openutils/mgnlmedia/media/utils/FileNodeData.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/test/java/net/sourceforge/openutils/mgnlmedia/media/utils/FileNodeData.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -54,6 +54,10 @@ private byte[] content; + /** + * @param classpathLocation + * @throws IOException + */ public FileNodeData(String classpathLocation) throws IOException { InputStream is = getClass().getResourceAsStream(classpathLocation); @@ -92,6 +96,7 @@ /** * {@inheritDoc} */ + @SuppressWarnings("unchecked") public Collection getAttributeNames() throws RepositoryException { // TODO Auto-generated method stub Modified: trunk/openutils-mgnlmedia/src/test/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtilsTest.java =================================================================== --- trunk/openutils-mgnlmedia/src/test/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtilsTest.java 2009-10-14 15:07:43 UTC (rev 1488) +++ trunk/openutils-mgnlmedia/src/test/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtilsTest.java 2009-10-16 09:46:56 UTC (rev 1489) @@ -52,6 +52,9 @@ public class ImageUtilsTest { + /** + * + */ @BeforeMethod public void setup() { @@ -65,6 +68,9 @@ }); } + /** + * @throws Exception + */ @Test public void testYcck() throws Exception { @@ -88,6 +94,9 @@ } + /** + * @throws Exception + */ @Test public void testBorders() throws Exception { @@ -113,6 +122,9 @@ } + /** + * @throws Exception + */ @Test public void testBadImageTxt() throws Exception { @@ -122,6 +134,9 @@ Assert.assertNull(bufferedImage); } + /** + * @throws Exception + */ @Test public void testBadImageJpg() throws Exception { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-14 15:07:50
|
Revision: 1488 http://openutils.svn.sourceforge.net/openutils/?rev=1488&view=rev Author: molaschi Date: 2009-10-14 15:07:43 +0000 (Wed, 14 Oct 2009) Log Message: ----------- fix issue on png compression. maybe we have to use jai? Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java 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-10-14 14:25:35 UTC (rev 1487) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java 2009-10-14 15:07:43 UTC (rev 1488) @@ -479,20 +479,26 @@ // Get Default parameters params = imageWriter.getDefaultWriteParam(); - // Define compression mode - params.setCompressionMode(javax.imageio.ImageWriteParam.MODE_EXPLICIT); + try + { + // Define compression mode + params.setCompressionMode(javax.imageio.ImageWriteParam.MODE_EXPLICIT); + // Define compression quality + params.setCompressionQuality(quality); - // Define compression quality - params.setCompressionQuality(quality); - - // Define progressive mode - if (forceProgressive) - { - params.setProgressiveMode(javax.imageio.ImageWriteParam.MODE_DEFAULT); + // Define progressive mode + if (forceProgressive) + { + params.setProgressiveMode(javax.imageio.ImageWriteParam.MODE_DEFAULT); + } + else + { + params.setProgressiveMode(javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA); + } } - else + catch (UnsupportedOperationException e) { - params.setProgressiveMode(javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA); + // go on } // Deine destination type - used the ColorModel and SampleModel of the Input Image This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-14 14:25:43
|
Revision: 1487 http://openutils.svn.sourceforge.net/openutils/?rev=1487&view=rev Author: molaschi Date: 2009-10-14 14:25:35 +0000 (Wed, 14 Oct 2009) Log Message: ----------- update changes.xml Modified Paths: -------------- trunk/openutils-mgnlmedia/src/site/changes/changes.xml Modified: trunk/openutils-mgnlmedia/src/site/changes/changes.xml =================================================================== --- trunk/openutils-mgnlmedia/src/site/changes/changes.xml 2009-10-14 14:19:37 UTC (rev 1486) +++ trunk/openutils-mgnlmedia/src/site/changes/changes.xml 2009-10-14 14:25:35 UTC (rev 1487) @@ -8,27 +8,39 @@ <author email="fgiust(at)users.sourceforge.net">Fabrizio Giustina</author> </properties> <body> - <release version="4.0-b9" date="in svn" description=""> - <action type="fix" dev="molaschi">fix some media.tag issues + <release version="4.0-b10" date="in svn" description=""> + <action type="fix" dev="molaschi">[MEDIA-17] - Remove link titles "modifica" and "pubblica" in folder view</action> + <action type="fix" dev="molaschi">[MEDIA-18] - When a media is not activated don't show activate button (already + present) but "Not activated" text</action> + <action type="fix" dev="molaschi">[MEDIA-19] - media.tld is not correct</action> + <action type="fix" dev="molaschi">[MEDIA-21] - ImageUtils throws Exceptions when trying to get scaled image</action> + <action type="fix" dev="molaschi">[MEDIA-22] - IllegalArgumentException with resize="nocrop" and resize="fitbands" </action> - <action type="update" dev="molaschi">insert some defaults for video and audio player dimensions on media.tag - </action> + <action type="fix" dev="molaschi">[MEDIA-23] - media.tag uses wrong height value for resized image</action> + <action type="fix" dev="molaschi">[MEDIA-25] - Resizing of PNG replaces transparent background with white</action> + <action type="fix" dev="molaschi">[MEDIA-28] - When changing the selected media the media browser doesn't open on + folder of selected media</action> + <action type="update" dev="molaschi">[MEDIA-24] - selectMedia references not working after an activate</action> + <action type="add" dev="molaschi">[MEDIA-26] - Round Corners image post processor</action> + <action type="add" dev="molaschi">[MEDIA-27] - control image quality and progressive mode</action> + <action type="add" dev="molaschi">[MEDIA-29] - media tag: make images use the style attribute for size, and add + attributes to write dimensions in em insteadof px</action> </release> + <release version="4.0-b9" date="in svn" description=""> + <action type="fix" dev="molaschi">fix some media.tag issues</action> + <action type="update" dev="molaschi">insert some defaults for video and audio player dimensions on media.tag</action> + </release> <release version="4.0-b8" date="in svn" description=""> - <action type="fix" dev="molaschi">fix i18n in selectMedia control - </action> + <action type="fix" dev="molaschi">fix i18n in selectMedia control</action> </release> <release version="4.0-b7" date="in svn" description=""> - <action type="fix" dev="molaschi">fix error in freemarker comment syntax selectMedia.ftl - </action> - <action type="add" dev="molaschi">add grayscale image post processor - </action> + <action type="fix" dev="molaschi">fix error in freemarker comment syntax selectMedia.ftl</action> + <action type="add" dev="molaschi">add grayscale image post processor</action> </release> <release version="4.0-b6" date="in svn" description=""> <action type="fix" dev="fgiust">Avoid image processing when the requested size is identical to the original image </action> - <action type="add" dev="molaschi">Add configurable image post processors - </action> + <action type="add" dev="molaschi">Add configurable image post processors</action> <action type="update" dev="molaschi">Make image resolution processors configurable under modules/media/processors </action> </release> @@ -66,4 +78,4 @@ <action type="add" dev="fgiust">first alpha release</action> </release> </body> -</document> +</document> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-14 14:19:43
|
Revision: 1486 http://openutils.svn.sourceforge.net/openutils/?rev=1486&view=rev Author: molaschi Date: 2009-10-14 14:19:37 +0000 (Wed, 14 Oct 2009) Log Message: ----------- MEDIA-26 fix to make round corners antialiased Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java 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-10-14 14:18:03 UTC (rev 1485) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java 2009-10-14 14:19:37 UTC (rev 1486) @@ -32,13 +32,13 @@ import info.magnolia.cms.util.ExclusiveWrite; import info.magnolia.context.MgnlContext; +import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Point; import java.awt.RenderingHints; import java.awt.Transparency; -import java.awt.geom.RoundRectangle2D; import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.io.BufferedOutputStream; @@ -293,36 +293,70 @@ public static BufferedImage addRoundedCorners(BufferedImage original, Color backgroundColor, int radius) { - BufferedImage resizedImage; + int originalImageType = getType(original.getColorModel()); + int roundedCornersImageType = BufferedImage.TYPE_4BYTE_ABGR; + + if (originalImageType != BufferedImage.TYPE_4BYTE_ABGR) + { + if (originalImageType != BufferedImage.TYPE_4BYTE_ABGR_PRE) + { + // the image has not alpha channel so fill background + if (backgroundColor == null) + { + backgroundColor = Color.WHITE; + } + } + else + { + roundedCornersImageType = BufferedImage.TYPE_4BYTE_ABGR_PRE; + } + } + + // use a 4 byte image type to create antialiased rounded corners + BufferedImage roundedImage; try { - resizedImage = new BufferedImage(original.getWidth(), original.getHeight(), getType(original - .getColorModel())); + roundedImage = new BufferedImage(original.getWidth(), original.getHeight(), roundedCornersImageType); } catch (NegativeArraySizeException e) { - throw new RuntimeException("NegativeArraySizeException caught when resizing image]"); + throw new RuntimeException("NegativeArraySizeException caught when adding rounded corners"); } - Graphics2D graphics2D = resizedImage.createGraphics(); - graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - graphics2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); + Graphics2D roundedGraphics2D = roundedImage.createGraphics(); + roundedGraphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + roundedGraphics2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); - if (original.getColorModel().getTransparency() == Transparency.OPAQUE && backgroundColor == null) - { - backgroundColor = Color.WHITE; - } + roundedGraphics2D.setColor(Color.WHITE); + roundedGraphics2D.fillRoundRect(0, 0, original.getWidth(), original.getHeight(), radius, radius); + roundedGraphics2D.setComposite(AlphaComposite.SrcIn); + roundedGraphics2D.drawImage(original, 0, 0, original.getWidth(), original.getHeight(), null); + if (backgroundColor != null) { - graphics2D.setBackground(backgroundColor); + + BufferedImage destImage; + try + { + destImage = new BufferedImage(original.getWidth(), original.getHeight(), originalImageType); + } + catch (NegativeArraySizeException e) + { + throw new RuntimeException("NegativeArraySizeException caught when resizing image]"); + } + // draw new image + Graphics2D destImageGraphics2D = destImage.createGraphics(); + destImageGraphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + destImageGraphics2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); + + destImageGraphics2D.setBackground(backgroundColor); + destImageGraphics2D.clearRect(0, 0, original.getWidth(), original.getHeight()); + // destImageGraphics2D.setComposite(AlphaComposite.DstIn); + destImageGraphics2D.drawImage(roundedImage, 0, 0, original.getWidth(), original.getHeight(), null); + return destImage; } - graphics2D.clearRect(0, 0, original.getWidth(), original.getHeight()); - graphics2D - .setClip(new RoundRectangle2D.Double(0, 0, original.getWidth(), original.getHeight(), radius, radius)); - graphics2D.drawImage(original, 0, 0, original.getWidth(), original.getHeight(), null); - - return resizedImage; + return roundedImage; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-14 14:18:10
|
Revision: 1485 http://openutils.svn.sourceforge.net/openutils/?rev=1485&view=rev Author: molaschi Date: 2009-10-14 14:18:03 +0000 (Wed, 14 Oct 2009) Log Message: ----------- fix tests Modified Paths: -------------- trunk/openutils-mgnlmedia/src/test/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtilsTest.java Modified: trunk/openutils-mgnlmedia/src/test/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtilsTest.java =================================================================== --- trunk/openutils-mgnlmedia/src/test/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtilsTest.java 2009-10-14 14:17:32 UTC (rev 1484) +++ trunk/openutils-mgnlmedia/src/test/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtilsTest.java 2009-10-14 14:18:03 UTC (rev 1485) @@ -34,6 +34,8 @@ import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; +import java.util.HashMap; +import java.util.Map; import net.sourceforge.openutils.mgnlmedia.media.configuration.ImageProcessorsManager; @@ -73,7 +75,7 @@ bufferedImage = ImageUtils.resizeImage(bufferedImage, 100, 100); - InputStream is = ImageUtils.getStream(bufferedImage, "jpg"); + InputStream is = ImageUtils.getStream(bufferedImage, "jpg", 1.0F, false); File tempFile = File.createTempFile("image", "jpg"); OutputStream os = new BufferedOutputStream(new FileOutputStream(tempFile)); @@ -94,9 +96,11 @@ BufferedImage bufferedImage = ImageUtils.createBufferedImage(cmyk); Assert.assertNotNull(bufferedImage); - bufferedImage = ImageUtils.getImageForResolution(bufferedImage, "O300x300;background=FF0096"); + Map<String, String> parameters = new HashMap<String, String>(); + parameters.put("background", "FF0096"); + bufferedImage = ImageUtils.getImageForResolution(bufferedImage, "O300x300;background=FF0096", parameters); - InputStream is = ImageUtils.getStream(bufferedImage, "png"); + InputStream is = ImageUtils.getStream(bufferedImage, "png", 1.0F, false); File tempFile = File.createTempFile("image", ".png"); OutputStream os = new BufferedOutputStream(new FileOutputStream(tempFile)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-14 14:17:40
|
Revision: 1484 http://openutils.svn.sourceforge.net/openutils/?rev=1484&view=rev Author: molaschi Date: 2009-10-14 14:17:32 +0000 (Wed, 14 Oct 2009) Log Message: ----------- MEDIA-29 make images use the style attribute for size, and add attributes to write dimensions in em insteadof px Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/resources/META-INF/tags/media.tag Modified: trunk/openutils-mgnlmedia/src/main/resources/META-INF/tags/media.tag =================================================================== --- trunk/openutils-mgnlmedia/src/main/resources/META-INF/tags/media.tag 2009-10-14 14:13:48 UTC (rev 1483) +++ trunk/openutils-mgnlmedia/src/main/resources/META-INF/tags/media.tag 2009-10-14 14:17:32 UTC (rev 1484) @@ -1,10 +1,13 @@ <jsp:root version="2.0" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" - xmlns:cms="cms-taglib" xmlns:cmsu="cms-util-taglib" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns:fn="http://java.sun.com/jsp/jstl/functions" - xmlns:media="http://net.sourceforge.openutils/mgnlMedia" xmlns:su="http://openutils.sf.net/openutils-stringutils"> + xmlns:cms="cms-taglib" xmlns:cmsfn="http://www.magnolia.info/tlds/cmsfn-taglib.tld" xmlns:cmsu="cms-util-taglib" + xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:media="http://net.sourceforge.openutils/mgnlMedia" + xmlns:su="http://openutils.sf.net/openutils-stringutils"> <jsp:directive.attribute name="id" required="false" rtexprvalue="true" /> <jsp:directive.attribute name="item" required="true" rtexprvalue="true" type="java.lang.Object" /> <jsp:directive.attribute name="width" required="false" rtexprvalue="true" type="java.lang.Integer" /> <jsp:directive.attribute name="height" required="false" rtexprvalue="true" type="java.lang.Integer" /> + <jsp:directive.attribute name="useEm" required="false" rtexprvalue="true" type="java.lang.Boolean" /> + <jsp:directive.attribute name="emRatio" required="false" rtexprvalue="true" type="java.lang.Float" /> <jsp:directive.attribute name="alt" required="false" rtexprvalue="true" /> <jsp:directive.attribute name="cssClass" required="false" rtexprvalue="true" /> <jsp:directive.attribute name="style" required="false" rtexprvalue="true" /> @@ -15,7 +18,6 @@ <jsp:directive.attribute name="loop" required="false" rtexprvalue="true" type="java.lang.Boolean" /> <jsp:directive.attribute name="noPlayIcon" required="false" rtexprvalue="true" type="java.lang.Boolean" /> <jsp:directive.attribute name="skin" required="false" rtexprvalue="true" /> - <c:set value="${media:node(item)}" var="mediaNode" /> <c:set value="${10000}" var="bigValue" /> <c:if test="${empty width }"> <c:set var="width" value="${0 }" /> @@ -23,6 +25,10 @@ <c:if test="${empty height }"> <c:set var="height" value="${0 }" /> </c:if> + <c:if test="${empty emRatio }"> + <c:set var="emRatio" value="${1.0 }" /> + </c:if> + <c:set value="${media:node(item)}" var="mediaNode" /> <c:choose> <c:when test="${!empty mediaNode}"> <cms:setNode var="media" content="${mediaNode}" /> @@ -54,9 +60,9 @@ <c:set var="controlChar" value="l" /> <c:set var="height" value="${bigValue}" /> </c:if> - <c:set var="resolution">${controlChar}${width}x${height}${empty parameters ? '': ';' + parameters}</c:set> + <c:set var="resolution">${controlChar}${width}x${height}${empty parameters ? '': ';'}${parameters}</c:set> <c:set var="url" value="${media:urlres(mediaNode, resolution)}" /> - <c:set var="size" value="${media:size(mediaNode, resolution)}" /> + <c:set var="size" value="${media:size(mediaNode, resolution)}" /> </c:otherwise> </c:choose> <c:if test="${!empty(url)}"> @@ -69,10 +75,12 @@ </c:if> <c:if test="${not ignoreDim}"> <c:if test="${ size[0] gt 0}"> - <![CDATA[ width="${size[0]}"]]> + <c:set var="style">${style}${(!empty style)?';':''}width:${size[0]*emRatio}${(not useEm ? 'px':'em')} + </c:set> </c:if> - <c:if test="${ size[1] gt 0}"> - <![CDATA[ height="${size[1]}"]]> + <c:if test="${ size[1] gt 1}"> + <c:set var="style">${style}${(!empty style)?';':''}height:${size[1]*emRatio}${(not useEm ? 'px':'em')} + </c:set> </c:if> </c:if> <c:if test="${not empty cssClass}"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-14 14:14:07
|
Revision: 1483 http://openutils.svn.sourceforge.net/openutils/?rev=1483&view=rev Author: molaschi Date: 2009-10-14 14:13:48 +0000 (Wed, 14 Oct 2009) Log Message: ----------- MEDIA-24 log exception but doesn't throw it up 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 2009-10-14 13:58:46 UTC (rev 1482) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/tags/el/MediaEl.java 2009-10-14 14:13:48 UTC (rev 1483) @@ -80,7 +80,7 @@ * @param uuid media uuid * @return content node */ - public static Content getNode(Object obj) throws JspTagException + public static Content getNode(Object obj) { if (obj == null) { @@ -96,8 +96,7 @@ } catch (RepositoryException e) { - log.error("Exception getting node {}", uuid, e); - throw new JspTagException(e); + log.error("Exception getting node with UUID \"{}\"", uuid, e); } } else if (obj instanceof Content) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-14 13:58:59
|
Revision: 1482 http://openutils.svn.sourceforge.net/openutils/?rev=1482&view=rev Author: molaschi Date: 2009-10-14 13:58:46 +0000 (Wed, 14 Oct 2009) Log Message: ----------- MEDIA-28 fix Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java Modified: trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java =================================================================== --- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java 2009-10-09 19:31:24 UTC (rev 1481) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/pages/MediaBrowserPage.java 2009-10-14 13:58:46 UTC (rev 1482) @@ -94,7 +94,15 @@ { super(name, request, response); cacheKiller = String.valueOf(new Date().getTime()); + } + /** + * {@inheritDoc} + */ + @Override + public void init() + { + super.init(); if (actMedia != null) { HierarchyManager mgr = MgnlContext.getHierarchyManager(MediaModule.REPO); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 1481 http://openutils.svn.sourceforge.net/openutils/?rev=1481&view=rev Author: fgrilli Date: 2009-10-09 19:31:24 +0000 (Fri, 09 Oct 2009) Log Message: ----------- removed vacuous comparison of integer value (thus spoke Findbugs) Modified Paths: -------------- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/xpath/impl/MagnoliaCriteriaWithLimitImpl.java Modified: trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/xpath/impl/MagnoliaCriteriaWithLimitImpl.java =================================================================== --- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/xpath/impl/MagnoliaCriteriaWithLimitImpl.java 2009-10-09 19:08:04 UTC (rev 1480) +++ trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/xpath/impl/MagnoliaCriteriaWithLimitImpl.java 2009-10-09 19:31:24 UTC (rev 1481) @@ -103,17 +103,17 @@ org.apache.jackrabbit.core.query.QueryImpl q = (org.apache.jackrabbit.core.query.QueryImpl) jcrManager .createQuery(stmt, Query.XPATH); - if (getMaxResults() <= 0 || getMaxResults() > Integer.MAX_VALUE) + if (getMaxResults() <= 0) { - String msg = "maxResults value [" + getMaxResults() + "] is out of the accepted range"; + String msg = "maxResults value [" + getMaxResults() + "] cannot be less than or equal to 0"; log.error(msg); throw new InvalidQueryException(msg); } q.setLimit(getMaxResults()); - if (getFirstResult() < 0 || getFirstResult() > Integer.MAX_VALUE) + if (getFirstResult() < 0) { - String msg = "firstResult value [" + getFirstResult() + "] is out of the accepted range"; + String msg = "firstResult value [" + getFirstResult() + "] cannot be less than 0"; log.error(msg); throw new InvalidQueryException(msg); } @@ -213,7 +213,7 @@ private javax.jcr.query.QueryResult result; private AccessManager accessManager; - + private HierarchyManager hm; private Map<String, String> dirtyHandles = new Hashtable<String, String>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 1480 http://openutils.svn.sourceforge.net/openutils/?rev=1480&view=rev Author: fgrilli Date: 2009-10-09 19:08:04 +0000 (Fri, 09 Oct 2009) Log Message: ----------- back to previous rev. Modified Paths: -------------- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/xpath/impl/MagnoliaCriteriaImpl.java Modified: trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/xpath/impl/MagnoliaCriteriaImpl.java =================================================================== --- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/xpath/impl/MagnoliaCriteriaImpl.java 2009-10-09 18:56:09 UTC (rev 1479) +++ trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/xpath/impl/MagnoliaCriteriaImpl.java 2009-10-09 19:08:04 UTC (rev 1480) @@ -27,7 +27,6 @@ import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -102,7 +101,7 @@ if (Content.class.isAssignableFrom(classType)) { log.debug("returning a Collection holding objects of type {} ", Content.class.getName()); - retVal = retVal == null ? Collections.<Content> emptyList() : retVal; + retVal = retVal == null ? new ArrayList<Content>(): retVal; log.debug("got {} node(s) in {} ms", new Object[]{retVal.size(), stop - start }); return retVal; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 1479 http://openutils.svn.sourceforge.net/openutils/?rev=1479&view=rev Author: fgrilli Date: 2009-10-09 18:56:09 +0000 (Fri, 09 Oct 2009) Log Message: ----------- improvement: use Collections.emptyList() instead of instantiating a new empty ArrayList Modified Paths: -------------- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/xpath/impl/MagnoliaCriteriaImpl.java Modified: trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/xpath/impl/MagnoliaCriteriaImpl.java =================================================================== --- trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/xpath/impl/MagnoliaCriteriaImpl.java 2009-10-08 16:40:09 UTC (rev 1478) +++ trunk/openutils-mgnlcriteria/src/main/java/net/sourceforge/openutils/mgnlcriteria/jcr/query/xpath/impl/MagnoliaCriteriaImpl.java 2009-10-09 18:56:09 UTC (rev 1479) @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -101,7 +102,7 @@ if (Content.class.isAssignableFrom(classType)) { log.debug("returning a Collection holding objects of type {} ", Content.class.getName()); - retVal = retVal == null ? new ArrayList<Content>() : retVal; + retVal = retVal == null ? Collections.<Content> emptyList() : retVal; log.debug("got {} node(s) in {} ms", new Object[]{retVal.size(), stop - start }); return retVal; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mol...@us...> - 2009-10-08 16:40:18
|
Revision: 1478 http://openutils.svn.sourceforge.net/openutils/?rev=1478&view=rev Author: molaschi Date: 2009-10-08 16:40:09 +0000 (Thu, 08 Oct 2009) Log Message: ----------- MEDIA-27 add image quality support Modified Paths: -------------- trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java 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-10-08 15:39:13 UTC (rev 1477) +++ trunk/openutils-mgnlmedia/src/main/java/net/sourceforge/openutils/mgnlmedia/media/utils/ImageUtils.java 2009-10-08 16:40:09 UTC (rev 1478) @@ -56,9 +56,10 @@ import javax.imageio.IIOImage; import javax.imageio.ImageIO; +import javax.imageio.ImageTypeSpecifier; import javax.imageio.ImageWriteParam; import javax.imageio.ImageWriter; -import javax.imageio.stream.MemoryCacheImageOutputStream; +import javax.imageio.stream.ImageOutputStream; import javax.jcr.PropertyType; import javax.jcr.RepositoryException; @@ -329,13 +330,15 @@ * @param image image to save * @param saveTo node to save to * @param extension extension + * @param quality image quality + * @param forceProgressive true to force progressive mode * @throws RepositoryException exception in jcr operations * @throws IOException exception converting image to jpg */ - public static void saveResolution(BufferedImage image, Content saveTo, String extension) - throws RepositoryException, IOException + public static void saveResolution(BufferedImage image, Content saveTo, String extension, float quality, + boolean forceProgressive) throws RepositoryException, IOException { - saveResolution(image, saveTo, null, extension); + saveResolution(image, saveTo, null, extension, quality, forceProgressive); } /** @@ -344,11 +347,13 @@ * @param saveTo node to save to * @param name name for this resolution * @param extension extension + * @param quality image quality + * @param forceProgressive true to force progressive mode * @throws RepositoryException exception in jcr operations * @throws IOException exception converting image to jpg */ - public static void saveResolution(BufferedImage image, Content saveTo, String name, String extension) - throws RepositoryException, IOException + public static void saveResolution(BufferedImage image, Content saveTo, String name, String extension, + float quality, boolean forceProgressive) throws RepositoryException, IOException { Content resolutions = saveTo.getChildByName("resolutions"); if (resolutions == null) @@ -375,7 +380,7 @@ } NodeData nd = resolutions.createNodeData(resolution, PropertyType.BINARY); - nd.setValue(getStream(image, extension)); + nd.setValue(getStream(image, extension, quality, forceProgressive)); String mimetype = "image/" + extension; if ("jpg".equals(extension)) { @@ -414,37 +419,73 @@ * @return inputstream * @throws IOException */ - public static InputStream getStream(BufferedImage image, String extension) throws IOException + public static InputStream getStream(BufferedImage image, String extension, float quality, boolean forceProgressive) + throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); BufferedOutputStream out = new BufferedOutputStream(bos); - if ("jpg".equals(extension)) + try { - Iterator<ImageWriter> iter = ImageIO.getImageWritersByFormatName("jpeg"); - ImageWriter writer = iter.next(); - ImageWriteParam iwp = writer.getDefaultWriteParam(); - iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); - iwp.setCompressionQuality(1.0f); // an integer between 0 and 1 - // 1 specifies minimum compression and maximum quality - MemoryCacheImageOutputStream output = new MemoryCacheImageOutputStream(out); - writer.setOutput(output); - IIOImage iioimage = new IIOImage(image, null, null); - writer.write(null, iioimage, iwp); - } - else - { - try + Iterator writers; + ImageOutputStream imageOutputStream; + ImageWriteParam params; + ImageWriter imageWriter; + + writers = ImageIO.getImageWritersBySuffix(extension); + + if (writers != null && writers.hasNext()) { - ImageIO.write(image, extension, out); + // Fetch the first writer in the list + imageWriter = (ImageWriter) writers.next(); + + // Specify the parameters according to those the output file will be written + + // Get Default parameters + params = imageWriter.getDefaultWriteParam(); + + // Define compression mode + params.setCompressionMode(javax.imageio.ImageWriteParam.MODE_EXPLICIT); + + // Define compression quality + params.setCompressionQuality(quality); + + // Define progressive mode + if (forceProgressive) + { + params.setProgressiveMode(javax.imageio.ImageWriteParam.MODE_DEFAULT); + } + else + { + params.setProgressiveMode(javax.imageio.ImageWriteParam.MODE_COPY_FROM_METADATA); + } + + // Deine destination type - used the ColorModel and SampleModel of the Input Image + params.setDestinationType(new ImageTypeSpecifier(image.getColorModel(), image.getSampleModel())); + + // Set the output stream to Second Argument + // imageOutputStream = ImageIO.createImageOutputStream( new FileOutputStream(args[1]) ); + imageOutputStream = ImageIO.createImageOutputStream(out); + imageWriter.setOutput(imageOutputStream); + + // Write the changed Image + imageWriter.write(null, new IIOImage(image, null, null), params); + + // Close the streams + imageOutputStream.close(); + imageWriter.dispose(); } - catch (IOException ex) + else { - log.error("Error writing image to buffer", ex); - throw ex; + ImageIO.write(image, extension, out); } } + catch (IOException ex) + { + log.error("Error writing image to buffer", ex); + throw ex; + } return new ByteArrayInputStream(bos.toByteArray()); } @@ -569,17 +610,41 @@ String resolutionName = "res-" + resolution; - BufferedImage img = ImageUtils.getImageForResolution(original, resolution); + Map<String, String> params = parseParameters(resolution); + BufferedImage img = ImageUtils.getImageForResolution(original, resolution, params); + try { + float quality = 0.8F; + if (StringUtils.isNotEmpty(params.get("quality"))) + { + try + { + quality = NumberUtils.toFloat(params.get("quality")); + if (quality > 1.0F) + { + quality = 1.0F; + } + } + catch (NumberFormatException ex) + { + log.error("quality parameter must be a float number but was {}", params.get("quality")); + } + } + boolean forceProgressive = false; + if (StringUtils.isNotEmpty(params.get("progressive"))) + { + forceProgressive = true; + } if ("thumbnail".equals(resolutionTarget) || "preview".equals(resolutionTarget)) { - ImageUtils.saveResolution(img, node, resolutionTarget, extension); + ImageUtils + .saveResolution(img, node, resolutionTarget, extension, quality, forceProgressive); } else { - ImageUtils.saveResolution(img, node, resolutionName, extension); + ImageUtils.saveResolution(img, node, resolutionName, extension, quality, forceProgressive); } } catch (RepositoryException e) @@ -617,28 +682,9 @@ return true; } - /** - * Get image for a resolution - * @param original original image - * @param resolution resolution - * @return new image - */ - public static BufferedImage getImageForResolution(BufferedImage original, String resolution) + private static Map<String, String> parseParameters(String resolution) { - if (original == null) - { - throw new IllegalArgumentException("input image is null"); - } - if (resolution == null || resolution.length() < 1) - { - throw new IllegalArgumentException("Invalid resolution: " + resolution); - } - - BufferedImage img = null; - - resolution = StringUtils.lowerCase(resolution); - Map<String, String> params = new HashMap<String, String>(); if (StringUtils.contains(resolution, ";")) { @@ -659,7 +705,32 @@ } } } + return params; + } + /** + * Get image for a resolution + * @param original original image + * @param resolution resolution + * @return new image + */ + public static BufferedImage getImageForResolution(BufferedImage original, String resolution, + Map<String, String> params) + { + + if (original == null) + { + throw new IllegalArgumentException("input image is null"); + } + if (resolution == null || resolution.length() < 1) + { + throw new IllegalArgumentException("Invalid resolution: " + resolution); + } + + BufferedImage img = null; + + resolution = StringUtils.lowerCase(resolution); + char controlChar = resolution.charAt(0); Point size = parseForSize(resolution); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |