Package org.apache.cayenne.gen

Examples of org.apache.cayenne.gen.ClassGenerationAction


        initializeVppConfig();
        return vppConfig.getVelocityContext();
    }

    protected ClassGenerationAction createGeneratorAction() {
        ClassGenerationAction action;
        if (client) {
            action = new ClientClassGenerationAction();
            action.setContext(getVppContext());
        }
        else if (ClassGenerator.VERSION_1_1.equals(version)) {
            action = new ClassGenerationAction1_1();
        }
        else {
            action = new ClassGenerationAction();
            action.setContext(getVppContext());
        }

        action.setDestDir(destDir);
        action.setEncoding(encoding);
        action.setMakePairs(makepairs);
        action.setArtifactsGenerationMode(mode);
        action.setOutputPattern(outputPattern);
        action.setOverwrite(overwrite);
        action.setSuperPkg(superpkg);
        action.setSuperTemplate(supertemplate);
        action.setTemplate(template);
        action.setEmbeddableSuperTemplate(embeddablesupertemplate);
        action.setEmbeddableTemplate(embeddabletemplate);
        action.setUsePkgPath(usepkgpath);

        return action;
    }
View Full Code Here


        try {

            DataMap dataMap = loadAction.getMainDataMap();

            ClassGenerationAction generatorAction = createGeneratorAction();
            generatorAction.setLogger(logger);
            generatorAction.setTimestamp(map.lastModified());
            generatorAction.setDataMap(dataMap);
            generatorAction.addEntities(filterAction.getFilteredEntities(dataMap));
            generatorAction.addEmbeddables(filterAction.getFilteredEmbeddables(dataMap));
            generatorAction.addQueries(dataMap.getQueries());
            generatorAction.execute();
        }
        catch (Exception e) {
            throw new BuildException(e);
        }
    }
View Full Code Here

        initializeVppConfig();
        return vppConfig.getVelocityContext();
    }

    protected ClassGenerationAction createGeneratorAction() {
        ClassGenerationAction action;
        if (client) {
            action = new ClientClassGenerationAction();
            action.setContext(getVppContext());
        }
        else if (ClassGenerator.VERSION_1_1.equals(version)) {
            action = new ClassGenerationAction1_1();
        }
        else {
            action = new ClassGenerationAction();
            action.setContext(getVppContext());
        }

        action.setDestDir(destDir);
        action.setEncoding(encoding);
        action.setMakePairs(makepairs);
        action.setArtifactsGenerationMode(mode);
        action.setOutputPattern(outputPattern);
        action.setOverwrite(overwrite);
        action.setSuperPkg(superpkg);
        action.setSuperTemplate(supertemplate);
        action.setTemplate(template);
        action.setEmbeddableSuperTemplate(embeddablesupertemplate);
        action.setEmbeddableTemplate(embeddabletemplate);
        action.setUsePkgPath(usepkgpath);

        return action;
    }
View Full Code Here

        try {

            DataMap dataMap = loadAction.getMainDataMap();

            ClassGenerationAction generatorAction = createGeneratorAction();
            generatorAction.setLogger(logger);
            generatorAction.setTimestamp(map.lastModified());
            generatorAction.setDataMap(dataMap);
            generatorAction.addEntities(filterAction.getFilteredEntities(dataMap));
            generatorAction.addEmbeddables(filterAction.getFilteredEmbeddables(dataMap));
            generatorAction.execute();
        }
        catch (Exception e) {
            throw new BuildException(e);
        }
    }
View Full Code Here

    try {
      loaderAction.setAdditionalDataMapFiles(convertAdditionalDataMaps());

      DataMap dataMap = loaderAction.getMainDataMap();

      ClassGenerationAction generator = createGenerator();
      generator.setLogger(logger);
      generator.setTimestamp(map.lastModified());
      generator.setDataMap(dataMap);
      generator.addEntities(filterAction.getFilteredEntities(dataMap));
      //ksenia khailenko 15.10.2010
      //TODO add the "includeEmbeddables" and "excludeEmbeddables" attributes
      generator.addEmbeddables(dataMap.getEmbeddables());
      //TODO add the "includeQueries" and "excludeQueries" attributes
      generator.addQueries(dataMap.getQueries());
      generator.execute();
    } catch (Exception e) {
      throw new MojoExecutionException("Error generating classes: ", e);
    }
  }
