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