[opencms-dev] Identifying siblings programmatically

Christian Steinert christian_steinert at web.de
Mon Apr 20 19:24:18 CEST 2009


Ludwig Hunecke ha scritto:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi mailing-list,
>
> I've got a question about how to identify siblings programmatically.
>
> Since there is no method like "isSibling()" in CmsResource, I  
> currently identify if a resource R is a sibling with the following  
> rules:
>
> 1. R.getSiblingCount() > 1 AND
> 2. R.structureId does _not_ equal R.resourceId
>
> Do you think this is always valid?
>   
Hi Ludwig

could you clarify a bit what exactly you try to accomplish?

Please note that all siblings are equal. Siblings are alternative file 
system headers that point to the same piece of opencms content.

I don't know if in some cases the structureId and resourceId can have 
the same value - I have never tried this. But even if such is the case, 
the following sequence of operations, would stop this from being the case:
- create a resource (MAYBE resourceId == structureId)
- create an additional sibling for that resource
- delete first resource


I don't think that there is a "clean" way to distinguish between the 
first resource that was created and the other siblings of that resource.

Best Regards
Christian



More information about the opencms-dev mailing list