db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject Re: OJB Alias / UserAlias
Date Fri, 24 Sep 2004 19:51:55 GMT
hi phil,

i refactored the UserAlias stuff and moved it from the SelectionCriteria to 
Criteria.
could you please add a reasonable example using pathAlias to the docs ? my 
english is not good enough :(

tia
jakob

Phil Warrick schrieb:
> Hi Jakob,
> 
>> you are the alias specialist, so i'm contacting you directly.
>>
>> i would like to clean up alias handling and was thinking about holding 
>> UserAlias only to get rid of m_alias and m_aliasPath instvars. 
>> whenever i use setAlias(String) or setAlias(String,String) i'd like to 
>> create a UserAlias. this is imo no problem in SelectionCriteria, 
>> because we have the attribute there. But what do i do in Criteria ? 
>> create a UserAlias with name only ? Criteria#getUserAlias(Object 
>> attribute) picks the UserAlias if available so it would get the 
>> 'empty' UserAlias instead of building a new one.
>>
>> another question is whether we really need a UserAlias on 
>> SelectionCriteria level. isn't it sufficient to have on UserAlias on 
>> Criteria level and simply add the SelectionCriteria attributes ?
> 
> 
> It's true that it is redundant to have instvars of m_alias and 
> m_aliasPath at both the Criteria and SelectionCriteria levels.  There 
> can only be one UserAlias per Criteria, no matter how many 
> SelectionCriteria are associated with it.  So I would agree to put it at 
> the Criteria level only.  There are calls to UserAlias methods of 
> SelectionCriteria object (e.g. SqlQueryStatement#appendSQLClause(...)) 
> so perhaps these methods should remain at the SelectionCriteria level, 
> but delegate their work to their Criteria object.
> 
> Instead of delegating to SelectionCriteria#setAlias(String alias), 
> Criteria#setAlias(String alias) can get the attributes it needs 
> directly, something like:
> 
> // propagate to SelectionCriteria,not to Criteria
> for (int i = 0; i < m_criteria.size(); i++)
> {
>     if (!(m_criteria.elementAt(i) instanceof Criteria))
>     {
>         String attributePath = 
> ((String)((SelectionCriteria)                  
> m_criteria.elementAt(i)).getAttribute()));
>         boolean allPathsAliased = true;
>         m_userAlias = new UserAlias(alias, 
> attributePath,                         allPathsAliased);   
>     }
> }
> 
> The original assumption behind this method, i.e. that the 
> SelectionCriteria have been added to the Criteria before setAlias is 
> called, still holds.
> 
> Hope this helps,
> 
> Phil
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message