Search in sources :

Example 1 with SurveyTemplateService

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));
}
Also used : SurveyQuestionService(org.finos.waltz.service.survey.SurveyQuestionService) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) SurveyQuestionDropdownEntryService(org.finos.waltz.service.survey.SurveyQuestionDropdownEntryService) SurveyTemplateService(org.finos.waltz.service.survey.SurveyTemplateService)

Example 2 with SurveyTemplateService

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;
}
Also used : SurveyQuestionService(org.finos.waltz.service.survey.SurveyQuestionService) SurveyTemplateService(org.finos.waltz.service.survey.SurveyTemplateService)

Example 3 with SurveyTemplateService

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);
}
Also used : SurveyQuestionService(org.finos.waltz.service.survey.SurveyQuestionService) SurveyTemplateService(org.finos.waltz.service.survey.SurveyTemplateService)

Aggregations

SurveyQuestionService (org.finos.waltz.service.survey.SurveyQuestionService)3 SurveyTemplateService (org.finos.waltz.service.survey.SurveyTemplateService)3 SurveyQuestionDropdownEntryService (org.finos.waltz.service.survey.SurveyQuestionDropdownEntryService)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1