use of com.axelor.apps.base.db.App in project axelor-open-suite by axelor.
the class AppServiceImpl method importRoles.
@Override
public void importRoles() throws AxelorException, IOException {
List<App> apps = appRepo.all().filter("self.isRolesImported = false").fetch();
apps = sortApps(apps);
for (App app : apps) {
importRoles(app);
}
}
use of com.axelor.apps.base.db.App in project axelor-open-suite by axelor.
the class AccessConfigImportServiceImpl method importObjectAccess.
private void importObjectAccess(XSSFSheet sheet) {
App app = Beans.get(AppRepository.class).findByCode(sheet.getSheetName());
if (app == null) {
return;
}
Iterator<Row> rowIter = sheet.iterator();
Map<Integer, AccessConfig> accessMap = null;
while (rowIter.hasNext()) {
if (accessMap == null) {
accessMap = getAccessConfig(rowIter.next(), app);
continue;
}
createObjectRoles(accessMap, rowIter.next());
}
}
use of com.axelor.apps.base.db.App in project axelor-open-suite by axelor.
the class AccessTemplateServiceImpl method getApp.
private String getApp(MetaMenu menu) {
String appCode = null;
String condition = menu.getConditionToCheck();
if (condition != null) {
String[] cond = condition.split("__config__\\.app\\.isApp\\('");
if (cond.length > 1) {
App app = Beans.get(AppRepository.class).findByCode(cond[1].split("'")[0]);
if (app != null) {
if (condition.trim().equals("__config__.app.isApp('" + app.getCode() + "')") && menu.getAction() == null) {
appMenus.add(menu.getName());
}
appCode = app.getCode();
}
}
}
MetaMenu parent = menu.getParent();
if (appCode == null && parent != null && menuApp.containsKey(parent.getName())) {
appCode = menuApp.get(parent.getName());
}
if (parent == null && appCode == null) {
configMenus.add(menu.getName());
}
if (menu.getTitle().equals("Configuration") || menu.getTitle().equals("Configurations")) {
configMenus.add(menu.getName());
appMenus.remove(menu.getName());
}
if (appCode == null) {
return defaultApp;
}
return appCode;
}
use of com.axelor.apps.base.db.App in project axelor-open-suite by axelor.
the class AccessTemplateServiceImpl method generateTemplate.
@Override
public MetaFile generateTemplate() throws AxelorException {
try {
menuApp = new HashMap<>();
objMenu = new HashMap<>();
configMenus = new ArrayList<>();
appMenus = new ArrayList<>();
defaultApp = null;
App app = Beans.get(AppRepository.class).findByCode("base");
if (app == null) {
return null;
}
defaultApp = app.getCode();
getMenusPerApp();
updateNoMenuObjects();
return createExcel();
} catch (Exception e) {
TraceBackService.trace(e);
throw new AxelorException(TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, e.getMessage());
}
}
use of com.axelor.apps.base.db.App 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);
}
Aggregations