use of io.vertigo.dynamo.domain.metamodel.association.DtListURIForSimpleAssociation in project vertigo by KleeGroup.
the class DtObjectUtil method createDtListURIForSimpleAssociation.
/**
* Récupération d'une URI de Collection à partir d'un dto
* @param entity the entity
* @param associationDefinitionName Nom de l'association
* @param roleName Nom du role
* @return URI de la collection référencée.
*/
public static DtListURIForSimpleAssociation createDtListURIForSimpleAssociation(final Entity entity, final String associationDefinitionName, final String roleName) {
Assertion.checkNotNull(associationDefinitionName);
Assertion.checkNotNull(roleName);
Assertion.checkNotNull(entity);
// -----
final AssociationSimpleDefinition associationDefinition = Home.getApp().getDefinitionSpace().resolve(associationDefinitionName, AssociationSimpleDefinition.class);
return new DtListURIForSimpleAssociation(associationDefinition, entity.getURI(), roleName);
}
use of io.vertigo.dynamo.domain.metamodel.association.DtListURIForSimpleAssociation in project vertigo by KleeGroup.
the class StoreAccountStorePlugin method getAccountURIs.
/**
* {@inheritDoc}
*/
@Override
public Set<URI<Account>> getAccountURIs(final URI<AccountGroup> groupURI) {
final DtListURI userDtListURI;
if (associationUserGroup instanceof AssociationSimpleDefinition) {
userDtListURI = new DtListURIForSimpleAssociation((AssociationSimpleDefinition) associationUserGroup, groupURI, associationUserRoleName);
} else {
// autres cas éliminés par assertion dans le postStart
Assertion.checkArgument(associationUserGroup instanceof AssociationNNDefinition, "Association ({0}) between User and Group must be an AssociationSimpleDefinition or an AssociationNNDefinition", associationUserGroup.getName());
userDtListURI = new DtListURIForNNAssociation((AssociationNNDefinition) associationUserGroup, groupURI, associationUserRoleName);
}
// -----
final DtList<? extends Entity> result = Home.getApp().getComponentSpace().resolve(StoreManager.class).getDataStore().findAll(userDtListURI);
return result.stream().map(userEntity -> userToAccount(userEntity).getURI()).collect(Collectors.toSet());
}
Aggregations