Skip to content

Commit 573dff5

Browse files
committed
-changed the hibernate, sprint, and data versions.
1 parent eeb41dc commit 573dff5

9 files changed

Lines changed: 63 additions & 49 deletions

File tree

.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
2424
</attributes>
2525
</classpathentry>
26-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
26+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
2727
<attributes>
2828
<attribute name="owner.project.facets" value="java"/>
2929
</attributes>

.settings/org.eclipse.jdt.core.prefs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
eclipse.preferences.version=1
22
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
33
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
4-
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
4+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
55
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6-
org.eclipse.jdt.core.compiler.compliance=1.7
6+
org.eclipse.jdt.core.compiler.compliance=1.8
77
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
88
org.eclipse.jdt.core.compiler.debug.localVariable=generate
99
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
1010
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
1111
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
1212
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
13-
org.eclipse.jdt.core.compiler.source=1.7
13+
org.eclipse.jdt.core.compiler.source=1.8
1414
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
1515
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
1616
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<faceted-project>
33
<installed facet="jst.utility" version="1.0"/>
4-
<installed facet="java" version="1.7"/>
4+
<installed facet="java" version="1.8"/>
55
</faceted-project>

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,11 @@ This can be used on classes non managed by spring.
1616
This return a server full URL containing the scheme + the server host + port (if is not the 80) and the context name (when have).
1717
This can be used on classes non managed by spring.
1818

19-
##DWR Converters (HibernateBeanConverter & LocalDateTimeConverter)
19+
##DWR Converters (HibernateBeanConverter, LocalDateTimeConverter, OptionalConverter)
2020

2121
##Custom Hibernate PostgreSQL Dialect
2222
Supporting a custom HQL function called `FILTER()`
2323

24-
##Easy file management via Java JCR
25-
Infrastructure to store files via JCR implemented by Modeshape supported by a generic file repository `IMetaFileRepository` and its entity `MetaFile`.
26-
27-
##Support of TRUNCATE TABLE to the DBUnit
28-
```java
29-
CascadeTruncateTableOperation.java
30-
```
3124
##ReportManager
3225
####Report generator implemented by `JasperReportManager`
3326
Supported methods:

pom.xml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,17 @@
44

55
<groupId>br.com.eits</groupId>
66
<artifactId>eits-java-common</artifactId>
7-
<version>3.0.1-RELEASE</version>
7+
<version>4.0.0-RELEASE</version>
88

99
<!-- Properties -->
1010
<properties>
11-
<!-- Maven -->
1211
<maven.test.failure.ignore>true</maven.test.failure.ignore>
13-
14-
<!-- Java -->
15-
<java.version>1.8</java.version>
12+
<java.version>1.8</java.version>
1613

17-
<hibernate.version>4.3.8.Final</hibernate.version>
18-
<hibernate-validator.version>5.1.3.Final</hibernate-validator.version>
19-
<springframework.version>4.2.0.RELEASE</springframework.version>
20-
<spring-data.version>1.9.0.RELEASE</spring-data.version>
14+
<hibernate.version>5.2.12.Final</hibernate.version>
15+
<hibernate-validator.version>5.4.1.Final</hibernate-validator.version>
16+
<springframework.version>5.0.2.RELEASE</springframework.version>
17+
<spring-data.version>2.0.2.RELEASE</spring-data.version>
2118
<jasper.version>6.2.2</jasper.version>
2219
<dwr.version>3.0.2-RELEASE</dwr.version>
2320
<apache-poi.version>3.14</apache-poi.version>
@@ -127,9 +124,9 @@
127124

128125
<!-- DWR -->
129126
<dependency>
130-
<groupId>org.directwebremoting</groupId>
131-
<artifactId>dwr</artifactId>
132-
<version>${dwr.version}</version>
127+
<groupId>org.directwebremoting</groupId>
128+
<artifactId>dwr</artifactId>
129+
<version>${dwr.version}</version>
133130
</dependency>
134131

135132
<dependency>

src/main/java/br/com/eits/common/application/dwr/converter/HibernateBeanConverter.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import org.directwebremoting.extend.PlainProperty;
1717
import org.directwebremoting.extend.Property;
1818
import org.hibernate.Hibernate;
19-
import org.hibernate.engine.spi.SessionImplementor;
19+
import org.hibernate.engine.spi.SharedSessionContractImplementor;
2020
import org.hibernate.proxy.HibernateProxy;
2121
import org.hibernate.proxy.LazyInitializer;
2222

