示例#1
0
  @After("execution(* org.goldratio.services.TodoItemService.create(..))")
  public void createTodoItemOperation(JoinPoint joinPoint) {
    Object[] args = joinPoint.getArgs();
    if (args != null && args.length > 0 && args[0] instanceof TodoItem) {

      TodoItem project = (TodoItem) args[0];

      Operation operation = new Operation();
      operation.setTargetType(TargetType.todoItem);
      operation.setOpType(OperationType.create);
      operation.setTargetId(project.getId());
      operation.setAuthorId(project.getAuthorId());
      operation.setCreateTime(project.getCreateTime());
      TodoList todoList = todoListRepository.findById(project.getTodoListId());
      operation.setTitle(todoList.getTitle());
      operation.setDigest(project.getTitle());
      operation.setTeamId(project.getTeamId());
      operation.setProjectId(project.getProjectId());
      operationRepository.save(operation);

      userService.sendMessage(project);
    }
  }