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

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


      }
      addons.setValueChoices(choices);
      Project project = getSelectedProject(builder.getUIContext());
      if (project != null)
      {
         MetadataFacet facet = project.getFacet(MetadataFacet.class);
         String name = facet.getTopLevelPackage() + ":" + facet.getProjectName();
         AddonId selectedAddonId = AddonId.from(name, facet.getProjectVersion());
         if (choices.contains(selectedAddonId))
         {
            addons.setDefaultValue(Collections.singleton(selectedAddonId));
         }
      }
View Full Code Here


   {
      Project project = getSelectedProject(builder.getUIContext());
      final String topLevelPackage;
      if (project != null)
      {
         MetadataFacet facet = project.getFacet(MetadataFacet.class);
         topLevelPackage = facet.getTopLevelPackage();
         groupId.setDefaultValue(topLevelPackage);
         name.setDefaultValue(facet.getProjectName());
         version.setDefaultValue(facet.getProjectVersion());
      }
      else
      {
         topLevelPackage = null;
      }
View Full Code Here

   /**
    * Create a Furnace Project with the full structure (api,impl,tests,spi and addon)
    */
   public void setupAddonProject(Project project, Version forgeVersion, Iterable<AddonId> dependencyAddons)
   {
      MetadataFacet metadata = project.getFacet(MetadataFacet.class);
      String projectName = metadata.getProjectName();
      metadata.setProjectName(projectName + "-parent");
      DirectoryResource newRoot = project.getProjectRoot().getParent().getChildDirectory(metadata.getProjectName());
      // FORGE-877: there's an eclipse (not m2e) limitation that says if a project is located directly in the workspace
      // folder, then the imported project's name is always the same as the folder it is contained in.
      if (newRoot.exists() || !project.getProjectRoot().renameTo(newRoot))
      {
         log.warning("Could not rename project root");
View Full Code Here

      facets.add(ForgeContainerAPIFacet.class);
      facets.addAll(Arrays.asList(requiredProjectFacets));

      Project project = projectFactory.createProject(location, facets);

      MetadataFacet metadata = project.getFacet(MetadataFacet.class);
      metadata.setProjectName(artifactId);
      return project;
   }
View Full Code Here

                  metawidgetInspectorFacade);
         List<Map<String, String>> inspectionResults = metawidgetInspectorFacade.inspect(entity);
         String entityId = angularResultEnhancer.fetchEntityId(entity, inspectionResults);
         inspectionResults = angularResultEnhancer.enhanceResults(entity, inspectionResults);

         MetadataFacet metadata = project.getFacet(MetadataFacet.class);

         // TODO: Provide a 'utility' class for allowing transliteration across language naming schemes
         // We need this to use contextual naming schemes instead of performing toLowerCase etc. in FTLs.

         // Prepare the Freemarker data model
         Map<String, Object> dataModel = new HashMap<>();
         dataModel.put("entityName", entityName);
         dataModel.put("pluralizedEntityName", inflector.pluralize(entityName));
         dataModel.put("entityId", entityId);
         dataModel.put("properties", inspectionResults);
         dataModel.put("projectId", StringUtils.camelCase(metadata.getProjectName()));
         dataModel.put("projectTitle", StringUtils.uncamelCase(metadata.getProjectName()));
         dataModel.put("resourceRootPath", resourceRootPath);
         dataModel.put("resourcePath", entityResourcePath);
         dataModel.put("parentDirectories", getParentDirectories(targetDir));

         // Process the Freemarker templates with the Freemarker data model and retrieve the generated resources from
View Full Code Here

         String resourceName = resource.getName();
         entityNames.add(resourceName);
         pluralizedEntityNames.add(inflector.pluralize(resourceName));
      }

      MetadataFacet metadata = project.getFacet(MetadataFacet.class);

      Map<String, Object> dataModel = new HashMap<>();
      dataModel.put("entityNames", entityNames);
      dataModel.put("pluralizedEntityNames", pluralizedEntityNames);
      dataModel.put("projectId", StringUtils.camelCase(metadata.getProjectName()));
      dataModel.put("projectTitle", StringUtils.uncamelCase(metadata.getProjectName()));
      dataModel.put("targetDir", targetDir);

      ProcessingStrategy strategy = new ProcessTemplateStrategy(web, resourceFactory, project, templateFactory, dataModel);
      for (ScaffoldResource scaffoldResource : getGlobalTemplates(targetDir, strategy)) {
          result.add(scaffoldResource.generate());
View Full Code Here

   public void testComplexAddonProject() throws FileNotFoundException, FacetNotFoundException
   {
      Project project = projectFactory.createTempProject();
      project.getRoot().reify(DirectoryResource.class).deleteOnExit();

      MetadataFacet metadataFacet = project.getFacet(MetadataFacet.class);
      metadataFacet.setProjectName("testproject");
      metadataFacet.setProjectVersion("1.0.0-SNAPSHOT");
      metadataFacet.setProjectGroupName("com.acme.testproject");

      Version forgeVersion = furnace.getVersion();
      configurator.setupComplexAddonProject(project, forgeVersion, Collections.<AddonId> emptyList());
      Assert.assertTrue(project.hasFacet(AddonParentFacet.class));
      Assert.assertTrue(project.hasFacet(JavaCompilerFacet.class));
View Full Code Here

   @Test
   public void testSimpleAddonProject() throws FileNotFoundException, FacetNotFoundException
   {
      Project project = projectFactory.createTempProject();
      project.getRoot().reify(DirectoryResource.class).deleteOnExit();
      MetadataFacet metadataFacet = project.getFacet(MetadataFacet.class);
      metadataFacet.setProjectName("testproject");
      metadataFacet.setProjectVersion("1.0.0-SNAPSHOT");
      metadataFacet.setProjectGroupName("com.acme.testproject");

      Version forgeVersion = furnace.getVersion();
      configurator.setupSimpleAddonProject(project, forgeVersion, Collections.<AddonId> emptyList());

      Assert.assertTrue(project.hasFacet(ForgeBOMFacet.class));
View Full Code Here

   public void testDependencyResolution() throws FileNotFoundException, FacetNotFoundException
   {
      Project project = projectFactory.createTempProject();
      project.getRoot().reify(DirectoryResource.class).deleteOnExit();

      MetadataFacet metadataFacet = project.getFacet(MetadataFacet.class);
      metadataFacet.setProjectName("testproject");
      metadataFacet.setProjectVersion("1.0.0-SNAPSHOT");
      metadataFacet.setProjectGroupName("com.acme.testproject");

      Version forgeVersion = furnace.getVersion();
      configurator.setupComplexAddonProject(project, forgeVersion, Collections.<AddonId> emptyList());

      Resource<?> projectRoot = project.getRoot();
View Full Code Here

   }

   @Test
   public void testGetBuildSystem() throws Exception
   {
      final MetadataFacet facet = project.getFacet(MetadataFacet.class);
      Assert.assertNotNull("ProjectProvider name is null", facet.getProjectProvider());
      Assert.assertTrue(facet.getProjectProvider() instanceof MavenBuildSystem);
   }
View Full Code Here

TOP

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

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.