use of org.finos.waltz.service.survey.SurveyTemplateService in project waltz by khartec.
the class SurveyBuilder method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
SurveyTemplateService surveyTemplateService = ctx.getBean(SurveyTemplateService.class);
SurveyQuestionService surveyQuestionService = ctx.getBean(SurveyQuestionService.class);
SurveyQuestionDropdownEntryService surveyQuestionDropdownEntryService = ctx.getBean(SurveyQuestionDropdownEntryService.class);
long templateId = storeTemplate(surveyTemplateService);
storeQuestions(surveyQuestionService, surveyQuestionDropdownEntryService, mkAllQs.apply(templateId));
}
use of org.finos.waltz.service.survey.SurveyTemplateService in project waltz by khartec.
the class SurveyTemplateGenerator method create.
@Override
public Map<String, Integer> create(ApplicationContext ctx) {
SurveyTemplateService surveyTemplateService = ctx.getBean(SurveyTemplateService.class);
SurveyQuestionService surveyQuestionService = ctx.getBean(SurveyQuestionService.class);
SurveyTemplateChangeCommand appSurvey = mkAppSurvey();
long aid = surveyTemplateService.create("admin", appSurvey);
List<SurveyQuestion> appQs = mkAppQuestions(aid);
appQs.forEach(surveyQuestionService::create);
SurveyTemplateChangeCommand projectSurvey = mkProjectSurvey();
long pid = surveyTemplateService.create("admin", projectSurvey);
List<SurveyQuestion> projQs = mkProjQuestions(pid);
projQs.forEach(surveyQuestionService::create);
surveyTemplateService.updateStatus("admin", aid, ImmutableReleaseLifecycleStatusChangeCommand.builder().newStatus(ReleaseLifecycleStatus.ACTIVE).build());
surveyTemplateService.updateStatus("admin", pid, ImmutableReleaseLifecycleStatusChangeCommand.builder().newStatus(ReleaseLifecycleStatus.ACTIVE).build());
return null;
}
use of org.finos.waltz.service.survey.SurveyTemplateService in project waltz by khartec.
the class SurveyHarness method surveyTempateHarness.
private static void surveyTempateHarness(AnnotationConfigApplicationContext ctx) {
SurveyTemplateService surveyTemplateService = ctx.getBean(SurveyTemplateService.class);
SurveyQuestionService surveyQuestionService = ctx.getBean(SurveyQuestionService.class);
SurveyTemplateChangeCommand surveyTemplateChangeCommand = ImmutableSurveyTemplateChangeCommand.builder().name("AAA").description("BBB").targetEntityKind(EntityKind.CHANGE_INITIATIVE).build();
long templateId = surveyTemplateService.create("admin", surveyTemplateChangeCommand);
System.out.println("Created: template create with ID = " + templateId);
SurveyQuestion surveyQuestion = ImmutableSurveyQuestion.builder().surveyTemplateId(templateId).sectionName("SSS").questionText("QQQ").helpText("HHH").fieldType(SurveyQuestionFieldType.TEXTAREA).position(1).isMandatory(false).allowComment(true).build();
long questionId = surveyQuestionService.create(surveyQuestion);
System.out.println("Created: question create with ID = " + questionId);
}
Aggregations