Search in sources :

Example 1 with AppRepository

use of com.axelor.apps.base.db.repo.AppRepository in project axelor-open-suite by axelor.

the class AppController method bulkInstall.

public void bulkInstall(ActionRequest request, ActionResponse response) throws AxelorException, IOException {
    Context context = request.getContext();
    Set<Map<String, Object>> apps = new HashSet<>();
    Collection<Map<String, Object>> appsSet = (Collection<Map<String, Object>>) context.get("appsSet");
    if (appsSet != null) {
        apps.addAll(appsSet);
    }
    Boolean importDemo = (Boolean) context.get("importDemoData");
    String language = (String) context.get("languageSelect");
    AppRepository appRepository = Beans.get(AppRepository.class);
    List<App> appList = new ArrayList<>();
    for (Map<String, Object> appData : apps) {
        App app = appRepository.find(Long.parseLong(appData.get("id").toString()));
        appList.add(app);
    }
    Beans.get(AppService.class).bulkInstall(appList, importDemo, language);
    response.setFlash(I18n.get(IExceptionMessages.BULK_INSTALL_SUCCESS));
    response.setSignal("refresh-app", true);
}
Also used : Context(com.axelor.rpc.Context) App(com.axelor.apps.base.db.App) AppService(com.axelor.apps.base.service.app.AppService) AppRepository(com.axelor.apps.base.db.repo.AppRepository) ArrayList(java.util.ArrayList) Collection(java.util.Collection) Map(java.util.Map) HashSet(java.util.HashSet)

Aggregations

App (com.axelor.apps.base.db.App)1 AppRepository (com.axelor.apps.base.db.repo.AppRepository)1 AppService (com.axelor.apps.base.service.app.AppService)1 Context (com.axelor.rpc.Context)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1