コード例 #1
0
  @After("execution(* org.goldratio.services.MessageService.create(..))")
  public void createMessageOperation(JoinPoint joinPoint) {
    Object[] args = joinPoint.getArgs();
    if (args != null && args.length > 0 && args[0] instanceof Message) {

      Message project = (Message) args[0];

      Operation operation = new Operation();
      operation.setTargetType(TargetType.message);
      operation.setOpType(OperationType.create);
      operation.setTargetId(project.getId());
      operation.setAuthorId(project.getAuthorId());
      operation.setCreateTime(project.getCreateTime());
      operation.setTitle(project.getTitle());
      operation.setTeamId(project.getTeamId());
      operation.setProjectId(project.getProjectId());
      operationRepository.save(operation);

      userService.sendMessage(project);
    }
  }
コード例 #2
0
  @After("execution(* org.goldratio.services.CommentService.create(..))")
  public void createCommentOperation(JoinPoint joinPoint) {
    Object[] args = joinPoint.getArgs();
    if (args != null && args.length > 0 && args[0] instanceof Comment) {

      Comment project = (Comment) args[0];

      Operation operation = new Operation();
      operation.setTargetType(TargetType.comment);
      operation.setOpType(OperationType.create);
      operation.setTargetId(project.getId());
      operation.setAuthorId(project.getAuthorId());
      operation.setCreateTime(project.getCreateTime());
      Message message = messageRepository.findById(project.getMessageId());
      operation.setTitle(message.getTitle());
      operation.setDigest(project.getContent());
      operation.setTeamId(project.getTeamId());
      operation.setProjectId(project.getProjectId());
      operationRepository.save(operation);

      userService.sendMessage(project);
    }
  }
コード例 #3
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);
    }
  }