@Override
public NavigationResult getSetupFlow(ScaffoldSetupContext setupContext)
{
Project project = setupContext.getProject();
NavigationResultBuilder builder = NavigationResultBuilder.create();
List<Class<? extends UICommand>> setupCommands = new ArrayList<>();
if (!project.hasFacet(JPAFacet.class))
{
builder.add(JPASetupWizard.class);
}
if (!project.hasFacet(CDIFacet.class))
{
setupCommands.add(CDISetupCommand.class);
}
if (!project.hasFacet(EJBFacet.class))
{
setupCommands.add(EJBSetupWizard.class);
}
if (!project.hasFacet(ServletFacet.class))
{
// TODO: FORGE-1296. Ensure that this wizard only sets up Servlet 3.0+
setupCommands.add(ServletSetupWizard.class);
}
if (!project.hasFacet(RestFacet.class))
{
setupCommands.add(RestSetupWizard.class);
}
if(setupCommands.size() >0)
{
Metadata compositeSetupMetadata = Metadata.forCommand(setupCommands.get(0))
.name("Setup Facets")
.description("Setup all dependent facets for the AngularJS scaffold.");
builder.add(compositeSetupMetadata, setupCommands);
}
return builder.build();
}