use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.
the class WkfModelController method newRecord.
@SuppressWarnings("unchecked")
public void newRecord(ActionRequest request, ActionResponse response) {
try {
LinkedHashMap<String, Object> _map = (LinkedHashMap<String, Object>) request.getData().get("context");
String modelName = _map.get("modelName").toString();
boolean isMetaModel = (boolean) _map.get("isMetaModel");
ActionViewBuilder actionViewBuilder = this.viewNewRecord(modelName, isMetaModel);
response.setView(actionViewBuilder.map());
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.
the class WkfModelController method newInstance.
@SuppressWarnings({ "unchecked", "rawtypes" })
public void newInstance(ActionRequest request, ActionResponse response) {
try {
LinkedHashMap<String, Object> _map = (LinkedHashMap<String, Object>) request.getData().get("context");
WkfProcessConfig config = Beans.get(WkfProcessConfigRepository.class).find(Long.valueOf(((Map) _map.get("processConfig")).get("id").toString()));
boolean isMetaModel = config.getMetaModel() != null;
String modelName = isMetaModel ? config.getMetaModel().getName() : config.getMetaJsonModel().getName();
ActionViewBuilder actionViewBuilder = this.viewNewRecord(modelName, isMetaModel);
response.setView(actionViewBuilder.map());
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.
the class WkfModelController method viewNewRecord.
private ActionViewBuilder viewNewRecord(String modelName, boolean isMetaModel) {
ActionViewBuilder actionViewBuilder = null;
if (isMetaModel) {
MetaModel metaModel = Beans.get(MetaModelRepository.class).findByName(modelName);
String viewPrefix = Inflector.getInstance().dasherize(metaModel.getName());
actionViewBuilder = ActionView.define(metaModel.getName()).model(metaModel.getFullName()).add("form", viewPrefix + "-form");
} else {
MetaJsonModel metaJsonModel = Beans.get(MetaJsonModelRepository.class).findByName(modelName);
actionViewBuilder = ActionView.define(metaJsonModel.getTitle()).model(MetaJsonRecord.class.getName()).add("form", metaJsonModel.getFormView().getName()).domain("self.jsonModel = :jsonModel").context("jsonModel", modelName);
}
return actionViewBuilder;
}
use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.
the class WkfModelController method createActionBuilder.
private ActionViewBuilder createActionBuilder(String status, MetaModel metaModel) {
String viewPrefix = Inflector.getInstance().dasherize(metaModel.getName());
String title = Strings.isNullOrEmpty(status) ? metaModel.getName() : metaModel.getName() + "-" + status;
ActionViewBuilder actionViewBuilder = ActionView.define(title).model(metaModel.getFullName()).add("grid", viewPrefix + "-grid").add("form", viewPrefix + "-form").domain("self.id IN (:ids)");
return actionViewBuilder;
}
use of com.axelor.meta.schema.actions.ActionView.ActionViewBuilder in project axelor-open-suite by axelor.
the class AccountingReportController method showMoveExported.
public void showMoveExported(ActionRequest request, ActionResponse response) {
AccountingReport accountingReport = request.getContext().asType(AccountingReport.class);
ActionViewBuilder actionViewBuilder = ActionView.define(I18n.get(IExceptionMessage.ACCOUNTING_REPORT_6));
actionViewBuilder.model(Move.class.getName());
actionViewBuilder.add("grid", "move-grid");
actionViewBuilder.param("search-filters", "move-filters");
actionViewBuilder.domain("self.accountingReport.id = :_accountingReportId");
actionViewBuilder.context("_accountingReportId", accountingReport.getId());
response.setView(actionViewBuilder.map());
}
Aggregations