Search in sources :

Example 1 with ReleaseLifecycleStatusChangeCommand

use of com.khartec.waltz.model.ReleaseLifecycleStatusChangeCommand 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();
    }
}
Also used : SurveyQuestionService(com.khartec.waltz.service.survey.SurveyQuestionService) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) ImmutableReleaseLifecycleStatusChangeCommand(com.khartec.waltz.model.ImmutableReleaseLifecycleStatusChangeCommand) ReleaseLifecycleStatusChangeCommand(com.khartec.waltz.model.ReleaseLifecycleStatusChangeCommand) DSLContext(org.jooq.DSLContext) SurveyTemplateService(com.khartec.waltz.service.survey.SurveyTemplateService)

Aggregations

ImmutableReleaseLifecycleStatusChangeCommand (com.khartec.waltz.model.ImmutableReleaseLifecycleStatusChangeCommand)1 ReleaseLifecycleStatusChangeCommand (com.khartec.waltz.model.ReleaseLifecycleStatusChangeCommand)1 SurveyQuestionService (com.khartec.waltz.service.survey.SurveyQuestionService)1 SurveyTemplateService (com.khartec.waltz.service.survey.SurveyTemplateService)1 DSLContext (org.jooq.DSLContext)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1