use of com.khartec.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);
}
use of com.khartec.waltz.service.survey.SurveyTemplateService in project waltz by khartec.
the class SurveyTemplateGenerator method main.
public static void main(String[] args) {
try {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
SurveyTemplateService surveyTemplateService = ctx.getBean(SurveyTemplateService.class);
SurveyQuestionService surveyQuestionService = ctx.getBean(SurveyQuestionService.class);
dsl.deleteFrom(SURVEY_TEMPLATE).execute();
dsl.deleteFrom(SURVEY_QUESTION).execute();
ReleaseLifecycleStatusChangeCommand statusChangeCommand = ImmutableReleaseLifecycleStatusChangeCommand.builder().newStatus(ReleaseLifecycleStatus.ACTIVE).build();
SurveyTemplateChangeCommand appSurvey = mkAppSurvey();
long aid = surveyTemplateService.create("admin", appSurvey);
List<SurveyQuestion> appQs = mkAppQuestions(aid);
appQs.forEach(surveyQuestionService::create);
surveyTemplateService.updateStatus("admin", aid, statusChangeCommand);
SurveyTemplateChangeCommand projectSurvey = mkProjectSurvey();
long pid = surveyTemplateService.create("admin", projectSurvey);
List<SurveyQuestion> projQs = mkProjQuestions(pid);
projQs.forEach(surveyQuestionService::create);
surveyTemplateService.updateStatus("admin", pid, statusChangeCommand);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations