The template wizard feature is in Grouper patches grouper_v2_4_0_api_patch_5 and grouper_v2_4_0_ui_patch_2 and later.

The template wizard helps folder admins implement a new template which has a series of steps.  The template will create folders and groups and assign privileges based on inputs.  This will allow Grouper users to accomplish multiple tasks at once and save time and be more consistent. 

An advantage of the template wizard is that it provides a convenient approach to implementing the recommendations for folder structure from the Grouper Deployment Guide.


Using the Template Wizard

On a folder screen, under "more actions" will be an option for "New template"


The wizard will prompt for "Template type", which by default has "Application" and "Grouper Deployment Guide structure."

Application built-in template

The "application" option allows you to give a friendly name to an application and prompts you to set up the recommended folders for an application to be integrated with Grouper.




Grouper Deployment Guide structure built-in template

This is a convenient way to implement the recommendations for folder structure from the TIER Grouper Deployment Guide




Creating your own template

New templates should be configured in grouper-ui.properties, and should extend a common base class.  GrouperTemplateLogicBase

See the built-ins for examples

#######################################
############## New service template
#######################################

## use capturing group from regex as the key in the dropdown. eg: service for the below string
grouper.template.service.logicClass=edu.internet2.middleware.grouper.grouperUi.beans.ui.GrouperNewServiceTemplateLogic

grouper.template.tierStructure.logicClass=edu.internet2.middleware.grouper.grouperUi.beans.ui.GrouperTierStructureLogic


The wizard will prompt them for a "key" (alphanumeric), and friendly name (optional).  Also the service description.

The base class should take as an input a stem, a system name extension, and optionally a friendly name extension (default to system name extension)

There should be a ui text key that describes the service (e.g. built in is "New service").  Drop down will pick which type of service

It should return a list of things it will do, as javabeans

ServiceAction

The UI should display the ServiceActions on the screen, with the correct indent level, and checkboxes

When submitted, if each checkbox is checked, it should do that action (if applicable).  If not applicable, give a warning.  The UI will pass the list of pojos, and "checkSubmitted" is set based on if the checkboxes were checked, to the base class, for a logic method, to implement the template.  There should be a base class method to validate the input, pass the response JS object, and the validate method can write error messages to the screen and return true or false if valid.

New template from GSH

Note: GSH must be run from the UI

String templateType = "service";
String stemName = "aStem";
String templateKey = "app3";
String serviceDescription = "app3 app";
String serviceFriendlyName = "app3";
boolean createSubFolder = true;
GrouperSession grouperSession = GrouperSession.startRootSession();
Stem stem = StemFinder.findByName(grouperSession, stemName, true);
edu.internet2.middleware.grouper.grouperUi.beans.ui.GrouperRequestContainer.assignUseStaticRequestContainer(true);
edu.internet2.middleware.grouper.grouperUi.beans.ui.GrouperRequestContainer grouperRequestContainer = edu.internet2.middleware.grouper.grouperUi.beans.ui.GrouperRequestContainer.retrieveFromRequestOrCreate();
edu.internet2.middleware.grouper.grouperUi.beans.ui.StemTemplateContainer stemTemplateContainer = grouperRequestContainer.getStemTemplateContainer();
edu.internet2.middleware.grouper.grouperUi.beans.ui.GrouperTemplateLogicBase templateLogic = edu.internet2.middleware.grouper.grouperUi.serviceLogic.UiV2Template.getTemplateLogic(templateType, stemTemplateContainer);
templateLogic.setStemId(stem.getUuid());
stemTemplateContainer.setCreateNoSubfolder(!createSubFolder);
stemTemplateContainer.setTemplateKey(templateKey);
stemTemplateContainer.setTemplateDescription(serviceDescription);
stemTemplateContainer.setTemplateFriendlyName(serviceFriendlyName);
List allServiceActions = templateLogic.getServiceActions();
// if (templateLogic.validate(allServiceActions)) { throw new RuntimeException("Not valid"); } // dont include this line for some reason
for (edu.internet2.middleware.grouper.grouperUi.beans.ui.ServiceAction serviceAction: allServiceActions) { serviceAction.getServiceActionType().createTemplateItem(serviceAction); }