lib/converters/parsedJDLToJDLObject/application_converter.js
/**
 * Converts parsed applications to JDL applications.
 * @param {Array<Object>} parsedApplications - the parsed applications.
 * @param {Object} configuration - a configuration object.
 * @param {String} configuration.generatorVersion - the generator's version to use when converting applications.
 * @param {Number} configuration.creationTimestamp - a creation timestamp to use for entities.
 * @param {Array<String>} entityNames - the entity names.
 * @return {Array} the converted JDL applications.
 */
Converts parsed applications to JDL applications.
@param {Array} parsedApplications - the parsed applications.
@param {Object} configuration - a configuration object.
@param {String} configuration.generatorVersion - the generator's version to use when converting applications.
@param {Number} configuration.creationTimestamp - a creation timestamp to use for entities.
@param {Array} entityNames - the entity names.
@return {Array} the converted JDL applications.
Converts parsed applications to JDL applications . @param { Array } parsedApplications - the parsed applications . @param { Object } configuration - a configuration object . @param { String } configuration . generatorVersion - the generator ' s version to use when converting applications . @param { Number } configuration . creationTimestamp - a creation timestamp to use for entities . @param { Array } entityNames - the entity names . @return { Array } the converted JDL applications .
function convertApplications(parsedApplications, configuration = {}, entityNames = []) {
  if (!parsedApplications) {
    throw new Error('Applications have to be passed so as to be converted.');
  }
  return parsedApplications.map(parsedApplication => {
    const applicationWithCustomValues = addCustomValuesToApplication(parsedApplication, configuration);
    const applicationEntityNames = resolveApplicationEntityNames(parsedApplication, entityNames);
    const jdlApplication = createJDLApplication(applicationWithCustomValues.config);
    jdlApplication.addEntityNames(applicationEntityNames);
    const entityOptions = getEntityOptionsInApplication(parsedApplication);
    checkEntityNamesInOptions(
      jdlApplication.getConfigurationOptionValue('baseName'),
      entityOptions,
      applicationEntityNames
    );
    entityOptions.forEach(option => jdlApplication.addOption(option));
    return jdlApplication;
  });
}
function convertApplications ( parsedApplications , configuration = { } , entityNames = [ ] ) { if ( ! parsedApplications ) { throw new Error ( 'Applications have to be passed so as to be converted.' ) ; } return parsedApplications . map ( parsedApplication => { const applicationWithCustomValues = addCustomValuesToApplication ( parsedApplication , configuration ) ; const applicationEntityNames = resolveApplicationEntityNames ( parsedApplication , entityNames ) ; const jdlApplication = createJDLApplication ( applicationWithCustomValues . config ) ; jdlApplication . addEntityNames ( applicationEntityNames ) ; const entityOptions = getEntityOptionsInApplication ( parsedApplication ) ; checkEntityNamesInOptions ( jdlApplication . getConfigurationOptionValue ( 'baseName' ) , entityOptions , applicationEntityNames ) ; entityOptions . forEach ( option => jdlApplication . addOption ( option ) ) ; return jdlApplication ; } ) ; }
Converts parsed applications to JDL applications.
Converts parsed applications to JDL applications .