예제 #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);
    }
  }