Search in sources :

Example 1 with App

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);
}
Also used : App(com.axelor.apps.base.db.App) AppService(com.axelor.apps.base.service.app.AppService)

Example 2 with App

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);
}
Also used : App(com.axelor.apps.base.db.App) AppService(com.axelor.apps.base.service.app.AppService)

Example 3 with App

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));
}
Also used : App(com.axelor.apps.base.db.App) AppService(com.axelor.apps.base.service.app.AppService)

Example 4 with App

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;
}
Also used : App(com.axelor.apps.base.db.App) Path(java.nio.file.Path) MetaFile(com.axelor.meta.db.MetaFile) MetaFile(com.axelor.meta.db.MetaFile) File(java.io.File)

Example 5 with 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());
    }
}
Also used : App(com.axelor.apps.base.db.App) AppRepository(com.axelor.apps.base.db.repo.AppRepository) Row(org.apache.poi.ss.usermodel.Row) AccessConfig(com.axelor.apps.base.db.AccessConfig)

Aggregations

App (com.axelor.apps.base.db.App)18 AppRepository (com.axelor.apps.base.db.repo.AppRepository)7 AppService (com.axelor.apps.base.service.app.AppService)7 AxelorException (com.axelor.exception.AxelorException)3 File (java.io.File)3 ArrayList (java.util.ArrayList)3 AccessConfig (com.axelor.apps.base.db.AccessConfig)2 XMLImporter (com.axelor.data.xml.XMLImporter)2 MetaFile (com.axelor.meta.db.MetaFile)2 AppBuilder (com.axelor.studio.db.AppBuilder)2 FileOutputStream (java.io.FileOutputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 HashSet (java.util.HashSet)2 AppSettings (com.axelor.app.AppSettings)1 IExceptionMessages (com.axelor.apps.base.exceptions.IExceptionMessages)1 FileUtils (com.axelor.common.FileUtils)1 Inflector (com.axelor.common.Inflector)1 Importer (com.axelor.data.Importer)1 CSVBind (com.axelor.data.csv.CSVBind)1