/*
 * Copyright 2016 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Eclipse Public License version 1.0, available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package org.jboss.forge.addon.springboot.project;

import java.util.ArrayList;
import java.util.List;

import org.jboss.forge.addon.parser.java.facets.JavaCompilerFacet;
import org.jboss.forge.addon.parser.java.facets.JavaSourceFacet;
import org.jboss.forge.addon.projects.AbstractProjectType;
import org.jboss.forge.addon.projects.ProjectFacet;
import org.jboss.forge.addon.projects.facets.DependencyFacet;
import org.jboss.forge.addon.projects.facets.MetadataFacet;
import org.jboss.forge.addon.projects.facets.PackagingFacet;
import org.jboss.forge.addon.projects.facets.ResourcesFacet;
import org.jboss.forge.addon.projects.facets.WebResourcesFacet;
import org.jboss.forge.addon.projects.stacks.Stack;
import org.jboss.forge.addon.springboot.commands.setup.SetupProjectCommand;
import org.jboss.forge.addon.ui.wizard.UIWizardStep;

public class SpringBootProjectType extends AbstractProjectType
{

   @Override
   public boolean supports(Stack stack)
   {
      return false;
   }

   @Override
   public String getType()
   {
      return "Spring Boot";
   }

   @Override
   public Iterable<Class<? extends ProjectFacet>> getRequiredFacets()
   {
      List<Class<? extends ProjectFacet>> result = new ArrayList<Class<? extends ProjectFacet>>(7);
      result.add(MetadataFacet.class);
      result.add(PackagingFacet.class);
      result.add(DependencyFacet.class);
      result.add(ResourcesFacet.class);
      result.add(WebResourcesFacet.class);
      result.add(JavaSourceFacet.class);
      result.add(JavaCompilerFacet.class);
      return result;
   }

   @Override
   public int priority()
   {
      return 100;
   }

   @Override
   public Class<? extends UIWizardStep> getSetupFlow()
   {
      return SetupProjectCommand.class;
   }

   @Override
   public String toString()
   {
      return "spring-boot";
   }
}

@@ -229,60 +229,8 @@
 t;%0A%0A
-import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 impo
@@ -517,269 +517,9 @@
 ets.
-DependencyFacet;%0Aimport org.jboss.forge.addon.projects.facets.MetadataFacet;%0Aimport org.jboss.forge.addon.projects.facets.PackagingFacet;%0Aimport org.jboss.forge.addon.projects.facets.ResourcesFacet;%0Aimport org.jboss.forge.addon.projects.facets.WebResourcesFacet
+*
 ;%0Aim
@@ -698,16 +698,68 @@
 dStep;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 public c
@@ -819,265 +819,31 @@
 e%0A%7B%0A
-%0A
    
-@Override%0A   public boolean supports(Stack stack)%0A   %7B%0A      return false;%0A   %7D%0A%0A   @Override%0A   public String getType()%0A   %7B%0A      return %22Spring Boot%22;%0A   %7D%0A%0A   @Override%0A   public Iterable%3CClass%3C? extends ProjectFacet%3E%3E getRequiredFacets()%0A   %7B%0A     
+private static final
  Lis
@@ -875,22 +875,31 @@
 Facet%3E%3E 
-result
+REQUIRED_FACETS
  = new A
@@ -911,55 +911,48 @@
 ist%3C
-Class%3C? extends ProjectFacet%3E%3E(7);%0A      result
+%3E(7);%0A%0A   static %7B%0A      REQUIRED_FACETS
 .add
@@ -976,30 +976,39 @@
 ass);%0A      
-result
+REQUIRED_FACETS
 .add(Packagi
@@ -1025,30 +1025,39 @@
 ass);%0A      
-result
+REQUIRED_FACETS
 .add(Depende
@@ -1075,30 +1075,39 @@
 ass);%0A      
-result
+REQUIRED_FACETS
 .add(Resourc
@@ -1124,30 +1124,39 @@
 ass);%0A      
-result
+REQUIRED_FACETS
 .add(WebReso
@@ -1172,38 +1172,47 @@
 t.class);%0A      
-result
+REQUIRED_FACETS
 .add(JavaSourceF
@@ -1230,22 +1230,31 @@
 ;%0A      
-result
+REQUIRED_FACETS
 .add(Jav
@@ -1283,24 +1283,290 @@
 %0A   
-   return result
+%7D%0A%0A   @Override%0A   public boolean supports(Stack stack)%0A   %7B%0A      return false;%0A   %7D%0A%0A   @Override%0A   public String getType()%0A   %7B%0A      return %22Spring Boot%22;%0A   %7D%0A%0A   @Override%0A   public Iterable%3CClass%3C? extends ProjectFacet%3E%3E getRequiredFacets()%0A   %7B%0A      return REQUIRED_FACETS
 ;%0A  

Use constant for required facets.