@@ -0,0 +1,2109 @@
+/*%0A * Copyright (C) 2017 the original author or authors.%0A *%0A * This file is part of jBB Application Project.%0A *%0A *  Licensed under the Apache License, Version 2.0 (the %22License%22);%0A *  You may obtain a copy of the License at%0A *        http://www.apache.org/licenses/LICENSE-2.0%0A */%0A%0Apackage org.jbb.frontend.impl.faq.logic;%0A%0Aimport com.google.common.collect.Lists;%0Aimport com.google.common.eventbus.Subscribe;%0Aimport org.jbb.frontend.impl.faq.dao.FaqCategoryRepository;%0Aimport org.jbb.frontend.impl.faq.model.FaqCategoryEntity;%0Aimport org.jbb.frontend.impl.faq.model.FaqEntryEntity;%0Aimport org.jbb.lib.eventbus.JbbEventBus;%0Aimport org.jbb.system.event.DatabaseSettingsChangedEvent;%0Aimport org.springframework.stereotype.Component;%0Aimport org.springframework.transaction.annotation.Transactional;%0A%0A@Component%0Apublic class FaqAutoCreator %7B%0A%0A    private final FaqCategoryRepository faqCategoryRepository;%0A%0A    public FaqAutoCreator(FaqCategoryRepository faqCategoryRepository,%0A        JbbEventBus jbbEventBus) %7B%0A        this.faqCategoryRepository = faqCategoryRepository;%0A        jbbEventBus.register(this);%0A    %7D%0A%0A    @Subscribe%0A    @Transactional%0A    public void buildFaq(DatabaseSettingsChangedEvent e) %7B%0A        if (faqIsEmpty()) %7B%0A            FaqEntryEntity firstFaqEntry = FaqEntryEntity.builder()%0A                .question(%22What is jBB?%22)%0A                .answer(%22jBB is a bulletin board software%22)%0A                .position(1)%0A                .build();%0A%0A            FaqEntryEntity secondFaqEntry = FaqEntryEntity.builder()%0A                .question(%22How can I get support?%22)%0A                .answer(%22Visit https://github.com/jbb-project/jbb%22)%0A                .position(2)%0A                .build();%0A%0A            FaqCategoryEntity firstCategory = FaqCategoryEntity.builder()%0A                .name(%22General%22)%0A                .entries(Lists.newArrayList(firstFaqEntry, secondFaqEntry))%0A                .position(1)%0A                .build();%0A%0A            faqCategoryRepository.save(firstCategory);%0A        %7D%0A%0A    %7D%0A%0A    private boolean faqIsEmpty() %7B%0A        return faqCategoryRepository.count() == 0;%0A    %7D%0A%7D%0A

Create dummy entries in FAQ after scratch install