incubator-graffito-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe Lombart <christophe.lomb...@gmail.com>
Subject Re: VOTE : PersistenceManager & Mapper interface API
Date Wed, 07 Sep 2005 19:14:58 GMT
2005/9/7, Martin Koci <martin.koci@aura.cz>:
> See org.apache.portals.graffito.store.ContentStore#getCmsObject(String
> path). It returns org.apache.portals.graffito.model.core.CmsObject.

See the implementation in
org.apache.portals.graffito.store.impl.ojb.GraffitoOJBStore. It used
the ClassName to build the query.

> think it means: I want an object stored in repository. I know that
> object is repository managed. I know path but not type. Maybe this
> situation is equivalent to: /someDirectory/someFileWithoutExtension. I
> can use 'file' on unix and it tells me kind of content. In Java I can
> use if (returnedObject instanceof Document).
> 

I see only 2 solutions : 
* Add an extra property : jcrmapping:classname (as you suggest). In
this case, node which doesn't contain this property cannot be mapped.
Data migration is required if a user want to use this framework.
* or use the class as method parameters. 

Interface support will minimize this issue. it will be possible to do
something like this :

Suppose that we have a ancestor interface : CmsObject and 2
descendants : Folder and Document. it will possible to make query and
retrieve object based on this interface :

For example : 
CmsObject cmsobject = pm.getObject(CmsObject.class, "/test/...");
Collection cmsObjects = pm.retrieveCollection(CmsObject.class, criteria);
Collection cmsObjects = pm.retrieveCollection(Document.class, criteria);

The first one can returns any kind of CmsObject based object (Folder,
Document, Images, ...)
The second method call will return all objects based on the CmsObject
interface and matching to a criteria.
The last one will return only Document based objects (Binary, Word, HTML, ...)

Mime
View raw message