Package org.jboss.forge.addon.projects.facets

Examples of org.jboss.forge.addon.projects.facets.WebResourcesFacet


      String targetDir = setupContext.getTargetDirectory();
      targetDir = targetDir == null ? "" : targetDir;
      if (project.hasAllFacets(WebResourcesFacet.class, DependencyFacet.class, JPAFacet.class, EJBFacet.class,
               CDIFacet.class, RestFacet.class))
      {
         WebResourcesFacet web = project.getFacet(WebResourcesFacet.class);
         boolean areResourcesInstalled = web.getWebResource(targetDir + GLYPHICONS_SVG).exists()
                  && web.getWebResource(targetDir + GLYPHICONS_EOT).exists()
                  && web.getWebResource(targetDir + GLYPHICONS_SVG).exists()
                  && web.getWebResource(targetDir + GLYPHICONS_TTF).exists()
                  && web.getWebResource(targetDir + GLYPHICONS_WOFF).exists()
                  && web.getWebResource(targetDir + FORGE_LOGO_PNG).exists()
                  && web.getWebResource(targetDir + ANGULAR_RESOURCE_JS).exists()
                  && web.getWebResource(targetDir + ANGULAR_ROUTE_JS).exists()
                  && web.getWebResource(targetDir + ANGULAR_JS).exists()
                  && web.getWebResource(targetDir + MODERNIZR_JS).exists()
                  && web.getWebResource(targetDir + JQUERY_JS).exists()
                  && web.getWebResource(targetDir + BOOTSTRAP_JS).exists()
                  && web.getWebResource(targetDir + OFFCANVAS_JS).exists()
                  && web.getWebResource(targetDir + MAIN_CSS).exists()
                  && web.getWebResource(targetDir + BOOTSTRAP_CSS).exists()
                  && web.getWebResource(targetDir + BOOTSTRAP_THEME_CSS).exists()
                  && web.getWebResource(targetDir + LANDING_VIEW).exists();
         return areResourcesInstalled;
      }
      return false;
   }
View Full Code Here


         dataModel.put("resourcePath", entityResourcePath);
         dataModel.put("parentDirectories", getParentDirectories(targetDir));

         // Process the Freemarker templates with the Freemarker data model and retrieve the generated resources from
         // the registry.
         WebResourcesFacet web = project.getFacet(WebResourcesFacet.class);
         ProcessingStrategy strategy = new ProcessTemplateStrategy(web, resourceFactory, project, templateFactory, dataModel);
         List<ScaffoldResource> scaffoldResources = getEntityTemplates(targetDir, entityName, strategy);
         scaffoldResources.add(new ScaffoldResource("/views/detail.html.ftl", targetDir + "/views/" + entityName
                  + "/detail.html", new DetailTemplateStrategy(web, resourceFactory, project, templateFactory, dataModel)));
         scaffoldResources.add(new ScaffoldResource("/views/search.html.ftl", targetDir + "/views/" + entityName
View Full Code Here

            return true;
         }
      };

      WebResourcesFacet web = this.project.getFacet(WebResourcesFacet.class);
      List<Resource<?>> resources = web.getWebResource(targetDir + "/views/").listResources(filter);
      List<String> entityNames = new ArrayList<>();
      List<String> pluralizedEntityNames = new ArrayList<>();
      for (Resource<?> resource : resources)
      {
         String resourceName = resource.getName();
View Full Code Here

      {
         if (template.exists())
         {
            Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();
            Project project = (Project) attributeMap.get(Project.class);
            WebResourcesFacet web = project.getFacet(WebResourcesFacet.class);
            boolean isValidTemplate = false;
            for (DirectoryResource dir : web.getWebRootDirectories())
            {
               if (ResourceUtil.isChildOf(dir, template))
               {
                  isValidTemplate = true;
               }
View Full Code Here

   }

   @Test
   public void testWebResourceFolderNotNull() throws Exception
   {
      final WebResourcesFacet facet = project.getFacet(WebResourcesFacet.class);
      Assert.assertNotNull("Resource folder is null", facet.getWebRootDirectory());
   }
View Full Code Here

   }

   @Test
   public void testDefaultWebResourceFolder() throws Exception
   {
      WebResourcesFacet facet = project.getFacet(WebResourcesFacet.class);
      DirectoryResource expected = project.getRootDirectory().getChildDirectory(
               "src" + File.separator + "main" + File.separator + "webapp");
      Assert.assertEquals(expected.getFullyQualifiedName(), facet.getWebRootDirectory().getFullyQualifiedName());
   }
View Full Code Here

      pom.setContents("<project><modelVersion>4.0.0</modelVersion><groupId>com.test</groupId><artifactId>testme</artifactId><version>1.0</version><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>2.1-beta-1</version><configuration>"
               + "<warSourceDirectory>foo</warSourceDirectory>"
               + "</configuration></plugin></plugins></build></project>");

      WebResourcesFacet facet = project.getFacet(WebResourcesFacet.class);
      DirectoryResource expected = project.getRootDirectory().getChildDirectory("foo");
      Assert.assertEquals(expected.getFullyQualifiedName(), facet.getWebRootDirectory().getFullyQualifiedName());
   }
View Full Code Here

   }

   @Test
   public void testWebResourceFacet()
   {
      WebResourcesFacet facet = facetFactory.install(project, WebResourcesFacet.class);
      Assert.assertTrue(project.hasFacet(WebResourcesFacet.class));
      Assert.assertTrue(facet.getWebRootDirectory().exists());
   }
View Full Code Here

   }

   @Test
   public void testDefaultWebappFolder() throws Exception
   {
      WebResourcesFacet facet = facetFactory.install(project, WebResourcesFacet.class);
      DirectoryResource expected = project.getRootDirectory().getChildDirectory(
               "src" + File.separator + "main" + File.separator + "webapp");
      Assert.assertEquals(expected.getFullyQualifiedName(), facet.getWebRootDirectory().getFullyQualifiedName());
   }
View Full Code Here

   }

   @Test
   public void testCustomWebappFolder() throws Exception
   {
      WebResourcesFacet facet = facetFactory.install(project, WebResourcesFacet.class);
      MavenModelResource pom = project.getRootDirectory().getChild("pom.xml").reify(MavenModelResource.class);
      pom.setContents("<project><modelVersion>4.0.0.</modelVersion><groupId>com.test</groupId><artifactId>testme</artifactId><version>1.0</version><build><plugins><plugin><artifactId>maven-war-plugin</artifactId><version>2.4</version><configuration><warSourceDirectory>WebContent</warSourceDirectory><failOnMissingWebXml>false</failOnMissingWebXml></configuration></plugin></plugins></build></project>");
      DirectoryResource expected = project.getRootDirectory().getChildDirectory(
               "WebContent");
      Assert.assertEquals(expected.getFullyQualifiedName(), facet.getWebRootDirectory().getFullyQualifiedName());
   }
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.projects.facets.WebResourcesFacet

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.