Examples of POJOExporter


Examples of org.hibernate.tool.hbm2x.POJOExporter

      
     }
    
    public void testJPAGeneration() throws Exception {
      getConfiguration().buildMappings();
       POJOExporter exporter = new POJOExporter(getConfiguration(), getOutputDir());
       Properties p = new Properties();
       p.setProperty("jdk5", "true");
       p.setProperty("ejb3", "true");
      
       exporter.setProperties(p);
       exporter.start();
      
       File file = new File( "ejb3compilable" );
     file.mkdir();

     ArrayList list = new ArrayList();
View Full Code Here

Examples of org.hibernate.tool.hbm2x.POJOExporter

    assertFileAndExists( new File(getOutputDir(), "Left.hbm.xml") );
    assertFileAndExists( new File(getOutputDir(), "Right.hbm.xml") );
   
    assertEquals(7, getOutputDir().listFiles().length);
 
    POJOExporter exporter = new POJOExporter(cfg, getOutputDir() );
    exporter.setTemplatePath(new String[0]);
    exporter.getProperties().setProperty("ejb3", "false");
    exporter.getProperties().setProperty("jdk5", "false");
    exporter.start();   
   
    ArrayList list = new ArrayList();
    List jars = new ArrayList();
    //addAnnotationJars(jars);
    TestHelper.compile(
View Full Code Here

Examples of org.hibernate.tool.hbm2x.POJOExporter

  }
 
  public void testGenerateAnnotatedClassesAndReadable() throws MappingException, ClassNotFoundException, MalformedURLException {
   
    cfg.buildMappings();
    POJOExporter exporter = new POJOExporter(cfg, getOutputDir() );
    exporter.setTemplatePath(new String[0]);
    exporter.getProperties().setProperty("ejb3", "true");
    exporter.getProperties().setProperty("jdk5", "true");
    exporter.start();   
   
    assertFileAndExists( new File(getOutputDir(), "Person.java") );
    assertFileAndExists( new File(getOutputDir(), "AddressPerson.java") );
    assertFileAndExists( new File(getOutputDir(), "MultiPersonId.java") );
    assertFileAndExists( new File(getOutputDir(), "AddressMultiPerson.java") );
View Full Code Here

Examples of org.hibernate.tool.hbm2x.POJOExporter

        // add output directory to compile roots
        getProject().addCompileSourceRoot(
                new File(getComponent().getOutputDirectory()).getPath());

        // now set the extra properties for the POJO Exporter
        POJOExporter exporter = (POJOExporter) super.configureExporter(exp);

        // Add custom template path if specified
        String[] templatePaths;
        if (templateDirectory != null) {
            templatePaths = new String[exporter.getTemplatePaths().length + 1];
            templatePaths[0] = templateDirectory;
            if (exporter.getTemplatePaths().length > 1) {
                for (int i = 1; i < exporter.getTemplatePaths().length; i++) {
                    templatePaths[i] = exporter.getTemplatePaths()[i - 1];
                }
            }
        } else {
            templatePaths = exporter.getTemplatePaths();
        }

        exporter.setTemplatePath(templatePaths);
        exporter.setTemplateName("appfuse/model/Pojo.ftl");
        exporter.getProperties().setProperty("basepackage",
                getProject().getGroupId());
        exporter.getProperties().setProperty("ejb3",
                getComponentProperty("ejb3", "true"));
        exporter.getProperties().setProperty("jdk5",
                getComponentProperty("jdk5", "true"));

        if (commonCorePackage != null) {           

            exporter.getProperties().setProperty("appfusepackage",
                    commonCorePackage);
        } else {
            if (isFullSource()) {
                System.out
                        .println("MojoGeneratorModel::isFullSource appfusepackage="
                                + getProject().getGroupId());

                exporter.getProperties().setProperty("appfusepackage",
                        getProject().getGroupId());
            } else {               

                exporter.getProperties().setProperty("appfusepackage",
                        "org.appfuse");
            }
        }       

        return exporter;
View Full Code Here

Examples of org.hibernate.tool.hbm2x.POJOExporter

     * Instantiates a org.hibernate.tool.hbm2x.POJOExporter object.
     *
     * @return POJOExporter
     */
    protected Exporter createExporter() {
        return new POJOExporter();
    }
View Full Code Here

Examples of org.hibernate.tool.hbm2x.POJOExporter

       
        cfg.buildMappings();
        
        Exporter exporter = new HibernateMappingExporter(cfg, outputdir);
   
        Exporter javaExp = new POJOExporter(cfg, outputdir);
        exporter.start();
        javaExp.start();
       
        XMLPrettyPrinter.prettyPrintDirectory(outputdir,".hbm.xml", false);
        TestHelper.compile(outputdir, outputdir);
       
        Configuration derived = new Configuration();
View Full Code Here

Examples of org.hibernate.tool.hbm2x.POJOExporter

  
   private void exportSelectedEntities()
   {    
      final Collection<String> selectedTableNames = getSelectedTableNames();    
      JavaSourceFacet java = descriptor.selectedProject.getFacet(JavaSourceFacet.class);
      POJOExporter pj = new POJOExporter(jmdc, java.getSourceDirectory()
               .getUnderlyingResourceObject()) {
         @Override
         @SuppressWarnings("rawtypes")
         protected void exportPOJO(Map additionalContext, POJOClass element) {
            if (isSelected(selectedTableNames, element)) {
               super.exportPOJO(additionalContext, element);
            }
         }
      };
      Properties pojoProperties = new Properties();
      pojoProperties.setProperty("jdk5", "true");
      pojoProperties.setProperty("ejb3", "true");
      pj.setProperties(pojoProperties);
      pj.setArtifactCollector(new ArtifactCollector());
      pj.start();
   }
View Full Code Here

Examples of org.hibernate.tool.hbm2x.POJOExporter

   private Collection<String> exportSelectedEntities()
   {
      final Collection<String> selectedTableNames = getSelectedTableNames();
      JavaSourceFacet java = descriptor.getSelectedProject().getFacet(JavaSourceFacet.class);
      POJOExporter pj = new POJOExporter(jmdc, java.getSourceDirectory().getUnderlyingResourceObject())
      {
         @Override
         @SuppressWarnings("rawtypes")
         protected void exportPOJO(Map additionalContext, POJOClass element)
         {
            if (isSelected(selectedTableNames, element))
            {
               super.exportPOJO(additionalContext, element);
            }
         }
      };
      Properties pojoProperties = new Properties();
      pojoProperties.setProperty("jdk5", "true");
      pojoProperties.setProperty("ejb3", "true");
      pj.setProperties(pojoProperties);
      pj.setArtifactCollector(new ArtifactCollector());
      pj.start();
      return selectedTableNames;
   }
View Full Code Here

Examples of org.hibernate.tool.hbm2x.POJOExporter

   private Collection<String> exportSelectedEntities()
   {
      final Collection<String> selectedTableNames = Lists.toList(databaseTables.getValue());
      JavaSourceFacet java = descriptor.getSelectedProject().getFacet(JavaSourceFacet.class);
      POJOExporter pj = new POJOExporter(jmdc, java.getSourceDirectory().getUnderlyingResourceObject())
      {
         @Override
         @SuppressWarnings("rawtypes")
         protected void exportPOJO(Map additionalContext, POJOClass element)
         {
            if (isSelected(selectedTableNames, element))
            {
               super.exportPOJO(additionalContext, element);
            }
         }
      };
      Properties pojoProperties = new Properties();
      pojoProperties.setProperty("jdk5", "true");
      pojoProperties.setProperty("ejb3", "true");
      pj.setProperties(pojoProperties);
      pj.setArtifactCollector(new ArtifactCollector());
      pj.start();
      return selectedTableNames;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.