Are you still having problem with this?

If so, can you send in the whole testcase?

Cheers

On Tue, May 12, 2009 at 7:53 AM, Aye <[email protected]> wrote:
> Please bear with me on this; I'm going back to my human resources example 
> here:
>
> @Mixins({ HumanResourceMixin.class })
> public interface HumanResource {
>    ManyAssociation<Position> positions();
>    Position createPosition(String name);
>    void deletePosition(Position position);
> }
>
> public abstract class HumanResourceMixin implements HumanResource {
>
>   �...@structure
>    private ValueBuilderFactory vbf;
>
>   �...@structure
>    private UnitOfWorkFactory uowf;
>
>   �...@this
>    HumanResource humanResource;
>
>    public Position createPosition(String name) {
>        final UnitOfWork uow = uowf.currentUnitOfWork();
>        final EntityBuilder<Position> positionBuilder =
> uow.newEntityBuilder(Position.class);
>        final Position prototype = positionBuilder.prototype();
>        prototype.title().set(name);
>        final Position position = positionBuilder.newInstance();
>        humanResource.positions().add(positions().count(), position);
>        return position;
>    }
>
>    public void deletePosition(Position position) {
>
>    }
> }
>
> @Mixins({ EmployerMixin.class })
> public interface CompanyEntity
>        extends Company, Employer, HumanResource, EntityComposite {
> }
>
>
> In my test, I can essentially create a new CompanyEntity and is able
> to add a new position manually (using pretty much the same code thats
> in the createPosition() method above) to the new company entity but I
> would prefer to keep this "create position" behavior in the domain
> entity so I try to use the createPosition() above and I get an
> abstract method error for the humanResource.positions() method call.
> It seems like the ManyAssociationMixin is not kicking in here and the
> method implementation is not there.
>  The test code looks something like this:
>
> final EntityBuilder<CompanyEntity> builder =
> unitOfWork.newEntityBuilder(CompanyEntity.class);
> final CompanyEntity prototype = builder.prototypeFor(CompanyEntity.class);
> prototype.name().set("Acme Fireworks");
> final CompanyEntity acmeCompany = builder.newInstance();
> acmeCompany.createPosition("CEO");
>
> So what glaring error am I missing again?!
> Thanks guys!
> Aye
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>



-- 
Niclas Hedhman, Software Developer
http://www.qi4j.org - New Energy for Java

I  live here; http://tinyurl.com/2qq9er
I  work here; http://tinyurl.com/2ymelc
I relax here; http://tinyurl.com/2cgsug

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to