Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
vertigo - simple java starter Copyright (C) 2013, KleeGroup, direction.technique@kleegroup.com (http://www.kleegroup.com) KleeGroup, Centre d'affaire la Boursidiere - BP 159 - 92357 Le Plessis Robinson Cedex - France Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package io.vertigo.studio.plugins.mda.domain;
Generate crebas.sql

Author(s):
pchretien
	private final boolean generateDrop;
	private final String baseCible;

Constructeur.

Parameters:
generateDrop Si on génère les Drop table dans le fichier SQL
baseCible Type de base de données ciblé.
			@Named("generateDrop"final boolean generateDrop,
			@Named("baseCible"final String baseCible) {
		// ---------------------------------------------------------------------
		this. = generateDrop;
		this. = baseCible;
	}

	public DomainConfiguration createConfiguration(final Properties properties) {
		return new DomainConfiguration(properties);
	}

	public void generate(final DomainConfiguration domainConfigurationfinal ResultBuilder resultBuilder) {
		Assertion.checkNotNull(domainConfiguration);
		Assertion.checkNotNull(resultBuilder);
		// ---------------------------------------------------------------------
		generateSql(domainConfigurationresultBuilder);
	}
	private void generateSql(final DomainConfiguration domainConfigurationfinal ResultBuilder resultBuilder) {
		final List<TemplateDtDefinitionlist = new ArrayList<>(DomainUtil.getDtDefinitions().size());
		for (final DtDefinition dtDefinition : DomainUtil.sortAbsoluteDefinitionCollection(DomainUtil.getDtDefinitions())) {
			final TemplateDtDefinition templateDef = new TemplateDtDefinition(dtDefinition);
			list.add(templateDef);
		}
		final Map<StringObjectmapRoot = new MapBuilder<StringObject>()
				.put("sql"new TemplateMethodSql())
				.put("dtDefinitions"list)
				.put("associations", DomainUtil.getAssociations())
				.put("drop")
				// Ne sert actuellement à rien, le sql généré étant le même. Prévu pour le futur
				.put("basecible")
				// Oracle limite le nom des entités (index) à 30 charactères. Il faut alors tronquer les noms composés.
				.put("truncateNames" == "Oracle")
				.build();
		createFileGenerator(domainConfigurationmapRoot"crebas""sqlgen"".sql""templates/sql.ftl")
				.generateFile(resultBuilder);
	}
New to GrepCode? Check out our FAQ X