Better support for "Entity Local" identities
--------------------------------------------
Key: QI-301
URL: http://issues.ops4j.org/browse/QI-301
Project: Qi4j
Issue Type: New Feature
Components: API, Core Runtime
Affects Versions: 1.2
Reporter: Niclas Hedhman
Assignee: Rickard Öberg
Currently it is possible to have design time defined "local identities" for
referenced entities, simply as;
public interface Car
{
Association<Tyre> frontRightTyre();
}
But if the list is not known at design time, things quickly becomes more
troublesome (and potentially slower, depending on how one approaches it). One
can either do a ManyAssociation;
public interface Family
{
ManyAssociation<Child> kids();
}
and loop through, but if the numbers get very large one needs to start mangling
with Identity composition
public interface CompanyDivision
{
Property<Map<String,String>> employees();
}
where first String of local identity (within the company) maps to a global
Identity of some non-obvious type. There is also the choice of using Query, but
that kills performance in a big way.
I come across this on every front right now, and not happy with the Identity
mangling approach, and would like to call for direct support in Qi4j.
Proposal;
public interface CompanyDivision
{
KeydAssociation<Employee> employees();
}
public interface KeydAssociation<T> extends Iterable<T>, AbstractAssociation
{
void put( String key, T entity );
T get( String key );
int count();
boolean containsKey( String key );
boolean contains( T entity );
Map<String, T> toMap();
}
This should then be supported at EntityStore level as well, similarly to
ManyAssociation.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.ops4j.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev