Search in sources :

Example 16 with AppCategory

use of ai.elimu.model.project.AppCategory in project webapp by elimu-ai.

the class LicenseCreateController method sendLicenseInEmail.

/**
 * Sends an e-mail with the License details necessary to be able to use the Appstore application for downloading
 * an AppCollection.
 *
 * @param license The License to send in the e-mail
 * @param contributor The project manager who generated the License
 */
private void sendLicenseInEmail(License license, Contributor projectManager) {
    logger.info("sendLicenseInEmail");
    AppCollection appCollection = license.getAppCollection();
    String to = license.getLicenseEmail();
    String from = "elimu.ai <info@elimu.ai>";
    String subject = "License number - " + appCollection.getName();
    String title = "Your license is ready!";
    String firstName = license.getFirstName();
    String htmlText = "<p>Hi, " + firstName + "</p>";
    htmlText += "<p>We have prepared a license number for you so that you can download and use our software.</p>";
    htmlText += "<h2>License Details</h2>";
    htmlText += "<p>";
    htmlText += "E-mail: " + license.getLicenseEmail() + "<br />";
    htmlText += "Number: " + license.getLicenseNumber() + "<br />";
    htmlText += "</p>";
    htmlText += "<p>";
    htmlText += "First name: " + license.getFirstName() + "<br />";
    htmlText += "Last name: " + license.getLastName() + "<br />";
    if (!StringUtils.isBlank(license.getOrganization())) {
        htmlText += "Organization: " + license.getOrganization() + "<br />";
    }
    htmlText += "</p>";
    htmlText += "<h2>App Collection - " + appCollection.getName() + "</h2>";
    htmlText += "<p>This license is valid for the app collection \"" + appCollection.getName() + "\", which " + "contains the following app categories:</p>";
    htmlText += "<ul>";
    for (AppCategory appCategory : appCollection.getAppCategories()) {
        htmlText += "<li>" + appCategory.getName() + "</li>";
    }
    htmlText += "</ul>";
    htmlText += "<h2>How to Start?</h2>";
    htmlText += "<ol>";
    htmlText += "<li>Install our Appstore application</li>";
    htmlText += "<li>Open Appstore and type your e-mail + license number</li>";
    htmlText += "<li>Download apps</li>";
    htmlText += "</ol>";
    htmlText += "<h2>Download Appstore</h2>";
    htmlText += "<p>At https://github.com/elimu-ai/appstore/releases you can download the latest version of our Appstore " + "application which helps you download the entire collection of educational Android apps.</p>";
    htmlText += "<p>Make sure you download the file named \"ai.elimu.appstore<b>_custom</b>-&lt;version&gt;.apk\". " + "Start by clicking the button below:</p>";
    Mailer.sendHtmlWithButton(to, projectManager.getEmail(), from, subject, title, htmlText, "Download APK", "https://github.com/elimu-ai/appstore/releases");
}
Also used : AppCollection(ai.elimu.model.project.AppCollection) AppCategory(ai.elimu.model.project.AppCategory)

Example 17 with AppCategory

use of ai.elimu.model.project.AppCategory in project webapp by elimu-ai.

the class JavaToGsonConverter method getAppCollectionGson.

public static AppCollectionGson getAppCollectionGson(AppCollection appCollection) {
    if (appCollection == null) {
        return null;
    } else {
        AppCollectionGson appCollectionGson = new AppCollectionGson();
        appCollectionGson.setId(appCollection.getId());
        List<AppCategoryGson> appCategories = new ArrayList<>();
        for (AppCategory appCategory : appCollection.getAppCategories()) {
            AppCategoryGson appCategoryGson = getAppCategoryGson(appCategory);
            appCategories.add(appCategoryGson);
        }
        appCollectionGson.setAppCategories(appCategories);
        return appCollectionGson;
    }
}
Also used : AppCollectionGson(ai.elimu.model.gson.project.AppCollectionGson) AppCategoryGson(ai.elimu.model.gson.project.AppCategoryGson) ArrayList(java.util.ArrayList) AppCategory(ai.elimu.model.project.AppCategory)

Example 18 with AppCategory

use of ai.elimu.model.project.AppCategory in project webapp by elimu-ai.

the class AppCategoryDaoTest method testReadAll.

@Test
public void testReadAll() {
    List<AppCategory> appCategories = appCategoryDao.readAll();
    assertThat(appCategories.size(), is(0));
    AppCategory appCategory = new AppCategory();
    appCategoryDao.create(appCategory);
    appCategories.add(appCategory);
    Project project = new Project();
    project.setAppCategories(appCategories);
    projectDao.create(project);
    assertThat(appCategories.size(), is(1));
}
Also used : Project(ai.elimu.model.project.Project) AppCategory(ai.elimu.model.project.AppCategory) Test(org.junit.Test)

Aggregations

AppCategory (ai.elimu.model.project.AppCategory)18 Project (ai.elimu.model.project.Project)14 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)12 AppGroup (ai.elimu.model.project.AppGroup)9 Contributor (ai.elimu.model.Contributor)5 ApplicationVersion (ai.elimu.model.admin.ApplicationVersion)5 Application (ai.elimu.model.admin.Application)4 ArrayList (java.util.ArrayList)3 AppCollection (ai.elimu.model.project.AppCollection)2 ApplicationGson (ai.elimu.model.gson.admin.ApplicationGson)1 ApplicationVersionGson (ai.elimu.model.gson.admin.ApplicationVersionGson)1 AppCategoryGson (ai.elimu.model.gson.project.AppCategoryGson)1 AppCollectionGson (ai.elimu.model.gson.project.AppCollectionGson)1 License (ai.elimu.model.project.License)1 Gson (com.google.gson.Gson)1 IOException (java.io.IOException)1 Date (java.util.Date)1 ByteArrayApkFile (net.dongliu.apk.parser.ByteArrayApkFile)1 ApkMeta (net.dongliu.apk.parser.bean.ApkMeta)1 JSONArray (org.json.JSONArray)1