use of com.icthh.xm.ms.entity.domain.FunctionContext in project xm-ms-entity by xm-online.
the class FunctionResource method callMvcFunction.
/**
* POST /functions/mvc/{functionKey} : Execute a mvc function by key (key in entity specification).
*
* @param functionKey the function key to execute
* @param functionInput function input data context
* @return ModelAndView object
*/
@Timed
@PostMapping("/functions/mvc/{functionKey:.+}")
@PreAuthorize("hasPermission(null, 'FUNCTION.MVC.CALL')")
public ModelAndView callMvcFunction(@PathVariable("functionKey") String functionKey, @RequestBody Map<String, Object> functionInput) {
FunctionContext result = functionService.execute(functionKey, functionInput);
Object data = result.getData().get("modelAndView");
if (data instanceof ModelAndView) {
return (ModelAndView) data;
}
return null;
}
use of com.icthh.xm.ms.entity.domain.FunctionContext in project xm-ms-entity by xm-online.
the class FunctionServiceImpl method toFunctionContext.
private FunctionContext toFunctionContext(String functionKey, IdOrKey idOrKey, Map<String, Object> data) {
XmEntity xmEntity = (idOrKey != null) ? xmEntityService.findOne(idOrKey) : null;
FunctionContext functionResult = new FunctionContext();
// TODO review key & typeKey ...
functionResult.setKey(functionKey + "-" + UUID.randomUUID().toString());
functionResult.setTypeKey(functionKey);
functionResult.setData(data);
functionResult.setStartDate(Instant.now());
functionResult.setUpdateDate(functionResult.getStartDate());
functionResult.setXmEntity(xmEntity);
return functionResult;
}
Aggregations