ok,
i don't use the controller classes this time, so I could see the factory
usage there.
Because I need the factory also in the gap class RepositoryXXXImpl, we
should make a getFactory() method in RepositoryImplBase.
regards
Patrik Nordwall schrieb:
> What is the benefit to do it via the repository, when it only delegates to
> the factory anyway?
>
> In DDD book it is described that Repository and Factory have different
> responsibilities. We could sure do it through delegation via repository, if
> it simplifies or makes things more beautiful, but I'm not totally convinced
> that it will.
>
> Note that the factories also are used by abstract controller classes in the
> framework also. If done via repository we must introduce some repository
> interface with the create method in the framework also.
>
> /Patrik
>
>
>
> Steffen Stundzig wrote:
>> Hi,
>>
>> what Do you think about a single point of rich object creation in the
>> appropriate object repository like:
>>
>> RichPersonRepositoryImplBase:
>>
>> public RichPerson createFrom(Person domain) {
>> RichPerson richPerson = richPersonFactory.create();
>> richPerson.fromModel(domain);
>> return richPerson;
>> }
>>
>> So we have one single method to create objects, which could be used
>> e.g. from RichPersonRepositoryImpl to transform person objects retrieved
>> from other PersonService methods without the need to get/inject the
>> personFactory.
>>
>> In the referenced rich objects, which contains reference holder like:
>>
>> public RichPerson getCaller() {
>> if (callerHolder != null) {
>> return callerHolder.get();
>> }
>>
>> populate();
>> callerHolder = new AtomicReference<RichPerson>();
>> if (populated != null) {
>> if (populated.getCaller() != null) {
>> callerHolder.set(richCallerFactory.create());
>> callerHolder.get().fromModel(populated.getCaller());
>> }
>> }
>> return callerHolder.get();
>> }
>>
>> this could be changed to call the createFromModel()-method. Therefore we
>> must inject repositories into other repositories, which is more
>> symmetric to the backend stuff.
>>
>> What do you think of it?
>>
>> regards
>>
>> ------------------------------------------------------------------------------
>> Check out the new SourceForge.net Marketplace.
>> It is the best place to buy or sell services for
>> just about anything Open Source.
>> http://p.sf.net/sfu/Xq1LFB
>> _______________________________________________
>> Fornax-developer mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/fornax-developer
>>
>>
>
--
Steffen Stundzig
Telefon: +49 (0) 341 / 231-0183-401
Telefax: +49 (0) 341 / 231-0183-411
Mobil: +49 (0) 151 / 173-9673-1 (!neu)
http://itemis.de
[email protected]
https://www.xing.com/profile/Steffen_Stundzig
itemis AG
Niederlassung Leipzig
Ludwig-Erhard-Straße 51
04103 Leipzig
Rechtlicher Hinweis:
Registergericht: Amtsgericht Dortmund HRB 20621
Sitz der Gesellschaft: 44536 Lünen, Am Brambusch 15-24
Vorstand: Wolfgang Neuhaus, Jens Wagener, Dr. Georg Pietrek
Aufsichtsrat: Prof. Dr. Burkhard Igel (Vorsitzender), Stephan Grollmann,
Michael Neuhaus
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Fornax-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fornax-developer