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>-<version>.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");
}
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;
}
}
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));
}
Aggregations