diff --git a/atom-client/.classpath b/atom-client/.classpath index d1441d9..a8d1a01 100644 --- a/atom-client/.classpath +++ b/atom-client/.classpath @@ -24,5 +24,6 @@ + diff --git a/atom-client/gwt dev mode inline.launch b/atom-client/gwt dev mode inline.launch index d48dc40..34c5418 100644 --- a/atom-client/gwt dev mode inline.launch +++ b/atom-client/gwt dev mode inline.launch @@ -29,7 +29,7 @@ - + diff --git a/atom-client/pom.xml b/atom-client/pom.xml index a1f8c12..de617cc 100644 --- a/atom-client/pom.xml +++ b/atom-client/pom.xml @@ -35,18 +35,18 @@ - com.google.gwt + ${gwt.groupid} gwt-user provided ${gwt.version} - + ${project.groupId} @@ -105,24 +105,24 @@ - org.codehaus.mojo + ${gwt.mavenplugin.groupid} gwt-maven-plugin ${gwt.mavenplugin.version} - com.google.gwt + ${gwt.groupid} gwt-user ${gwt.version} - com.google.gwt + ${gwt.groupid} gwt-dev ${gwt.version} - com.google.gwt + ${gwt.groupid} gwt-codeserver ${gwt.version} @@ -144,7 +144,7 @@ - 1.7 + 1.8 ${project.build.directory}/gwtc/extra ${project.build.directory}/gwtc/extra ${project.build.directory}/gwtc/gen diff --git a/atom-client/src/main/java/at/ac/fhcampuswien/atom/client/ClientTools.java b/atom-client/src/main/java/at/ac/fhcampuswien/atom/client/ClientTools.java index a81ed4e..b7a7582 100644 --- a/atom-client/src/main/java/at/ac/fhcampuswien/atom/client/ClientTools.java +++ b/atom-client/src/main/java/at/ac/fhcampuswien/atom/client/ClientTools.java @@ -4,12 +4,20 @@ */ package at.ac.fhcampuswien.atom.client; +import java.lang.reflect.Method; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Map; +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.dom.client.NativeEvent; +import com.google.gwt.event.dom.client.KeyPressEvent; +import com.google.gwt.i18n.client.DateTimeFormat; +import com.google.gwt.reflect.client.ConstPool; +import com.google.gwt.reflect.shared.GwtReflect; + import at.ac.fhcampuswien.atom.client.gui.attributes.components.FilterSpecificationDialogBox; import at.ac.fhcampuswien.atom.client.rpc.RPCCaller; import at.ac.fhcampuswien.atom.client.rpc.WaitingFor; @@ -20,14 +28,6 @@ import at.ac.fhcampuswien.atom.shared.domain.DomainObject; import at.ac.fhcampuswien.atom.shared.exceptions.ValidationError; -import com.allen_sauer.gwt.log.client.Log; -import com.google.gwt.dom.client.NativeEvent; -import com.google.gwt.event.dom.client.KeyPressEvent; -import com.google.gwt.i18n.client.DateTimeFormat; -import com.gwtent.reflection.client.ClassType; -import com.gwtent.reflection.client.NotFoundException; -import com.gwtent.reflection.client.TypeOracle; - public class ClientTools { private ClientTools() { } @@ -48,8 +48,11 @@ public static Object getAttributeValue(DomainClass domainClass, DomainClassAttri // + ") started", null); try { - ClassType classType = TypeOracle.Instance.getClassType(domainClass.getName()); - Object returnValue = classType.invoke(domainObject, "get" + AtomTools.upperFirstChar(domainClassAttribute.getName()), (Object[]) null); + Method getter = GwtReflect.getDeclaredMethod(getClassByName(domainClass.getName()), "get" + AtomTools.upperFirstChar(domainClassAttribute.getName()), new Class[] {}); + Object returnValue = getter.invoke(domainObject, new Object[] {}); + +// ClassType classType = TypeOracle.Instance.getClassType(domainClass.getName()); +// Object returnValue = classType.invoke(domainObject, "get" + AtomTools.upperFirstChar(domainClassAttribute.getName()), (Object[]) null); // AtomTools.log(Log.LOG_LEVEL_TRACE, // "AtomTools.getAttributeValue successful", null); // String stringValue; @@ -60,7 +63,7 @@ public static Object getAttributeValue(DomainClass domainClass, DomainClassAttri // AtomTools.log(Log.LOG_LEVEL_TRACE, "AtomTools.getAttributeValue(" + domainClass.getName() + ", " + domainClassAttribute.getName() + ", " // + domainObject.getStringRepresentation() + ") found value '" + stringValue + "', returning", null); return returnValue; - } catch (NotFoundException e) { + } catch (RuntimeException e) { if (domainClass.getSuperClass() != null) { AtomTools.log(Log.LOG_LEVEL_TRACE, "AtomTools.getAttributeValue(" + domainClass.getName() + ", " + domainClassAttribute.getName() + ", " + domainObject.getStringRepresentation() + ") did not find getMethod in this class, will try superclass", null); @@ -94,9 +97,12 @@ public static void setAttributeValue(DomainClass domainClass, DomainClassAttribu } try { - ClassType classType = TypeOracle.Instance.getClassType(domainClass.getName()); - classType.invoke(domainObject, "set" + AtomTools.upperFirstChar(domainClassAttribute.getName()), new Object[] { value }); - } catch (NotFoundException e) { + Method setter = GwtReflect.getDeclaredMethod(getClassByName(domainClass.getName()), "set" + AtomTools.upperFirstChar(domainClassAttribute.getName()), value.getClass()); + setter.invoke(domainObject, value); + +// ClassType classType = TypeOracle.Instance.getClassType(domainClass.getName()); +// classType.invoke(domainObject, "set" + AtomTools.upperFirstChar(domainClassAttribute.getName()), new Object[] { value }); + } catch (RuntimeException e) { if (domainClass.getSuperClass() != null) { setAttributeValue(domainClass.getSuperClass(), domainClassAttribute, domainObject, value); } else { @@ -152,11 +158,31 @@ public static void validateDomainObject(DomainObject domainObject, DomainClass c } } + + private static Class getClassByName(String className) { + Class cls = ConstPool.getConstPool().getClassByName(className); + //Class cls = Class.forName(domainClass.getName()); + + @SuppressWarnings("unchecked") + Class dcls = (Class) cls; + + return dcls; + } + public static DomainObject createInstance(DomainClass domainClass) { AtomTools.log(Log.LOG_LEVEL_DEBUG, "createInstance(" + domainClass.getName() + ")", null); - ClassType classType = TypeOracle.Instance.getClassType(domainClass.getName()); - String[] params = new String[] {}; - return (DomainObject) classType.findConstructor(params).newInstance(); + + try { + return GwtReflect.construct(getClassByName(domainClass.getName()), new Class[] {}, new Object[] {}); + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return null; + } + + //ClassType classType = TypeOracle.Instance.getClassType(domainClass.getName()); +// String[] params = new String[] {}; +// return (DomainObject) classType.findConstructor(params).newInstance(); } private static Map recordedCalls = new HashMap(); diff --git a/atom-client/src/main/resources/at/ac/fhcampuswien/atom/App.gwt.xml b/atom-client/src/main/resources/at/ac/fhcampuswien/atom/App.gwt.xml index cbaf18c..fbbe6a4 100644 --- a/atom-client/src/main/resources/at/ac/fhcampuswien/atom/App.gwt.xml +++ b/atom-client/src/main/resources/at/ac/fhcampuswien/atom/App.gwt.xml @@ -11,10 +11,9 @@ - - + diff --git a/atom-core/pom.xml b/atom-core/pom.xml index 488163b..db97162 100644 --- a/atom-core/pom.xml +++ b/atom-core/pom.xml @@ -35,14 +35,15 @@ of this required annotation on @DomainObject it also needs to transverse into the server side. Used in: at.ac.fhcampuswien.atom.client.ClientTools.getAttributeValue(..) and setAttributeValue(..) --> - + + - + 2.0_GWT2.2 + --> - com.google.gwt + net.wetheinter gwt-user ${gwt.version} provided @@ -113,7 +114,7 @@ project that holds the normal RPC interface, which makes sense to have in atom-core since both atom-client and atom-server need it. --> - org.codehaus.mojo + ${gwt.mavenplugin.groupid} gwt-maven-plugin ${gwt.version} @@ -158,7 +159,7 @@ - org.codehaus.mojo + ${gwt.mavenplugin.groupid} gwt-maven-plugin diff --git a/atom-core/src/main/java/at/ac/fhcampuswien/atom/shared/domain/DomainObject.java b/atom-core/src/main/java/at/ac/fhcampuswien/atom/shared/domain/DomainObject.java index d11082b..0ae7811 100644 --- a/atom-core/src/main/java/at/ac/fhcampuswien/atom/shared/domain/DomainObject.java +++ b/atom-core/src/main/java/at/ac/fhcampuswien/atom/shared/domain/DomainObject.java @@ -25,6 +25,9 @@ import org.hibernate.annotations.OnDelete; import org.hibernate.annotations.OnDeleteAction; +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.user.client.rpc.GwtTransient; + import at.ac.fhcampuswien.atom.shared.AtomConfig; import at.ac.fhcampuswien.atom.shared.AtomTools; import at.ac.fhcampuswien.atom.shared.ClientSession; @@ -45,10 +48,6 @@ import at.ac.fhcampuswien.atom.shared.annotations.RelationDefinition; import at.ac.fhcampuswien.atom.shared.annotations.RelationEssential; -import com.allen_sauer.gwt.log.client.Log; -import com.google.gwt.user.client.rpc.GwtTransient; -import com.gwtent.reflection.client.Reflectable; - /** * * @author thomas.kaefer @@ -89,7 +88,7 @@ */ //gwt-ent reflection, currently concidering to replace it with https://github.com/WeTheInternet/xapi/tree/master/gwt/gwt-reflect -@Reflectable(superClasses = false, assignableClasses = true, relationTypes = false, fields = false, methods = true, constructors = true, classAnnotations = false, fieldAnnotations = false) +//@Reflectable(superClasses = false, assignableClasses = true, relationTypes = false, fields = false, methods = true, constructors = true, classAnnotations = false, fieldAnnotations = false) @Entity @Inheritance(strategy = InheritanceType.JOINED) diff --git a/atom-domain/pom.xml b/atom-domain/pom.xml index 989a883..3fcb983 100644 --- a/atom-domain/pom.xml +++ b/atom-domain/pom.xml @@ -27,7 +27,7 @@ which causes 'The hierarchy of the type * is incosistent' errors for all DomainObject sub-classes if neither gwt-user nor gwt-servlet is present --> - com.google.gwt + ${gwt.groupid} gwt-user ${gwt.version} provided diff --git a/atom-server/pom.xml b/atom-server/pom.xml index eba87aa..7914558 100644 --- a/atom-server/pom.xml +++ b/atom-server/pom.xml @@ -38,7 +38,7 @@ - com.google.gwt + ${gwt.groupid} gwt-servlet ${gwt.version} compile @@ -138,7 +138,7 @@ - com.google.gwt + ${gwt.groupid} gwt-user ${gwt.version} test diff --git a/pom.xml b/pom.xml index 1dcf8ba..2cdbc10 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ 3.0 1.0-SNAPSHOT - 1.7 + 1.8 - 2.6.1 - 2.6.1 + + - + 2.7.0 + 2.7.0 + + net.wetheinter + + net.wetheinter +