Search in sources :

Example 1 with AppCategoryGson

use of ai.elimu.model.gson.project.AppCategoryGson in project webapp by elimu-ai.

the class JavaToGsonConverter method getAppCategoryGson.

public static AppCategoryGson getAppCategoryGson(AppCategory appCategory) {
    if (appCategory == null) {
        return null;
    } else {
        AppCategoryGson appCategoryGson = new AppCategoryGson();
        appCategoryGson.setId(appCategory.getId());
        appCategoryGson.setName(appCategory.getName());
        List<AppGroupGson> appGroups = new ArrayList<>();
        for (AppGroup appGroup : appCategory.getAppGroups()) {
            AppGroupGson appGroupGson = getAppGroupGson(appGroup);
            appGroups.add(appGroupGson);
        }
        appCategoryGson.setAppGroups(appGroups);
        return appCategoryGson;
    }
}
Also used : AppCategoryGson(ai.elimu.model.gson.project.AppCategoryGson) ArrayList(java.util.ArrayList) AppGroupGson(ai.elimu.model.gson.project.AppGroupGson) AppGroup(ai.elimu.model.project.AppGroup)

Example 2 with AppCategoryGson

use of ai.elimu.model.gson.project.AppCategoryGson 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)

Aggregations

AppCategoryGson (ai.elimu.model.gson.project.AppCategoryGson)2 ArrayList (java.util.ArrayList)2 AppCollectionGson (ai.elimu.model.gson.project.AppCollectionGson)1 AppGroupGson (ai.elimu.model.gson.project.AppGroupGson)1 AppCategory (ai.elimu.model.project.AppCategory)1 AppGroup (ai.elimu.model.project.AppGroup)1