use of com.rebuild.core.configuration.ConfigBean in project rebuild by getrebuild.
the class FormDesignController method page.
@GetMapping("form-design")
public ModelAndView page(@PathVariable String entity, HttpServletRequest request) {
ModelAndView mv = createModelAndView("/admin/metadata/form-design");
MetaEntityController.setEntityBase(mv, entity);
mv.getModel().put("isSuperAdmin", UserHelper.isSuperAdmin(getRequestUser(request)));
ConfigBean config = FormsManager.instance.getFormLayout(entity, getRequestUser(request));
if (config != null) {
request.setAttribute("FormConfig", config.toJSON());
}
return mv;
}
use of com.rebuild.core.configuration.ConfigBean in project rebuild by getrebuild.
the class ListStatsController method gets.
@GetMapping("{entity}/list-stats")
public JSON gets(@PathVariable String entity, HttpServletRequest request) {
final ID user = getRequestUser(request);
ConfigBean config = DataListManager.instance.getListStatsField(user, entity);
JSONObject configJson = config == null ? new JSONObject() : (JSONObject) config.getJSON("config");
// 可用字段
JSONArray afields = new JSONArray();
for (Field field : MetadataSorter.sortFields(MetadataHelper.getEntity(entity), DisplayType.NUMBER, DisplayType.DECIMAL)) {
afields.add(EasyMetaFactory.toJSON(field));
}
configJson.put("fields", afields);
return configJson;
}
use of com.rebuild.core.configuration.ConfigBean in project rebuild by getrebuild.
the class WidgetController method gets.
@GetMapping("widget-charts")
public void gets(@PathVariable String entity, HttpServletRequest request, HttpServletResponse response) {
ID user = getRequestUser(request);
ConfigBean config = DataListManager.instance.getWidgetCharts(user, entity);
writeSuccess(response, config == null ? null : config.toJSON());
}
use of com.rebuild.core.configuration.ConfigBean in project rebuild by getrebuild.
the class AdvFilterController method sets.
@PostMapping("advfilter/post")
public RespBody sets(@PathVariable String entity, HttpServletRequest request) {
final ID user = getRequestUser(request);
ID filterId = getIdParameter(request, "id");
String filterName = getParameter(request, "name");
// 不是自己的就另存为
if (filterId != null && !UserHelper.isSelf(user, filterId)) {
if (StringUtils.isBlank(filterName)) {
ConfigBean o = AdvFilterManager.instance.getAdvFilter(filterId);
if (o != null) {
filterName = o.getString("name") + "-" + Language.L("复制");
}
}
filterId = null;
}
JSON filter = ServletUtils.getRequestJson(request);
Record record;
if (filterId == null) {
record = EntityHelper.forNew(EntityHelper.FilterConfig, user);
record.setString("belongEntity", entity);
if (StringUtils.isBlank(filterName)) {
filterName = Language.L("查询") + "-" + CalendarUtils.format("MMddHHmm", CalendarUtils.now());
}
} else {
record = EntityHelper.forUpdate(filterId, user);
}
record.setString("config", filter.toJSONString());
putCommonsFields(request, record);
if (StringUtils.isNotBlank(filterName)) {
record.setString("filterName", filterName);
}
record = Application.getBean(AdvFilterService.class).createOrUpdate(record);
return RespBody.ok(JSONUtils.toJSONObject("id", record.getPrimary()));
}
use of com.rebuild.core.configuration.ConfigBean in project rebuild by getrebuild.
the class ProjectManager method getPlansOfProject.
/**
* 获取项目的任务面板
*
* @param projectId
* @return
*/
public ConfigBean[] getPlansOfProject(ID projectId) {
Assert.notNull(projectId, "[projectId] cannot be null");
final String ckey = CKEY_PLANS + projectId;
ConfigBean[] cached = (ConfigBean[]) Application.getCommonsCache().getx(ckey);
if (cached == null) {
Object[][] array = Application.createQueryNoFilter("select configId,planName,flowStatus,flowNexts from ProjectPlanConfig where projectId = ? order by seq").setParameter(1, projectId).array();
List<ConfigBean> alist = new ArrayList<>();
for (Object[] o : array) {
ConfigBean e = new ConfigBean().set("id", o[0]).set("planName", o[1]).set("flowStatus", o[2]);
if (StringUtils.isNotBlank((String) o[3])) {
List<ID> nexts = new ArrayList<>();
for (String s : ((String) o[3]).split(",")) {
nexts.add(ID.valueOf(s));
}
e.set("flowNexts", nexts);
}
alist.add(e);
}
cached = alist.toArray(new ConfigBean[0]);
Application.getCommonsCache().putx(ckey, cached);
}
return cached.clone();
}
Aggregations