Search in sources :

Example 1 with ObjectDataConfig

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

the class ObjectDataExportController method export.

public void export(ActionRequest request, ActionResponse response) throws AxelorException {
    ObjectDataConfigExport objDataConfigExport = request.getContext().asType(ObjectDataConfigExport.class);
    Long objectDataconfigId = objDataConfigExport.getObjectDataConfig().getId();
    ObjectDataConfig objectDataConfig = Beans.get(ObjectDataConfigRepository.class).find(objectDataconfigId);
    MetaFile dataFile = Beans.get(ObjectDataExportService.class).export(objectDataConfig, objDataConfigExport);
    if (dataFile != null) {
        response.setView(ActionView.define(I18n.get("Data")).add("html", "ws/rest/com.axelor.meta.db.MetaFile/" + dataFile.getId() + "/content/download?v=" + dataFile.getVersion()).param("download", "true").map());
    }
    response.setCanClose(true);
}
Also used : ObjectDataConfigExport(com.axelor.apps.base.db.ObjectDataConfigExport) ObjectDataExportService(com.axelor.apps.base.service.ObjectDataExportService) MetaFile(com.axelor.meta.db.MetaFile) ObjectDataConfigRepository(com.axelor.apps.base.db.repo.ObjectDataConfigRepository) ObjectDataConfig(com.axelor.apps.base.db.ObjectDataConfig)

Example 2 with ObjectDataConfig

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

the class ObjectDataExportController method anonymize.

public void anonymize(ActionRequest request, ActionResponse response) throws AxelorException {
    Context context = request.getContext();
    Long recordId = Long.parseLong(context.get("modelSelectId").toString());
    Long objectDataconfigId = Long.parseLong(context.get("objectDataConfigId").toString());
    ObjectDataConfig objectDataConfig = Beans.get(ObjectDataConfigRepository.class).find(objectDataconfigId);
    Beans.get(ObjectDataAnonymizeService.class).anonymize(objectDataConfig, recordId);
    response.setFlash("Data anonymized successfully");
    response.setCanClose(true);
}
Also used : Context(com.axelor.rpc.Context) ObjectDataAnonymizeService(com.axelor.apps.base.service.ObjectDataAnonymizeService) ObjectDataConfigRepository(com.axelor.apps.base.db.repo.ObjectDataConfigRepository) ObjectDataConfig(com.axelor.apps.base.db.ObjectDataConfig)

Aggregations

ObjectDataConfig (com.axelor.apps.base.db.ObjectDataConfig)2 ObjectDataConfigRepository (com.axelor.apps.base.db.repo.ObjectDataConfigRepository)2 ObjectDataConfigExport (com.axelor.apps.base.db.ObjectDataConfigExport)1 ObjectDataAnonymizeService (com.axelor.apps.base.service.ObjectDataAnonymizeService)1 ObjectDataExportService (com.axelor.apps.base.service.ObjectDataExportService)1 MetaFile (com.axelor.meta.db.MetaFile)1 Context (com.axelor.rpc.Context)1