List Info

Thread: DefaultDocument changes




DefaultDocument changes
user name
2006-03-13 18:42:13
Andreas Hartmann wrote:

> michiapache.org wrote:
>
> [...]
>
>>      public boolean existsInAnyLanguage() throws
DocumentException {
>>          boolean exists = false;
>>  
>> +        String[] languages = getLanguages();
>> +
>> +        if (languages.length > 0) {
>
>
> This would IMO be sufficient:
>
> public boolean existsInAnyLanguage() throws
DocumentException {
>     return getLanguages().length > 0;
> }


I think so too, whereas I would leave the debug messages,
because they 
are really helpful.

I don't know why the code was as it was, but it definitely
did too much ...

>
>
>
>> +                log.warn("Document ("
+ this + ") exists in at least 
>> one language: " + languages.length);
>> +                String[] allLanguages = 
>> getPublication().getLanguages();
>> +                if (languages.length ==
allLanguages.length) 
>> log.warn("Document (" + this + ")
exists even in all languages of 
>> this publication");
>
>
>
> This is not necessarily correct.
>
> Imagine that the document languages are {en, de}
> and the publication languages are {de, fr}.


right ....

> This is not
> prohibited by the current architecture.


I think we should rathe question why all languages need to
be defined 
within publication.xconf and
not just the default language. Any idea?

> If we want to disallow
> this case, we have to check on startup if documents
exist in
> languages which are not declared in publication.xconf.


I don't think that makes sense

Michi

>
>
> -- Andreas
>
>
>


-- 
Michael Wechner
Wyona      -   Open Source Content Management   -    Apache
Lenya
http://www.wyona.com     
                http://lenya.apache.org
michael.wechnerwyona.com                        michiapache.org


------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribelenya.apache.org
For additional commands, e-mail: dev-helplenya.apache.org

DefaultDocument changes
user name
2006-03-14 16:44:19
Michael Wechner wrote:
> Andreas Hartmann wrote:
> 
>> michiapache.org wrote:
>>
>> [...]
>>
>>>      public boolean existsInAnyLanguage()
throws DocumentException {
>>>          boolean exists = false;
>>>  
>>> +        String[] languages = getLanguages();
>>> +
>>> +        if (languages.length > 0) {
>>
>>
>> This would IMO be sufficient:
>>
>> public boolean existsInAnyLanguage() throws
DocumentException {
>>     return getLanguages().length > 0;
>> }
> 
> 
> I think so too, whereas I would leave the debug
messages, because they 
> are really helpful.
> 
> I don't know why the code was as it was, but it
definitely did too much ...

That's true 
Probably for historical reasons.
Thanks for refactoring it.

>>> +                log.warn("Document
(" + this + ") exists in at least 
>>> one language: " + languages.length);
>>> +                String[] allLanguages = 
>>> getPublication().getLanguages();
>>> +                if (languages.length ==
allLanguages.length) 
>>> log.warn("Document (" + this +
") exists even in all languages of 
>>> this publication");
>>
>>
>>
>> This is not necessarily correct.
>>
>> Imagine that the document languages are {en, de}
>> and the publication languages are {de, fr}.
> 
> 
> right ....
> 
>> This is not
>> prohibited by the current architecture.
> 
> 
> I think we should rathe question why all languages need
to be defined 
> within publication.xconf and
> not just the default language. Any idea?

It helps, for instance, to build widgets for language
selection.
Going through the whole site to see which languages exist
doesn't
scale with the current repo implementations.


>> If we want to disallow
>> this case, we have to check on startup if documents
exist in
>> languages which are not declared in
publication.xconf.
> 
> 
> I don't think that makes sense

Neither do I. A possibility to ensure the consistency in JCR
would be
to use references from documents to "language
nodes", but this should
probably be handled by the Lenya repo layer.

-- Andreas


-- 
Andreas Hartmann
Wyona Inc.  -   Open Source Content Management   -   Apache
Lenya
http://www.wyona.com     
                http://lenya.apache.org
andreas.hartmannwyona.com                     andreasapache.org


------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribelenya.apache.org
For additional commands, e-mail: dev-helplenya.apache.org

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )