Package org.jboss.forge.addon.parser.java.resources

Examples of org.jboss.forge.addon.parser.java.resources.JavaResource


      return java.getBasePackage() + ".model." + entityName;
   }

   private void generateSimpleEntity(String entityName) throws Exception
   {
      JavaResource jpaEntity = projectHelper.createJPAEntity(project, entityName);
      entityClass = jpaEntity.getJavaType();
      saveJavaSource();
   }
View Full Code Here


   private void generateOneToOneField(String fieldName, String type, String inverseFieldName, FetchType fetchType,
            boolean required, Iterable<CascadeType> cascadeTypes) throws Exception
   {
      JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
      JavaResource entityClassResource = java.getJavaResource(entityClass);
      projectHelper.createOneToOneField(project, entityClassResource, fieldName, type, inverseFieldName, fetchType,
               required, cascadeTypes);
      entityClass = getJavaClassFor(entityClass.getName());
   }
View Full Code Here

   private void generateManyToOneField(String fieldName, String type, String inverseFieldName, FetchType fetchType,
            boolean required, Iterable<CascadeType> cascadeTypes) throws Exception
   {
      JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
      JavaResource entityClassResource = java.getJavaResource(entityClass);
      projectHelper.createManyToOneField(project, entityClassResource, fieldName, type, inverseFieldName, fetchType,
               required, cascadeTypes);
      entityClass = getJavaClassFor(entityClass.getName());
   }
View Full Code Here

   private void generateOneToManyField(String fieldName, String type, String inverseFieldName, FetchType fetchType,
            Iterable<CascadeType> cascadeTypes) throws Exception
   {
      JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
      JavaResource entityClassResource = java.getJavaResource(entityClass);
      projectHelper.createOneToManyField(project, entityClassResource, fieldName, type, inverseFieldName, fetchType,
               cascadeTypes);
      entityClass = getJavaClassFor(entityClass.getName());
   }
View Full Code Here

   private void generateManyToManyField(String fieldName, String type, String inverseFieldName, FetchType fetchType,
            Iterable<CascadeType> cascadeTypes) throws Exception
   {
      JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
      JavaResource entityClassResource = java.getJavaResource(entityClass);
      projectHelper.createManyToManyField(project, entityClassResource, fieldName, type, inverseFieldName, fetchType,
               cascadeTypes);
      entityClass = getJavaClassFor(entityClass.getName());
   }
View Full Code Here

         Result result = controller.execute();
         Assert.assertThat(result, is(not(instanceOf(Failed.class))));
      }
      JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
      String packageName = project.getFacet(JavaSourceFacet.class).getBasePackage() + ".model";
      JavaResource javaResource = facet.getJavaResource(packageName + ".CreditCardType");
      Assert.assertTrue(javaResource.exists());
      Assert.assertThat(javaResource.getJavaType(), is(instanceOf(JavaClass.class)));
      Assert.assertTrue(javaResource.getJavaType().hasAnnotation(MappedSuperclass.class));
   }
View Full Code Here

         Assert.assertTrue(controller.canExecute());
         Result result = controller.execute();
         Assert.assertThat(result, is(not(instanceOf(Failed.class))));
      }
      JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
      JavaResource javaResource = facet.getJavaResource("org.jboss.forge.test.CreditCardType");
      Assert.assertTrue(javaResource.exists());
      Assert.assertThat(javaResource.getJavaType(), is(instanceOf(JavaClass.class)));
      Assert.assertTrue(javaResource.getJavaType().hasAnnotation(MappedSuperclass.class));
   }
View Full Code Here

     {
        Project project = projectHelper.createWebProject();
        projectHelper.installJPA_2_0(project);
        projectHelper.installEJB_3_2(project);
        project = projectHelper.refreshProject(project);
        JavaResource entity = projectHelper.createJPAEntity(project, "Customer");
        try (CommandController controller = testHarness.createCommandController(DaoFromEntityCommand.class,
                 project.getRoot()))
        {
           controller.initialize();
           controller.setValueFor("targets", Arrays.asList(entity.getJavaType()));
           controller.setValueFor("persistenceUnit", "unit");
           Assert.assertTrue(controller.isValid());
           Assert.assertTrue(controller.canExecute());
           Result result = controller.execute();
           Assert.assertThat(result, is(not(instanceOf(Failed.class))));
        }
        JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
        JavaResource daoResource = facet.getJavaResource("unknown.dao.CustomerDao");
        Assert.assertTrue(daoResource.exists());
        Assert.assertThat(daoResource.getJavaType(), is(instanceOf(JavaClass.class)));
        JavaClass<?> restClass = daoResource.getJavaType();
        Method<?, ?> method = restClass.getMethod("create", "unknown.model.Customer");
        Assert.assertNotNull(method);
       
         project.getFacet(PackagingFacet.class).createBuilder().build();
     }
View Full Code Here

      Project project = projectHelper.createWebProject();
      projectHelper.installJAXRS_2_0(project, RestConfigurationStrategyFactory.createUsingWebXml("/rest"));
      projectHelper.installJPA_2_0(project);
      projectHelper.installEJB_3_2(project);
      project = projectHelper.refreshProject(project);
      JavaResource entity = projectHelper.createJPAEntity(project, "Customer");
      try (CommandController controller = testHarness.createCommandController(RestEndpointFromEntityCommand.class,
               project.getRoot()))
      {
         controller.initialize();
         controller.setValueFor("targets", Arrays.asList(entity.getJavaType()));
         controller.setValueFor("persistenceUnit", "unit");
         Assert.assertTrue(controller.isValid());
         Assert.assertTrue(controller.canExecute());
         Result result = controller.execute();
         Assert.assertThat(result, is(not(instanceOf(Failed.class))));
      }
      JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
      JavaResource restResource = facet.getJavaResource("unknown.rest.CustomerEndpoint");
      Assert.assertTrue(restResource.exists());
      Assert.assertThat(restResource.getJavaType(), is(instanceOf(JavaClass.class)));
      JavaClass<?> restClass = restResource.getJavaType();
      Method<?, ?> method = restClass.getMethod("create", "unknown.model.Customer");
      Annotation<?> consumes = method.getAnnotation(Consumes.class);
      Assert.assertEquals(MediaType.APPLICATION_JSON, consumes.getStringValue());
   }
View Full Code Here

         Assert.assertTrue(controller.canExecute());
         Result result = controller.execute();
         Assert.assertThat(result, is(not(instanceOf(Failed.class))));
      }
      JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
      JavaResource filterResource = facet.getJavaResource("unknown.rest.NewCrossOriginResourceSharingFilter");
      Assert.assertTrue(filterResource.exists());
      Assert.assertThat(filterResource.getJavaType(), is(instanceOf(JavaClass.class)));
      JavaClass<?> filterClass = filterResource.getJavaType();
      Assert.assertFalse(filterClass.hasSyntaxErrors());
      Assert.assertTrue(filterClass.hasAnnotation(Provider.class));
      Assert.assertTrue(filterClass.hasAnnotation(PreMatching.class));
      Method<?, ?> method = filterClass
               .getMethod("filter", ContainerRequestContext.class, ContainerResponseContext.class);
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.parser.java.resources.JavaResource

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.