View Full Code Here

   * Factory method to create internal class generator. Called from
   * constructor.
   */
  protected ClassGenerationAction createGenerator() {

    ClassGenerationAction action;
    if (client) {
      action = new ClientClassGenerationAction();
    } else {
      action = new ClassGenerationAction();
    }

    action.setDestDir(destDir);
    action.setEncoding(encoding);
    action.setMakePairs(makePairs);
    action.setArtifactsGenerationMode(mode);
    action.setOutputPattern(outputPattern);
    action.setOverwrite(overwrite);
    action.setSuperPkg(superPkg);
    action.setSuperTemplate(superTemplate);
    action.setTemplate(template);
    action.setEmbeddableSuperTemplate(embeddableSuperTemplate);
    action.setEmbeddableTemplate(embeddableTemplate);
    action.setUsePkgPath(usePkgPath);

    return action;
  }
View Full Code Here

            if (it.next().isGeneric()) {
                it.remove();
            }
        }

        ClassGenerationAction generator = newGenerator();
        generator.setArtifactsGenerationMode(mode);
        generator.setDataMap(getParentController().getDataMap());
        generator.addEntities(entities);
        generator.addEmbeddables(getParentController().getSelectedEmbeddables());
        generator.addQueries(getParentController().getDataMap().getQueries());

        // configure encoding from preferences
        Domain generatorPrefs = Application
                .getInstance()
                .getPreferenceDomain()
                .getSubdomain(ClassGenerationAction.class);

        PreferenceDetail detail = generatorPrefs.getDetail(
                GeneralPreferences.ENCODING_PREFERENCE,
                false);
        if (detail != null) {
            generator.setEncoding(detail
                    .getProperty(GeneralPreferences.ENCODING_PREFERENCE));
        }

        generator.setDestDir(outputDir);
        generator.setMakePairs(true);

        String superPackage = ((GeneratorControllerPanel) getView())
                .getSuperclassPackage()
                .getText();
        if (!Util.isEmptyString(superPackage)) {
            generator.setSuperPkg(superPackage);
        }

        return generator;
    }
View Full Code Here

    @Override
    protected ClassGenerationAction newGenerator() {
        return ClassGenerator.VERSION_1_1.equals(getVersion())
                ? new ClassGenerationAction1_1()
                : new ClassGenerationAction();
    }
View Full Code Here

        mode = modesByLabel
                .get(view.getGenerationMode().getSelectedItem())
                .toString();
       
        ClassGenerationAction generator = super.createGenerator();

        String version = getVersion();

        String superKey = view.getSuperclassTemplate().getSelectedItem().toString();
        String superTemplate = templateManager.getTemplatePath(superKey, version);
        generator.setSuperTemplate(superTemplate);

        String subKey = view.getSubclassTemplate().getSelectedItem().toString();
        String subTemplate = templateManager.getTemplatePath(subKey, version);
        generator.setTemplate(subTemplate);

        generator.setOverwrite(view.getOverwrite().isSelected());
        generator.setUsePkgPath(view.getUsePackagePath().isSelected());
        generator.setMakePairs(view.getPairs().isSelected());

        if (!Util.isEmptyString(view.getOutputPattern().getText())) {
            generator.setOutputPattern(view.getOutputPattern().getText());
        }

        return generator;
    }
View Full Code Here

    try {
      loaderAction.setAdditionalDataMapFiles(convertAdditionalDataMaps());

      DataMap dataMap = loaderAction.getMainDataMap();

      ClassGenerationAction generator = createGenerator();
      generator.setLogger(logger);
      generator.setTimestamp(map.lastModified());
      generator.setDataMap(dataMap);
      generator.addEntities(filterAction.getFilteredEntities(dataMap));
      //ksenia khailenko 15.10.2010
      //TODO add the "includeEmbeddables" and "excludeEmbeddables" attributes
      generator.addEmbeddables(dataMap.getEmbeddables());
      //TODO add the "includeQueries" and "excludeQueries" attributes
      generator.addQueries(dataMap.getQueries());
      generator.execute();
    } catch (Exception e) {
      throw new MojoExecutionException("Error generating classes: ", e);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.cayenne.gen.ClassGenerationAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.