コード例 #1
0
  private ValidationMessage convertMessage(final Message message) {
    final ValidationMessage msg = new ValidationMessage();
    switch (message.getLevel()) {
      case ERROR:
        msg.setLevel(ValidationMessage.Level.ERROR);
        break;
      case WARNING:
        msg.setLevel(ValidationMessage.Level.WARNING);
        break;
      case INFO:
        msg.setLevel(ValidationMessage.Level.INFO);
        break;
    }

    msg.setId(message.getId());
    msg.setLine(message.getLine());
    msg.setColumn(message.getColumn());
    msg.setText(message.getText());
    return msg;
  }
コード例 #2
0
  private List<ValidationMessage> doValidation(final Path path, final String content) {
    final List<ValidationMessage> validationMessages = new ArrayList<ValidationMessage>();
    final List<String> workItemDefinitions = new ArrayList<String>();
    workItemDefinitions.add(content);
    try {
      WorkDefinitionsParser.parse(workItemDefinitions);

    } catch (Exception e) {
      final ValidationMessage msg = new ValidationMessage();
      msg.setPath(path);
      msg.setLevel(Level.ERROR);
      msg.setText(e.getMessage());
      validationMessages.add(msg);
    }
    return validationMessages;
  }