I'm embarrassed :P I just had bad testing code. I was calling a command method on the prototype CompanyEntity object instead of the actual entity object. Now everything seems peachy.
On Sat, May 9, 2009 at 8:52 AM, Aye <[email protected]> wrote: > You're right Rickard. I'm constructing a company entity that looks > something like this (the Company interface is a simple one with just > the name while Employer and HumanResources handle different > responsibilities such as hire/fire and create/remove Positions): > > @Mixins({ EmployerMixin.class }) > public interface CompanyEntity > extends Company, Employer, HumanResources, EntityComposite { > } > > > I moved the implementing HumanResourcesMixin into the HumanResources > interface itself instead of being in the CompanyEntity above. Still no > dice and getting NPE when accessing listProperty variable below. It > seems like the HumanResourceState is not getting initialized? > Eventually I want to expose the positions at the HumanResources > interface also (e.g. the gui would need to know what positions are > existing in a company for a lookup list). > > @Mixins({HumanResources.HumanResourcesMixin.class, > HumanResources.HumanResourceState.class}) > public interface HumanResources { > > interface HumanResourceState { > �...@usedefaults > Property<List<Position>> positions(); > } > > Position createPosition(String name); > > void deletePosition(Position position); > > public class HumanResourcesMixin implements HumanResources { > > �...@structure > private ValueBuilderFactory vbf; > > �...@this HumanResourceState state; > > public Position createPosition(String name) { > > final ValueBuilder<Position> builder = > vbf.newValueBuilder(Position.class); > final Position prototype = builder.prototype(); > prototype.title().set(name); > > final Position position = builder.newInstance(); > final Property<List<Position>> listProperty = state.positions(); > listProperty.get().add(position); > return position; > } > > public void deletePosition(Position position) { > > } > } > > } > Thanks again! > > /Aye > _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

