Search in sources :

Example 1 with Assertion

use of io.vertigo.lang.Assertion 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());
}
Also used : AbstractAccountStorePlugin(io.vertigo.account.plugins.account.store.AbstractAccountStorePlugin) DtListURIForNNAssociation(io.vertigo.dynamo.domain.metamodel.association.DtListURIForNNAssociation) DtField(io.vertigo.dynamo.domain.metamodel.DtField) URI(io.vertigo.dynamo.domain.model.URI) Criteria(io.vertigo.dynamo.criteria.Criteria) Inject(javax.inject.Inject) Home(io.vertigo.app.Home) StoreManager(io.vertigo.dynamo.store.StoreManager) Criterions(io.vertigo.dynamo.criteria.Criterions) DtListURIForSimpleAssociation(io.vertigo.dynamo.domain.metamodel.association.DtListURIForSimpleAssociation) Assertion(io.vertigo.lang.Assertion) AssociationNNDefinition(io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition) Named(javax.inject.Named) AccountMapperHelper(io.vertigo.account.impl.account.AccountMapperHelper) AccountGroup(io.vertigo.account.account.AccountGroup) DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) Set(java.util.Set) DtListURI(io.vertigo.dynamo.domain.model.DtListURI) DtList(io.vertigo.dynamo.domain.model.DtList) Collectors(java.util.stream.Collectors) VFile(io.vertigo.dynamo.file.model.VFile) AccountStorePlugin(io.vertigo.account.impl.account.AccountStorePlugin) Entity(io.vertigo.dynamo.domain.model.Entity) AssociationSimpleDefinition(io.vertigo.dynamo.domain.metamodel.association.AssociationSimpleDefinition) Account(io.vertigo.account.account.Account) AssociationDefinition(io.vertigo.dynamo.domain.metamodel.association.AssociationDefinition) Optional(java.util.Optional) Collections(java.util.Collections) DtListURI(io.vertigo.dynamo.domain.model.DtListURI) DtListURIForNNAssociation(io.vertigo.dynamo.domain.metamodel.association.DtListURIForNNAssociation) AssociationSimpleDefinition(io.vertigo.dynamo.domain.metamodel.association.AssociationSimpleDefinition) DtListURIForSimpleAssociation(io.vertigo.dynamo.domain.metamodel.association.DtListURIForSimpleAssociation) AssociationNNDefinition(io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition)

Aggregations

Account (io.vertigo.account.account.Account)1 AccountGroup (io.vertigo.account.account.AccountGroup)1 AccountMapperHelper (io.vertigo.account.impl.account.AccountMapperHelper)1 AccountStorePlugin (io.vertigo.account.impl.account.AccountStorePlugin)1 AbstractAccountStorePlugin (io.vertigo.account.plugins.account.store.AbstractAccountStorePlugin)1 Home (io.vertigo.app.Home)1 Criteria (io.vertigo.dynamo.criteria.Criteria)1 Criterions (io.vertigo.dynamo.criteria.Criterions)1 DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)1 DtField (io.vertigo.dynamo.domain.metamodel.DtField)1 AssociationDefinition (io.vertigo.dynamo.domain.metamodel.association.AssociationDefinition)1 AssociationNNDefinition (io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition)1 AssociationSimpleDefinition (io.vertigo.dynamo.domain.metamodel.association.AssociationSimpleDefinition)1 DtListURIForNNAssociation (io.vertigo.dynamo.domain.metamodel.association.DtListURIForNNAssociation)1 DtListURIForSimpleAssociation (io.vertigo.dynamo.domain.metamodel.association.DtListURIForSimpleAssociation)1 DtList (io.vertigo.dynamo.domain.model.DtList)1 DtListURI (io.vertigo.dynamo.domain.model.DtListURI)1 Entity (io.vertigo.dynamo.domain.model.Entity)1 URI (io.vertigo.dynamo.domain.model.URI)1 VFile (io.vertigo.dynamo.file.model.VFile)1