Author: shane.bryzak(a)jboss.com
Date: 2010-09-01 00:13:37 -0400 (Wed, 01 Sep 2010)
New Revision: 13685
Modified:
modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/model/ModelHandler.java
modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/wrapper/BeanWrapper.java
modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/Person.java
modules/remoting/trunk/examples/model/src/main/webapp/WEB-INF/beans.xml
Log:
enabled transaction interceptor, fixed ModelHandler.processApplyRequest() - stupid
semicolon ;-/
Modified:
modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/model/ModelHandler.java
===================================================================
---
modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/model/ModelHandler.java 2010-09-01
03:08:01 UTC (rev 13684)
+++
modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/model/ModelHandler.java 2010-09-01
04:13:37 UTC (rev 13685)
@@ -188,7 +188,7 @@
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "unused" })
private Model processApplyRequest(Element modelElement)
throws Exception
{
@@ -253,7 +253,7 @@
else
{
Type t = ((BeanWrapper) target).getBeanPropertyType(name);
- if (!cloneBagContents(source.convert(t), ((Wrapper)
targetBag).getValue()));
+ if (!cloneBagContents(source.convert(t), ((Wrapper)
targetBag).getValue()))
{
((BeanWrapper) target).setBeanProperty(name, source);
}
@@ -276,7 +276,8 @@
else
{
Type t = ((BeanWrapper) target).getBeanPropertyType(name);
- cloneMapContents((Map) source.convert(t), (Map) targetMap);
+ cloneMapContents((Map<Object,Object>) source.convert(t),
+ (Map<Object,Object>) targetMap);
}
}
else
@@ -299,8 +300,8 @@
Wrapper target = model.getCallContext().getOutRefs().get(refId);
Wrapper source = model.getCallContext().createWrapperFromElement(
(Element) changeset.element("map"));
- cloneMapContents((Map) source.convert(target.getValue().getClass()),
- (Map) target.getValue());
+ cloneMapContents((Map<Object,Object>)
source.convert(target.getValue().getClass()),
+ (Map<Object,Object>) target.getValue());
}
}
}
@@ -395,13 +396,10 @@
}
else if (List.class.isAssignableFrom(cls))
{
- List sourceList = (List) sourceBag;
- List targetList = (List) targetBag;
+ List<Object> sourceList = (List<Object>) sourceBag;
+ List<Object> targetList = (List<Object>) targetBag;
- while (targetList.size() > sourceList.size())
- {
- targetList.remove(targetList.size() - 1);
- }
+ targetList.clear();
for (int i = 0; i < sourceList.size(); i++)
{
@@ -418,8 +416,8 @@
}
else if (Set.class.isAssignableFrom(cls))
{
- Set sourceSet = (Set) sourceBag;
- Set targetSet = (Set) targetBag;
+ Set<Object> sourceSet = (Set<Object>) sourceBag;
+ Set<Object> targetSet = (Set<Object>) targetBag;
for (Object e : sourceSet)
{
@@ -448,8 +446,7 @@
* @param sourceMap
* @param targetMap
*/
- @SuppressWarnings("unchecked")
- private void cloneMapContents(Map sourceMap, Map targetMap)
+ private void cloneMapContents(Map<Object,Object> sourceMap,
Map<Object,Object> targetMap)
{
for (Object key : sourceMap.keySet())
{
Modified:
modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/wrapper/BeanWrapper.java
===================================================================
---
modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/wrapper/BeanWrapper.java 2010-09-01
03:08:01 UTC (rev 13684)
+++
modules/remoting/trunk/core/src/main/java/org/jboss/seam/remoting/wrapper/BeanWrapper.java 2010-09-01
04:13:37 UTC (rev 13685)
@@ -176,8 +176,7 @@
}
finally
{
- if (f != null)
- f.setAccessible(accessible);
+ if (f != null) f.setAccessible(accessible);
}
}
Modified:
modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/Person.java
===================================================================
---
modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/Person.java 2010-09-01
03:08:01 UTC (rev 13684)
+++
modules/remoting/trunk/examples/model/src/main/java/org/jboss/seam/remoting/examples/model/Person.java 2010-09-01
04:13:37 UTC (rev 13685)
@@ -64,7 +64,8 @@
this.dateOfBirth = dateOfBirth;
}
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "person", cascade =
CascadeType.ALL)
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "person",
+ cascade = CascadeType.ALL, orphanRemoval = true)
public Collection<Address> getAddresses()
{
return addresses;
Modified: modules/remoting/trunk/examples/model/src/main/webapp/WEB-INF/beans.xml
===================================================================
--- modules/remoting/trunk/examples/model/src/main/webapp/WEB-INF/beans.xml 2010-09-01
03:08:01 UTC (rev 13684)
+++ modules/remoting/trunk/examples/model/src/main/webapp/WEB-INF/beans.xml 2010-09-01
04:13:37 UTC (rev 13685)
@@ -0,0 +1,5 @@
+<beans>
+ <interceptors>
+
<class>org.jboss.seam.persistence.transaction.TransactionInterceptor</class>
+ </interceptors>
+</beans>
\ No newline at end of file
Show replies by date