Author: julien_viet
Date: 2009-08-30 08:15:06 -0400 (Sun, 30 Aug 2009)
New Revision: 130
Modified:
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java
Log:
add convenient method for dealing with object by their path
Modified: components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java
===================================================================
---
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java 2009-08-30
05:40:59 UTC (rev 129)
+++
components/mop/trunk/core/src/main/java/org/gatein/mop/core/api/ModelImpl.java 2009-08-30
12:15:06 UTC (rev 130)
@@ -129,10 +129,15 @@
return q.execute(type.getJavaType());
}
- public String getPath(Object o) {
+ public String getPath(WorkspaceObject o) {
return session.getPath(o);
}
+ public <O extends WorkspaceObject> O getObject(ObjectType<? extends O>
type, String path) {
+ Class<? extends O> t = type.getJavaType();
+ return session.findByPath(t, path);
+ }
+
private void inject(Object o, boolean persistent) {
if (o instanceof UIWindowImpl) {
((UIWindowImpl)o).setContentManager(contentManager);