All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.joinedworkz.common.SchemaCartridge.xtend Maven / Gradle / Ivy

package org.joinedworkz.common

import org.joinedworkz.common.generator.CmnSchemaGenerator
import org.joinedworkz.common.helper.CmnModelHelper
import org.joinedworkz.core.facility.AbstractCartridge
import org.joinedworkz.core.facility.Outlet
import org.joinedworkz.core.facility.Outlets
import org.joinedworkz.core.model.CmnModel
import org.joinedworkz.core.model.CmnObject
import javax.inject.Singleton
import javax.inject.Inject
import org.joinedworkz.common.helper.GeneratorHelper

@Singleton
class SchemaCartridge extends AbstractCartridge {
	
    @Inject
    protected CmnModelHelper cmnModelHelper
    
    @Inject
    protected GeneratorHelper generatorHelper
	
	override void apply(CmnObject obj, Outlets outlets) {
		val schemaOutlet = outlets.get("generatedSchema")
		
		if (obj instanceof CmnModel) {
			obj.generateSchema(schemaOutlet)
		}
	}

	def void generateSchema(CmnModel model,Outlet schemaOutlet) {
		new CmnSchemaGenerator(model, schemaOutlet, cmnModelHelper, generatorHelper).generateSchema();
	}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy