use of com.rebuild.core.service.trigger.ActionType in project rebuild by getrebuild.
the class MetaschemaImporter method performTrigger.
private void performTrigger(String entity, JSONObject config) {
Entity configEntity = MetadataHelper.getEntity(EntityHelper.RobotTriggerConfig);
config.put("metadata", JSONUtils.toJSONObject("entity", configEntity.getName()));
config.put("belongEntity", entity);
String actionType = config.getString("actionType");
boolean available = false;
for (ActionType type : ActionFactory.getAvailableActions()) {
if (type.name().equalsIgnoreCase(actionType)) {
available = true;
break;
}
}
if (!available) {
log.warn("Trigger `{}` unavailable", actionType);
return;
}
Record record = new EntityRecordCreator(configEntity, config, getUser()).create();
Application.getBean(RobotTriggerConfigService.class).create(record);
}
use of com.rebuild.core.service.trigger.ActionType in project rebuild by getrebuild.
the class I18nGettextParser method sysDefined.
// 系统定义的
static void sysDefined(JSONObject into) {
into.put("_", "中文");
for (DisplayType o : DisplayType.values()) into.put(o.getDisplayName(), o.getDisplayName());
for (ActionType o : ActionType.values()) into.put(o.getDisplayName(), o.getDisplayName());
for (ApprovalState s : ApprovalState.values()) into.put(s.getName(), s.getName());
for (Entity entity : Application.getPersistManagerFactory().getMetadataFactory().getEntities()) {
if (!EasyMetaFactory.valueOf(entity).isBuiltin())
continue;
sysDefinedMeta(entity, into);
for (Field field : entity.getFields()) {
if (!EasyMetaFactory.valueOf(field).isBuiltin())
continue;
sysDefinedMeta(field, into);
}
}
into.put("__", "__");
}
use of com.rebuild.core.service.trigger.ActionType in project rebuild by getrebuild.
the class TriggerAdminController method pageEditor.
@GetMapping("trigger/{id}")
public ModelAndView pageEditor(@PathVariable String id, HttpServletResponse response) throws IOException {
ID configId = ID.valueOf(id);
Object[] config = Application.createQuery("select belongEntity,actionType,when,whenFilter,actionContent,priority,name,whenTimer from RobotTriggerConfig where configId = ?").setParameter(1, configId).unique();
if (config == null) {
response.sendError(404);
return null;
}
Entity sourceEntity = MetadataHelper.getEntity((String) config[0]);
ActionType actionType = ActionType.valueOf((String) config[1]);
ModelAndView mv = createModelAndView("/admin/robot/trigger-design");
mv.getModel().put("configId", configId);
mv.getModel().put("sourceEntity", sourceEntity.getName());
mv.getModel().put("sourceEntityLabel", EasyMetaFactory.getLabel(sourceEntity));
mv.getModel().put("actionType", actionType.name());
mv.getModel().put("actionTypeLabel", Language.L(actionType));
mv.getModel().put("when", config[2]);
mv.getModel().put("whenTimer", config[7] == null ? StringUtils.EMPTY : config[7]);
mv.getModel().put("whenFilter", config[3]);
mv.getModel().put("actionContent", config[4]);
mv.getModel().put("priority", config[5]);
mv.getModel().put("name", config[6]);
mv.getModel().put("lockedUser", JSON.toJSONString(CommonsLock.getLockedUserFormat(configId)));
return mv;
}
Aggregations