@@ -154,16 +154,16 @@ public Class<?> getClass(Object example)
154154
{
155155
if (example instanceof HibernateProxy)
156156
{
157-
HibernateProxy proxy = (HibernateProxy) example;
158-
LazyInitializer initializer = proxy.getHibernateLazyInitializer();
159-
SessionImplementor implementor = initializer.getSession();
157+
final HibernateProxy proxy = (HibernateProxy) example;
158+
final LazyInitializer initializer = proxy.getHibernateLazyInitializer();
159+
final SharedSessionContractImplementor implementor = initializer.getSession();
160160

161-
if (initializer.isUninitialized())
161+
if ( initializer.isUninitialized() )
162162
{
163163
try
164164
{
165165
// getImplementation is going to want to talk to a session
166-
if (implementor.isClosed())
166+
if ( implementor.isClosed() )
167167
{
168168
// Give up and return example.getClass();
169169
return example.getClass();
@@ -189,13 +189,15 @@ public Class<?> getClass(Object example)
189189
*/
190190
protected Method findGetter(Object data, String property) throws IntrospectionException
191191
{
192-
Class<?> clazz = getClass(data);
193-
String key = clazz.getName() + ":" + property;
192+
final Class<?> clazz = getClass(data);
193+
final String key = clazz.getName() + ":" + property;
194194
Method method = methods.get(key);
195+
195196
if (method == null)
196197
{
197198
Method newMethod = null;
198-
PropertyDescriptor[] props = Introspector.getBeanInfo(clazz).getPropertyDescriptors();
199+
PropertyDescriptor[] props = Introspector.getBeanInfo(clazz).getPropertyDescriptors();
200+
199201
for (PropertyDescriptor prop : props)
200202
{
201203
if (prop.getName().equalsIgnoreCase(property))
@@ -204,7 +206,9 @@ protected Method findGetter(Object data, String property) throws IntrospectionEx
204206
}
205207
}
206208
method = methods.putIfAbsent(key, newMethod);
207-
if (method == null) {
209+
210+
if (method == null)
211+
{
208212
// put succeeded, use new value
209213
method = newMethod;
210214
}

src/main/java/br/com/eits/common/application/dwr/converter/OptionalConverter.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,29 @@
1717
*/
1818
public class OptionalConverter implements Converter
1919
{
20+
/*-------------------------------------------------------------------
21+
* ATTRIBUTES
22+
*-------------------------------------------------------------------*/
23+
/**
24+
*
25+
*/
2026
private ConverterManager converterManager;
2127

28+
/*-------------------------------------------------------------------
29+
* BEHAVIORS
30+
*-------------------------------------------------------------------*/
31+
/**
32+
*
33+
*/
2234
@Override
2335
public void setConverterManager( ConverterManager converterManager )
2436
{
2537
this.converterManager = converterManager;
2638
}
2739

40+
/**
41+
*
42+
*/
2843
@Override
2944
public Object convertInbound( Class<?> paramType, InboundVariable data ) throws ConversionException
3045
{
@@ -33,12 +48,16 @@ public Object convertInbound( Class<?> paramType, InboundVariable data ) throws
3348
return Optional.ofNullable( converterManager.convertInbound( optionalType, data, data.getContext().getCurrentProperty() ) );
3449
}
3550

51+
/**
52+
*
53+
*/
3654
@Override
3755
public OutboundVariable convertOutbound( Object data, OutboundContext outctx ) throws ConversionException
3856
{
3957
Optional<?> optional = (Optional<?>) data;
40-
return
41-
optional.map( val -> converterManager.convertOutbound( val, outctx ) )
42-
.orElse( new NonNestedOutboundVariable( "null" ) );
58+
59+
return optional
60+
.map( val -> this.converterManager.convertOutbound( val, outctx ) )
61+
.orElse( new NonNestedOutboundVariable( "null" ) );
4362
}
4463
}

src/main/java/br/com/eits/common/application/dwr/converter/hibernate/HibernatePropertyDescriptorProperty.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import org.directwebremoting.extend.PropertyDescriptorProperty;
1111
import org.hibernate.Hibernate;
1212
import org.hibernate.Session;
13-
import org.hibernate.engine.spi.SessionImplementor;
13+
import org.hibernate.engine.spi.SharedSessionContractImplementor;
1414
import org.hibernate.proxy.HibernateProxy;
1515
import org.hibernate.proxy.LazyInitializer;
1616

@@ -47,7 +47,7 @@ public HibernatePropertyDescriptorProperty(PropertyDescriptor descriptor)
4747
@Override
4848
public Object getValue(Object bean) throws ConversionException
4949
{
50-
if (!(bean instanceof HibernateProxy))
50+
if ( !(bean instanceof HibernateProxy) )
5151
{
5252
// This is not a hibernate dynamic proxy, just use it
5353
return super.getValue(bean);
@@ -56,32 +56,34 @@ public Object getValue(Object bean) throws ConversionException
5656
{
5757
// If the property is already initialized, use it
5858
boolean initialized = Hibernate.isPropertyInitialized(bean, descriptor.getName());
59-
if (initialized)
59+
60+
if ( initialized )
6061
{
6162
// This might be a lazy-collection so we need to double check
6263
Object reply = super.getValue(bean);
6364
initialized = Hibernate.isInitialized(reply);
6465
}
6566

66-
if (initialized)
67+
if ( initialized )
6768
{
6869
return super.getValue(bean);
6970
}
7071
else
7172
{
7273
// If the session bound to the property is live, use it
73-
HibernateProxy proxy = (HibernateProxy) bean;
74-
LazyInitializer initializer = proxy.getHibernateLazyInitializer();
75-
SessionImplementor implementor = initializer.getSession();
76-
if (implementor.isOpen())
74+
final HibernateProxy proxy = (HibernateProxy) bean;
75+
final LazyInitializer initializer = proxy.getHibernateLazyInitializer();
76+
final SharedSessionContractImplementor implementor = initializer.getSession();
77+
78+
if ( implementor.isOpen() )
7779
{
7880
return super.getValue(bean);
7981
}
8082

8183
// So the property needs database access, and the session is closed
8284
// We'll need to try get another session
83-
ServletContext context = WebContextFactory.get().getServletContext();
84-
Session session = HibernateSessionAjaxFilter.getCurrentSession(context);
85+
final ServletContext context = WebContextFactory.get().getServletContext();
86+
final Session session = HibernateSessionAjaxFilter.getCurrentSession(context);
8587

8688
if (session != null)
8789
{

src/main/java/br/com/eits/common/domain/entity/AbstractEntity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package br.com.eits.common.domain.entity;
22

33
import java.time.LocalDateTime;
4-
import java.util.Calendar;
54

65
import javax.persistence.Column;
76
import javax.persistence.GeneratedValue;

0 commit comments

Comments
 (0)