Package org.apache.cayenne.gen

Examples of org.apache.cayenne.gen.ClassGenerationAction


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

    ClassGenerationAction action;
    if (client) {
      action = new ClientClassGenerationAction();
    } else if (ClassGenerator.VERSION_1_1.equals(version)) {
      action = new ClassGenerationAction1_1();
    } 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


    public void cancelAction() {
        view.dispose();
    }

    public void generateAction() {
        ClassGenerationAction generator = generatorSelector.getGenerator();

        if (generator != null) {
            try {
                generator.execute();
                JOptionPane.showMessageDialog(
                        this.getView(),
                        "Class generation finished");
            }
            catch (Exception e) {
View Full Code Here

        return view;
    }

    @Override
    protected ClassGenerationAction newGenerator() {
        return new ClassGenerationAction();
    }
View Full Code Here

    public ClassGenerationAction createGenerator() {

        mode = modesByLabel.get(view.getGenerationMode().getSelectedItem()).toString();

        ClassGenerationAction generator = super.createGenerator();

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

        String subKey = view.getSubclassTemplate().getSelectedItem().toString();
        String subTemplate = templateManager.getTemplatePath(subKey);
        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

        return view;
    }
   
    @Override
    protected ClassGenerationAction newGenerator() {
        return new ClassGenerationAction();
    }
View Full Code Here

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

    protected ClassGenerationAction createGeneratorAction() {
        ClassGenerationAction action;
        if (client) {
            action = new ClientClassGenerationAction();
            action.setContext(getVppContext());
        }
        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

            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());

        Preferences preferences = application.getPreferencesNode(
                GeneralPreferences.class,
                "");

        if (preferences != null) {
            generator.setEncoding(preferences.get(
                    GeneralPreferences.ENCODING_PREFERENCE,
                    null));
        }

        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

    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

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.