lib/helpers/association_helper.js
function checkValidityOfAssociation(association, sourceName, destinationName) {
  if (!association || !association.type) {
    throw new BuildException(
      exceptions.NullPointer, 'The association must not be nil.');
  }
  switch (association.type) {
  case cardinalities.ONE_TO_ONE:
    checkOneToOne(association, sourceName, destinationName);
    break;
  case cardinalities.ONE_TO_MANY:
    checkOneToMany(association, sourceName, destinationName);
    break;
  case cardinalities.MANY_TO_ONE:
    checkManyToOne(association, sourceName, destinationName);
    break;
  case cardinalities.MANY_TO_MANY:
    checkManyToMany(association, sourceName, destinationName);
    break;
  default:
    throw new BuildException(
      exceptions.WrongAssociation,
      `The association type ${association.type} isn't supported.`);
  }
}
function checkValidityOfAssociation(association, sourceName, destinationName) {
  if (!association || !association.type) {
    throw new BuildException(
      exceptions.NullPointer, 'The association must not be nil.');
  }
  switch (association.type) {
  case cardinalities.ONE_TO_ONE:
    checkOneToOne(association, sourceName, destinationName);
    break;
  case cardinalities.ONE_TO_MANY:
    checkOneToMany(association, sourceName, destinationName);
    break;
  case cardinalities.MANY_TO_ONE:
    checkManyToOne(association, sourceName, destinationName);
    break;
  case cardinalities.MANY_TO_MANY:
    checkManyToMany(association, sourceName, destinationName);
    break;
  default:
    throw new BuildException(
      exceptions.WrongAssociation,
      `The association type ${association.type} isn't supported.`);
  }
}
function checkValidityOfAssociation ( association , sourceName , destinationName ) { if ( ! association || ! association . type ) { throw new BuildException ( exceptions . NullPointer , 'The association must not be nil.' ) ; } switch ( association . type ) { case cardinalities . ONE_TO_ONE : checkOneToOne ( association , sourceName , destinationName ) ; break ; case cardinalities . ONE_TO_MANY : checkOneToMany ( association , sourceName , destinationName ) ; break ; case cardinalities . MANY_TO_ONE : checkManyToOne ( association , sourceName , destinationName ) ; break ; case cardinalities . MANY_TO_MANY : checkManyToMany ( association , sourceName , destinationName ) ; break ; default : throw new BuildException ( exceptions . WrongAssociation , ` ${ association . type } ` ) ; } }
Checks the validity of the association.
@param {AssociationData} association the association to check.
@param {String} sourceName the source's name.
@param {String} destinationName the destination's name.
@throws NullPointerException if the association is nil.
@throws AssociationException if the association is invalid.
Checks the validity of the association .