Skip to content

Commit

Permalink
Move to Spring 4 [WIP]
Browse files Browse the repository at this point in the history
Include depreacted SimpleFormController from Spring 3.2.18 by extracting
specific files with Maven depdendency plugin.

Update xsi:schemaLocations mentions to 4.3.

Update DWR to 3.0.2.

Update Jersey to 2.27.
  • Loading branch information
arteymix committed Dec 4, 2022
1 parent aec48cb commit 36bba51
Show file tree
Hide file tree
Showing 20 changed files with 140 additions and 138 deletions.
4 changes: 2 additions & 2 deletions gemma-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@
<version>1.5</version>
<dependencies><!-- yes, this needs to be here. -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>${mysql.version}</version>
<scope>runtime</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.hibernate.*;
import org.hibernate.engine.spi.CascadeStyle;
import org.hibernate.engine.spi.CascadingAction;
import org.hibernate.engine.spi.CascadingActions;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.type.Type;
import org.slf4j.Logger;
Expand Down Expand Up @@ -180,18 +181,18 @@ private void processAuditable( Signature method, OperationType operationType, Au
*/
private void addCreateAuditEvent( Signature method, Auditable auditable, User user, Date date ) {
addAuditEvent( method, auditable, AuditAction.CREATE, "", user, date );
cascadeAuditEvent( method, AuditAction.CREATE, auditable, user, date, CascadingAction.PERSIST );
cascadeAuditEvent( method, AuditAction.CREATE, auditable, user, date, CascadingActions.PERSIST );
}

private void addSaveAuditEvent( Signature method, Auditable auditable, User user, Date date ) {
AuditAction auditAction;
CascadingAction cascadingAction;
if ( auditable.getId() != null ) {
auditAction = AuditAction.UPDATE;
cascadingAction = CascadingAction.MERGE;
cascadingAction = CascadingActions.MERGE;
} else {
auditAction = AuditAction.CREATE;
cascadingAction = CascadingAction.PERSIST;
cascadingAction = CascadingActions.PERSIST;
}
addAuditEvent( method, auditable, auditAction, "", user, date );
// we only propagate a CREATE event through cascade for entities that were created in the save
Expand All @@ -214,15 +215,15 @@ private void addUpdateAuditEvent( Signature method, Auditable auditable, User us
addAuditEvent( method, auditable, AuditAction.UPDATE, "", user, date );
// we only propagate a CREATE event through cascade for entities that were created in the update
// Note: CREATE events are skipped if the audit trail already contains one
cascadeAuditEvent( method, AuditAction.CREATE, auditable, user, date, CascadingAction.SAVE_UPDATE );
cascadeAuditEvent( method, AuditAction.CREATE, auditable, user, date, CascadingActions.SAVE_UPDATE );
}

private void addDeleteAuditEvent( Signature method, Auditable auditable, User user, Date date ) {
if ( auditable.getId() == null ) {
throw new IllegalArgumentException( String.format( "Transient instance passed to delete auditing [%s on %s by %s]", method, auditable, user.getUserName() ) );
}
addAuditEvent( method, auditable, AuditAction.DELETE, "", user, date );
cascadeAuditEvent( method, AuditAction.DELETE, auditable, user, date, CascadingAction.DELETE );
cascadeAuditEvent( method, AuditAction.DELETE, auditable, user, date, CascadingActions.DELETE );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class ObjectFilter {
*/
private static final ConfigurableConversionService conversionService = new GenericConversionService();

private static <T> void addConverter( Class<?> targetClass, Converter<String, T> converter ) {
private static <T> void addConverter( Class<T> targetClass, Converter<? super String, ? extends T> converter ) {
conversionService.addConverter( String.class, targetClass, converter );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<property name="compass" ref="compassExpression"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand All @@ -39,7 +39,7 @@
<property name="compass" ref="compassGene"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand All @@ -48,7 +48,7 @@
<property name="compass" ref="compassArray"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand All @@ -57,7 +57,7 @@
<property name="compass" ref="compassBibliographic"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand All @@ -66,7 +66,7 @@
<property name="compass" ref="compassProbe"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand All @@ -75,7 +75,7 @@
<property name="compass" ref="compassBiosequence"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand All @@ -84,7 +84,7 @@
<property name="compass" ref="compassGeneSet"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand All @@ -93,7 +93,7 @@
<property name="compass" ref="compassExperimentSet"/>
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice"/>
<ref bean="hibernateGpsDevice"/>
</list>
</property>
</bean>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
are listed in a resource. If the resource is in your classpath, list in in 'locations'. Other config files can be added by
defining PropertiesConfiguration instances -->
<bean id="userPropertiesFileHandler" class="org.apache.commons.configuration2.io.FileHandler" init-method="load">
<constructor-arg index="0">
<ref local="userProperties"/>
</constructor-arg>
<constructor-arg index="0" ref="userProperties"/>
<property name="fileName" value="Gemma.properties"/>
</bean>

Expand All @@ -31,9 +29,7 @@
<bean id="configurationPropertyConfigurer"
class="ubic.gemma.persistence.util.CommonsConfigurationPropertyPlaceholderConfigurer"
depends-on="userPropertiesFileHandler">
<property name="configuration">
<ref local="userProperties"/>
</property>
<property name="configuration" ref="userProperties"/>
<property name="locations">
<list>
<value>classpath:default.properties</value>
Expand Down
8 changes: 2 additions & 6 deletions gemma-core/src/test/resources/test.spring.config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

<bean id="configurationPropertyConfigurer"
class="ubic.gemma.persistence.util.CommonsConfigurationPropertyPlaceholderConfigurer">
<property name="configuration">
<ref local="buildProperties"/>
</property>
<property name="configuration" ref="buildProperties"/>
<property name="locations">
<list>
<value>classpath:default.properties</value>
Expand All @@ -18,9 +16,7 @@
</bean>

<bean id="buildPropertiesFileHandler" class="org.apache.commons.configuration2.io.FileHandler" init-method="load">
<constructor-arg index="0">
<ref local="buildProperties"/>
</constructor-arg>
<constructor-arg index="0" ref="buildProperties"/>
<property name="fileName" value="default.properties"/>
</bean>

Expand Down
50 changes: 37 additions & 13 deletions gemma-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,30 @@
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.18.RELEASE</version>
</artifactItem>
</artifactItems>
<includes>org/springframework/web/servlet/mvc/AbstractFormController.class,org/springframework/web/servlet/mvc/BaseCommandController.class,org/springframework/web/servlet/mvc/SimpleFormController.class</includes>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand Down Expand Up @@ -187,18 +211,18 @@
</dependency>

<!-- Spring extra modules -->
<!-- latest for Spring 3 -->
<!-- latest for Spring 4 -->
<dependency>
<groupId>org.springframework.social</groupId>
<artifactId>spring-social-core</artifactId>
<version>1.0.3.RELEASE</version>
<version>1.1.6.RELEASE</version>
<scope>runtime</scope>
</dependency>
<!-- latest for Spring 3 -->
<!-- latest for Spring 4 -->
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.1.4.RELEASE</version>
<version>2.4.7.RELEASE</version>
</dependency>

<!-- Apache Commons -->
Expand All @@ -224,19 +248,19 @@
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>1.8.6</version>
<version>2.3.2</version>
</dependency>

<!-- RSS feeds (depends on spring-web version) -->
<dependency>
<groupId>rome</groupId>
<groupId>com.rometools</groupId>
<artifactId>rome</artifactId>
<version>1.0</version>
<version>1.18.0</version>
</dependency>
<dependency>
<groupId>rome</groupId>
<groupId>com.rometools</groupId>
<artifactId>rome-fetcher</artifactId>
<version>1.0</version>
<version>1.18.0</version>
</dependency>

<!-- JSON -->
Expand All @@ -250,7 +274,7 @@
<dependency>
<groupId>org.directwebremoting</groupId>
<artifactId>dwr</artifactId>
<version>2.0.11-RELEASE</version>
<version>3.0.2-RELEASE</version>
</dependency>

<!-- Templating -->
Expand All @@ -274,7 +298,7 @@
<scope>runtime</scope>
</dependency>

<!-- Jersey (latest for Spring 3) -->
<!-- Jersey (latest for Spring 4 and javax.servlet namespace) -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
Expand All @@ -288,7 +312,7 @@
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring3</artifactId>
<artifactId>jersey-spring4</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
Expand All @@ -312,7 +336,7 @@
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
<version>2.1.1</version>
</dependency>

<!-- Tomcat (defined by production deployment constraints) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
package ubic.gemma.web.controller.common.rss;

import com.sun.syndication.feed.rss.Channel;
import com.sun.syndication.feed.rss.Content;
import com.sun.syndication.feed.rss.Item;
import com.rometools.rome.feed.rss.Channel;
import com.rometools.rome.feed.rss.Content;
import com.rometools.rome.feed.rss.Item;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
Expand Down
12 changes: 6 additions & 6 deletions gemma-web/src/main/java/ubic/gemma/web/feed/FeedReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
*/
package ubic.gemma.web.feed;

import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.fetcher.FeedFetcher;
import com.sun.syndication.fetcher.impl.FeedFetcherCache;
import com.sun.syndication.fetcher.impl.HashMapFeedInfoCache;
import com.sun.syndication.fetcher.impl.HttpURLFeedFetcher;
import com.rometools.fetcher.FeedFetcher;
import com.rometools.fetcher.impl.FeedFetcherCache;
import com.rometools.fetcher.impl.HashMapFeedInfoCache;
import com.rometools.fetcher.impl.HttpURLFeedFetcher;
import com.rometools.rome.feed.synd.SyndEntry;
import com.rometools.rome.feed.synd.SyndFeed;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Controller;
Expand Down
Loading

0 comments on commit 36bba51

Please sign in to comment.