Search in sources :

Example 21 with AssociationNNDefinition

use of io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition in project vertigo by KleeGroup.

the class OOMParserTest method testAssoctationAnBnv.

/**
 * Test d'une relation An - Bnv.
 */
@Test
public void testAssoctationAnBnv() {
    final AssociationNNDefinition association = getAssociationNNDefinition("ANN_CHA_CHI_7");
    /* "0..*" */
    Assert.assertTrue(association.getAssociationNodeA().isMultiple());
    Assert.assertFalse(association.getAssociationNodeA().isNotNull());
    /* "0..*" */
    Assert.assertTrue(association.getAssociationNodeB().isMultiple());
    Assert.assertFalse(association.getAssociationNodeB().isNotNull());
    Assert.assertEquals("R7A", association.getAssociationNodeA().getRole());
    Assert.assertEquals("R7B", association.getAssociationNodeB().getRole());
    Assert.assertFalse(association.getAssociationNodeA().isNavigable());
    Assert.assertTrue(association.getAssociationNodeB().isNavigable());
}
Also used : AssociationNNDefinition(io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition) Test(org.junit.Test)

Example 22 with AssociationNNDefinition

use of io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition in project vertigo by KleeGroup.

the class OOMParserTest method testAssoctationAnBn.

/**
 * Test d'une relation An - Bn.
 */
@Test
public void testAssoctationAnBn() {
    final AssociationNNDefinition association = getAssociationNNDefinition("ANN_CHA_CHI_9");
    /* "0..*" */
    Assert.assertTrue(association.getAssociationNodeA().isMultiple());
    Assert.assertFalse(association.getAssociationNodeA().isNotNull());
    /* "0..*" */
    Assert.assertTrue(association.getAssociationNodeB().isMultiple());
    Assert.assertFalse(association.getAssociationNodeB().isNotNull());
    Assert.assertEquals("R9A", association.getAssociationNodeA().getRole());
    Assert.assertEquals("R9B", association.getAssociationNodeB().getRole());
    Assert.assertFalse(association.getAssociationNodeA().isNavigable());
    Assert.assertFalse(association.getAssociationNodeB().isNavigable());
}
Also used : AssociationNNDefinition(io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition) Test(org.junit.Test)

Example 23 with AssociationNNDefinition

use of io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition in project vertigo by KleeGroup.

the class EAXmiTestParserAA method testAssoctationAnBn.

/**
 * Test d'une relation An - Bn.
 */
@Test
public void testAssoctationAnBn() {
    final AssociationNNDefinition association = getAssociationNNDefinition("ANN_CHI_CHI_9");
    /* "0..*" */
    Assert.assertTrue(association.getAssociationNodeA().isMultiple());
    Assert.assertFalse(association.getAssociationNodeA().isNotNull());
    /* "0..*" */
    Assert.assertTrue(association.getAssociationNodeB().isMultiple());
    Assert.assertFalse(association.getAssociationNodeB().isNotNull());
    Assert.assertEquals("R9A", association.getAssociationNodeA().getRole());
    Assert.assertEquals("R9B", association.getAssociationNodeB().getRole());
    Assert.assertFalse(association.getAssociationNodeA().isNavigable());
    Assert.assertFalse(association.getAssociationNodeB().isNavigable());
}
Also used : AssociationNNDefinition(io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition) Test(org.junit.Test)

Example 24 with AssociationNNDefinition

use of io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition in project vertigo by KleeGroup.

the class DomainDynamicRegistry method createAssociationNNDefinition.

