use of com.axelor.apps.base.db.App in project axelor-open-suite by axelor.
the class AppController method importDataDemo.
public void importDataDemo(ActionRequest request, ActionResponse response) throws AxelorException, IOException {
App app = request.getContext().asType(App.class);
app = Beans.get(AppRepository.class).find(app.getId());
Beans.get(AppService.class).importDataDemo(app);
response.setFlash(I18n.get(IExceptionMessages.DEMO_DATA_SUCCESS));
response.setReload(true);
}
use of com.axelor.apps.base.db.App in project axelor-open-suite by axelor.
the class AppController method installApp.
public void installApp(ActionRequest request, ActionResponse response) throws AxelorException, IOException {
App app = request.getContext().asType(App.class);
app = Beans.get(AppRepository.class).find(app.getId());
Beans.get(AppService.class).installApp(app, null);
response.setSignal("refresh-app", true);
}
use of com.axelor.apps.base.db.App in project axelor-open-suite by axelor.
the class AppController method importRoles.
public void importRoles(ActionRequest request, ActionResponse response) throws AxelorException, IOException {
App app = request.getContext().asType(App.class);
app = Beans.get(AppRepository.class).find(app.getId());
Beans.get(AppService.class).importRoles(app);
response.setReload(true);
response.setFlash(I18n.get(IExceptionMessages.ROLE_IMPORT_SUCCESS));
}
use of com.axelor.apps.base.db.App in project axelor-open-suite by axelor.
the class ImportApp method importApp.
public Object importApp(Object bean, Map<String, Object> values) {
assert bean instanceof App;
App app = (App) bean;
final Path path = (Path) values.get("__path__");
String fileName = (String) values.get("imagePath");
if (!Strings.isNullOrEmpty(fileName)) {
try {
final File image = path.resolve("img" + File.separator + fileName).toFile();
if (image.exists()) {
final MetaFile metaFile = metaFiles.upload(image);
app.setImage(metaFile);
}
} catch (Exception e) {
LOG.warn("Can't load image {} for app {}", fileName, app.getName());
}
}
if (app.getLanguageSelect() == null) {
String language = AppSettings.get().get("application.locale");
app.setLanguageSelect(language);
}
return app;
}
use of com.axelor.apps.base.db.App in project axelor-open-suite by axelor.
the class AccessConfigImportServiceImpl method importMenuAccess.
private void importMenuAccess(XSSFSheet sheet) {
App app = Beans.get(AppRepository.class).findByCode(sheet.getSheetName().split("-")[0]);
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;
}
createMenuRoles(accessMap, rowIter.next());
}
}
Aggregations