@RequestMapping(value = "branches/{branchId}/template", method = RequestMethod.GET)
    public Form singleTemplateInstanceForm(@PathVariable ID branchId) {
        // Gets the template definition for this branch
        Optional<TemplateDefinition> templateDefinition = branchTemplateService.getTemplateDefinition(branchId);
        if (!templateDefinition.isPresent()) {
            throw new BranchNotTemplateDefinitionException(branchId);
        }
        // Creates a form with the source name and all needed parameters
        Form form = Form.create().with(
                Form.defaultNameField()
                        .label("Source name")
                        .help("Name used to create the branch from.")
        );
        form.append(templateDefinition.get().getForm());
        // OK
        return form;
    }
@ RequestMapping ( value = "branches/{branchId}/template" , method = RequestMethod . GET ) public Form singleTemplateInstanceForm ( @ PathVariable ID branchId ) { Optional < TemplateDefinition > templateDefinition = branchTemplateService . getTemplateDefinition ( branchId ) ; if ( ! templateDefinition . isPresent ( ) ) { throw new BranchNotTemplateDefinitionException ( branchId ) ; } Form form = Form . create ( ) . with ( Form . defaultNameField ( ) . label ( "Source name" ) . help ( "Name used to create the branch from." ) ) ; form . append ( templateDefinition . get ( ) . getForm ( ) ) ; return form ; }
Gets the form to create a template instance using a name.