private static AssociationNNDefinition createAssociationNNDefinition(final DefinitionSpace definitionSpace, final DslDefinition xassociation) {
    final String tableName = (String) xassociation.getPropertyValue(KspProperty.TABLE_NAME);
    final DtDefinition dtDefinitionA = definitionSpace.resolve(xassociation.getDefinitionLinkName("dtDefinitionA"), DtDefinition.class);
    final boolean navigabilityA = (Boolean) xassociation.getPropertyValue(KspProperty.NAVIGABILITY_A);
    final String roleA = (String) xassociation.getPropertyValue(KspProperty.ROLE_A);
    final String labelA = (String) xassociation.getPropertyValue(KspProperty.LABEL_A);
    final DtDefinition dtDefinitionB = definitionSpace.resolve(xassociation.getDefinitionLinkName("dtDefinitionB"), DtDefinition.class);
    final boolean navigabilityB = (Boolean) xassociation.getPropertyValue(KspProperty.NAVIGABILITY_B);
    final String roleB = (String) xassociation.getPropertyValue(KspProperty.ROLE_B);
    final String labelB = (String) xassociation.getPropertyValue(KspProperty.LABEL_B);
    final AssociationNode associationNodeA = new AssociationNode(dtDefinitionA, navigabilityA, roleA, labelA, true, false);
    final AssociationNode associationNodeB = new AssociationNode(dtDefinitionB, navigabilityB, roleB, labelB, true, false);
    final String name = fixAssociationName(ASSOCIATION_NN_DEFINITION_PREFIX, xassociation.getName());
    return new AssociationNNDefinition(name, tableName, associationNodeA, associationNodeB);
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) AssociationNode(io.vertigo.dynamo.domain.metamodel.association.AssociationNode) AssociationNNDefinition(io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition)

Example 25 with AssociationNNDefinition

use of io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition in project vertigo by KleeGroup.

the class DtObjectUtil method createDtListURIForNNAssociation.

/**
 * 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 DtListURIForNNAssociation createDtListURIForNNAssociation(final Entity entity, final String associationDefinitionName, final String roleName) {
    Assertion.checkNotNull(associationDefinitionName);
    Assertion.checkNotNull(roleName);
    Assertion.checkNotNull(entity);
    // -----
    final AssociationNNDefinition associationDefinition = Home.getApp().getDefinitionSpace().resolve(associationDefinitionName, AssociationNNDefinition.class);
    return new DtListURIForNNAssociation(associationDefinition, entity.getURI(), roleName);
}
Also used : DtListURIForNNAssociation(io.vertigo.dynamo.domain.metamodel.association.DtListURIForNNAssociation) AssociationNNDefinition(io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition)

Aggregations

AssociationNNDefinition (io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition)25 Test (org.junit.Test)16 DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)8 AssociationSimpleDefinition (io.vertigo.dynamo.domain.metamodel.association.AssociationSimpleDefinition)5 DtField (io.vertigo.dynamo.domain.metamodel.DtField)4 URI (io.vertigo.dynamo.domain.model.URI)4 AccountMapperHelper (io.vertigo.account.impl.account.AccountMapperHelper)3 AssociationDefinition (io.vertigo.dynamo.domain.metamodel.association.AssociationDefinition)3 AssociationNode (io.vertigo.dynamo.domain.metamodel.association.AssociationNode)3 DtListURIForNNAssociation (io.vertigo.dynamo.domain.metamodel.association.DtListURIForNNAssociation)3 DtList (io.vertigo.dynamo.domain.model.DtList)3 Account (io.vertigo.account.account.Account)2 AccountGroup (io.vertigo.account.account.AccountGroup)2 AccountStorePlugin (io.vertigo.account.impl.account.AccountStorePlugin)2 AbstractAccountStorePlugin (io.vertigo.account.plugins.account.store.AbstractAccountStorePlugin)2 Home (io.vertigo.app.Home)2 Criteria (io.vertigo.dynamo.criteria.Criteria)2 Criterions (io.vertigo.dynamo.criteria.Criterions)2 DtListURIForSimpleAssociation (io.vertigo.dynamo.domain.metamodel.association.DtListURIForSimpleAssociation)2 DtListURI (io.vertigo.dynamo.domain.model.DtListURI)2