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

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

There is a newer version: 1.3.46
Show newest version
package org.joinedworkz.common;

import javax.inject.Inject;
import javax.inject.Singleton;
import org.joinedworkz.common.generator.CmnSchemaGenerator;
import org.joinedworkz.common.helper.CmnModelHelper;
import org.joinedworkz.common.helper.GeneratorHelper;
import org.joinedworkz.common.helper.ScenarioHelper;
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;

@Singleton
@SuppressWarnings("all")
public class SchemaCartridge extends AbstractCartridge {
  @Inject
  protected CmnModelHelper cmnModelHelper;

  @Inject
  protected GeneratorHelper generatorHelper;

  @Inject
  protected ScenarioHelper scenarioHelper;

  @Override
  public void apply(final CmnObject obj, final Outlets outlets) {
    final Outlet schemaOutlet = outlets.get("generatedSchema");
    if ((obj instanceof CmnModel)) {
      this.generateSchema(((CmnModel)obj), schemaOutlet);
    }
  }

  public void generateSchema(final CmnModel model, final Outlet schemaOutlet) {
    new CmnSchemaGenerator(model, schemaOutlet, this.cmnModelHelper, this.generatorHelper, this.scenarioHelper).generateSchema();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy