瀏覽代碼

working on odds and ends, goal in sight

jacob andersen 5 年之前
父節點
當前提交
499a9b1d02

+ 22
- 0
src/main/java/dtos/OptionCount.java 查看文件

@@ -0,0 +1,22 @@
1
+package dtos;
2
+
3
+public class OptionCount {
4
+    private Long optionId;
5
+    private int count;
6
+
7
+    public Long getOptionId() {
8
+        return optionId;
9
+    }
10
+
11
+    public void setOptionId(Long optionId) {
12
+        this.optionId = optionId;
13
+    }
14
+
15
+    public int getCount() {
16
+        return count;
17
+    }
18
+
19
+    public void setCount(int count) {
20
+        this.count = count;
21
+    }
22
+}

+ 23
- 0
src/main/java/dtos/VoteResult.java 查看文件

@@ -0,0 +1,23 @@
1
+package dtos;
2
+
3
+import java.util.Collection;
4
+public class VoteResult {
5
+    private int totalVotes;
6
+    private Collection<OptionCount> results;
7
+
8
+    public int getTotalVotes() {
9
+        return totalVotes;
10
+    }
11
+
12
+    public void setTotalVotes(int totalVotes) {
13
+        this.totalVotes = totalVotes;
14
+    }
15
+
16
+    public Collection<OptionCount> getResults() {
17
+        return results;
18
+    }
19
+
20
+    public void setResults(Collection<OptionCount> results) {
21
+        this.results = results;
22
+    }
23
+}

+ 32
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/controller/ComputeResultController.java 查看文件

@@ -0,0 +1,32 @@
1
+package io.zipcoder.tc_spring_poll_application.controller;
2
+
3
+import dtos.VoteResult;
4
+import io.zipcoder.tc_spring_poll_application.domain.Vote;
5
+import io.zipcoder.tc_spring_poll_application.repositories.VoteRepository;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.http.HttpStatus;
8
+import org.springframework.http.ResponseEntity;
9
+import org.springframework.web.bind.annotation.RequestMapping;
10
+import org.springframework.web.bind.annotation.RequestMethod;
11
+import org.springframework.web.bind.annotation.RequestParam;
12
+import org.springframework.web.bind.annotation.RestController;
13
+
14
+@RestController
15
+public class ComputeResultController {
16
+
17
+    private VoteRepository voteRepository;
18
+
19
+    @Autowired
20
+    public ComputeResultController(VoteRepository voteRepository) {
21
+        this.voteRepository = voteRepository;
22
+    }
23
+
24
+    @RequestMapping(value = "/computeresult", method = RequestMethod.GET)
25
+    public ResponseEntity<?> computeResult(@RequestParam Long pollId) {
26
+        VoteResult voteResult = new VoteResult();
27
+        Iterable<Vote> allVotes = voteRepository.findVotesByPoll(pollId);
28
+
29
+        //TODO: Implement algorithm to count votes
30
+        return new ResponseEntity<VoteResult>(voteResult, HttpStatus.OK);
31
+    }
32
+}

+ 72
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/controller/PollController.java 查看文件

@@ -0,0 +1,72 @@
1
+package io.zipcoder.tc_spring_poll_application.controller;
2
+
3
+import io.zipcoder.tc_spring_poll_application.domain.Poll;
4
+import io.zipcoder.tc_spring_poll_application.exception.ResourceNotFoundException;
5
+import io.zipcoder.tc_spring_poll_application.repositories.PollRepository;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.http.HttpHeaders;
8
+import org.springframework.http.HttpStatus;
9
+import org.springframework.http.ResponseEntity;
10
+import org.springframework.web.bind.annotation.*;
11
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
12
+
13
+import java.net.URI;
14
+
15
+@RestController
16
+public class PollController {
17
+
18
+    private PollRepository pollRepository;
19
+
20
+    @Autowired
21
+    public PollController(PollRepository p) {
22
+        this.pollRepository = p;
23
+
24
+    }
25
+
26
+    @RequestMapping(value="/polls", method= RequestMethod.GET)
27
+    public ResponseEntity<Iterable<Poll>> getAllPolls() {
28
+        Iterable<Poll> allPolls = pollRepository.findAll();
29
+        return new ResponseEntity<>(allPolls, HttpStatus.OK);
30
+    }
31
+
32
+    @RequestMapping(value="/polls", method=RequestMethod.POST)
33
+    public ResponseEntity<?> createPoll(@RequestBody Poll poll) {
34
+        poll = pollRepository.save(poll);
35
+
36
+        URI newPollUri = ServletUriComponentsBuilder
37
+                .fromCurrentRequest()
38
+                .path("/{id}")
39
+                .buildAndExpand(poll.getId())
40
+                .toUri();
41
+
42
+        HttpHeaders httpHeaders = new HttpHeaders();
43
+        httpHeaders.setLocation(newPollUri);
44
+
45
+        return new ResponseEntity<>(httpHeaders, HttpStatus.CREATED);
46
+    }
47
+
48
+    @RequestMapping(value="/polls/{pollId}", method=RequestMethod.GET)
49
+    public ResponseEntity<?> getPoll(@PathVariable Long pollId) {
50
+        Poll p = pollRepository.findOne(pollId);
51
+        return new ResponseEntity<> (p, HttpStatus.OK);
52
+    }
53
+
54
+    @RequestMapping(value="/polls/{pollId}", method=RequestMethod.PUT)
55
+    public ResponseEntity<?> updatePoll(@RequestBody Poll poll, @PathVariable Long pollId) {
56
+        // Save the entity
57
+        Poll p = pollRepository.save(poll);
58
+        return new ResponseEntity<>(HttpStatus.OK);
59
+    }
60
+
61
+    @RequestMapping(value="/polls/{pollId}", method=RequestMethod.DELETE)
62
+    public ResponseEntity<?> deletePoll(@PathVariable Long pollId) {
63
+        pollRepository.delete(pollId);
64
+        return new ResponseEntity<>(HttpStatus.OK);
65
+    }
66
+
67
+    public void verifyPoll(Long id)
68
+    {
69
+        if (!pollRepository.exists(id))
70
+            throw new ResourceNotFoundException();
71
+    }
72
+}

+ 42
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/controller/VoteController.java 查看文件

@@ -0,0 +1,42 @@
1
+package io.zipcoder.tc_spring_poll_application.controller;
2
+
3
+import io.zipcoder.tc_spring_poll_application.domain.Vote;
4
+import io.zipcoder.tc_spring_poll_application.repositories.VoteRepository;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.http.HttpHeaders;
7
+import org.springframework.http.HttpStatus;
8
+import org.springframework.http.ResponseEntity;
9
+import org.springframework.web.bind.annotation.*;
10
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
11
+
12
+@RestController
13
+public class VoteController {
14
+
15
+    private VoteRepository voteRepository;
16
+
17
+    @Autowired
18
+    public VoteController(VoteRepository voteRepository) {
19
+        this.voteRepository = voteRepository;
20
+    }
21
+
22
+    @RequestMapping(value = "/polls/{pollId}/votes", method = RequestMethod.POST)
23
+    public ResponseEntity<?> createVote(@PathVariable Long pollId, @RequestBody Vote
24
+            vote) {
25
+        vote = voteRepository.save(vote);
26
+        // Set the headers for the newly created resource
27
+        HttpHeaders responseHeaders = new HttpHeaders();
28
+        responseHeaders.setLocation(ServletUriComponentsBuilder.
29
+                fromCurrentRequest().path("/{id}").buildAndExpand(vote.getId()).toUri());
30
+        return new ResponseEntity<>(null, responseHeaders, HttpStatus.CREATED);
31
+    }
32
+
33
+    @RequestMapping(value="/polls/votes", method=RequestMethod.GET)
34
+    public Iterable<Vote> getAllVotes() {
35
+        return voteRepository.findAll();
36
+    }
37
+
38
+    @RequestMapping(value="/polls/{pollId}/votes", method=RequestMethod.GET)
39
+    public Iterable<Vote> getVote(@PathVariable Long pollId) {
40
+        return voteRepository.findById(pollId);
41
+    }
42
+}

+ 34
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/domain/Option.java 查看文件

@@ -0,0 +1,34 @@
1
+package io.zipcoder.tc_spring_poll_application.domain;
2
+
3
+import javax.persistence.Column;
4
+import javax.persistence.Entity;
5
+import javax.persistence.GeneratedValue;
6
+import javax.persistence.Id;
7
+
8
+@Entity
9
+public class Option {
10
+
11
+    @Id
12
+    @GeneratedValue
13
+    @Column(name = "OPTION_ID")
14
+    private Long id;
15
+
16
+    @Column(name = "OPTION_VALUE")
17
+    String value;
18
+
19
+    public Long getId() {
20
+        return id;
21
+    }
22
+
23
+    public void setId(Long id) {
24
+        this.id = id;
25
+    }
26
+
27
+    public String getValue() {
28
+        return value;
29
+    }
30
+
31
+    public void setValue(String value) {
32
+        this.value = value;
33
+    }
34
+}

+ 52
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/domain/Poll.java 查看文件

@@ -0,0 +1,52 @@
1
+package io.zipcoder.tc_spring_poll_application.domain;
2
+
3
+import com.sun.javafx.beans.IDProperty;
4
+import org.hibernate.validator.constraints.NotEmpty;
5
+
6
+import javax.persistence.*;
7
+import javax.validation.constraints.Size;
8
+import java.util.Set;
9
+
10
+@Entity
11
+public class Poll {
12
+
13
+    @Id
14
+    @GeneratedValue
15
+    @Column(name = "POLL_ID")
16
+    private Long id;
17
+
18
+    @Column(name = "QUESTION")
19
+    @NotEmpty
20
+    private String question;
21
+
22
+
23
+    @OneToMany(cascade = CascadeType.ALL)
24
+    @JoinColumn(name = "POLL_ID")
25
+    @OrderBy
26
+    @Size (min=2, max=6)
27
+    Set<Option> options;
28
+
29
+    public Long getId() {
30
+        return id;
31
+    }
32
+
33
+    public void setId(Long id) {
34
+        this.id = id;
35
+    }
36
+
37
+    public String getQuestion() {
38
+        return question;
39
+    }
40
+
41
+    public void setQuestion(String question) {
42
+        this.question = question;
43
+    }
44
+
45
+    public Set<Option> getOptions() {
46
+        return options;
47
+    }
48
+
49
+    public void setOptions(Set<Option> options) {
50
+        this.options = options;
51
+    }
52
+}

+ 35
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/domain/Vote.java 查看文件

@@ -0,0 +1,35 @@
1
+package io.zipcoder.tc_spring_poll_application.domain;
2
+
3
+
4
+import javax.persistence.*;
5
+
6
+@Entity
7
+public class Vote {
8
+
9
+
10
+
11
+    @Id
12
+    @GeneratedValue
13
+    @Column(name = "VOTE_ID")
14
+    private Long id;
15
+
16
+    @ManyToOne
17
+    @JoinColumn(name = "OPTION_ID")
18
+    private Option option;
19
+
20
+    public Long getId() {
21
+        return id;
22
+    }
23
+
24
+    public void setId(Long id) {
25
+        this.id = id;
26
+    }
27
+
28
+    public Option getOption() {
29
+        return option;
30
+    }
31
+
32
+    public void setOption(Option option) {
33
+        this.option = option;
34
+    }
35
+}

+ 62
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/dto/error/ErrorDetail.java 查看文件

@@ -0,0 +1,62 @@
1
+package io.zipcoder.tc_spring_poll_application.dto.error;
2
+
3
+import java.util.List;
4
+import java.util.Map;
5
+
6
+public class ErrorDetail
7
+{
8
+    private String title;
9
+    private int status;
10
+    private String detail;
11
+    private long timeStamp;
12
+    private String developerMessage;
13
+    private Map<String, List<ValidationError>> errors;
14
+
15
+    public String getTitle() {
16
+        return title;
17
+    }
18
+
19
+    public void setTitle(String title) {
20
+        this.title = title;
21
+    }
22
+
23
+    public int getStatus() {
24
+        return status;
25
+    }
26
+
27
+    public void setStatus(int status) {
28
+        this.status = status;
29
+    }
30
+
31
+    public String getDetail() {
32
+        return detail;
33
+    }
34
+
35
+    public void setDetail(String detail) {
36
+        this.detail = detail;
37
+    }
38
+
39
+    public long getTimeStamp() {
40
+        return timeStamp;
41
+    }
42
+
43
+    public void setTimeStamp(long timeStamp) {
44
+        this.timeStamp = timeStamp;
45
+    }
46
+
47
+    public String getDeveloperMessage() {
48
+        return developerMessage;
49
+    }
50
+
51
+    public void setDeveloperMessage(String developerMessage) {
52
+        this.developerMessage = developerMessage;
53
+    }
54
+
55
+    public Map<String, List<ValidationError>> getErrors() {
56
+        return errors;
57
+    }
58
+
59
+    public void setErrors(Map<String, List<ValidationError>> errors) {
60
+        this.errors = errors;
61
+    }
62
+}

+ 57
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/dto/error/RestExceptionHandler.java 查看文件

@@ -0,0 +1,57 @@
1
+package io.zipcoder.tc_spring_poll_application.dto.error;
2
+
3
+import io.zipcoder.tc_spring_poll_application.exception.ResourceNotFoundException;
4
+import org.springframework.beans.factory.annotation.Autowired;
5
+import org.springframework.context.MessageSource;
6
+import org.springframework.http.HttpStatus;
7
+import org.springframework.http.ResponseEntity;
8
+import org.springframework.validation.FieldError;
9
+import org.springframework.web.bind.MethodArgumentNotValidException;
10
+import org.springframework.web.bind.annotation.ControllerAdvice;
11
+import org.springframework.web.bind.annotation.ExceptionHandler;
12
+
13
+import javax.servlet.http.HttpServletRequest;
14
+import java.util.ArrayList;
15
+import java.util.Date;
16
+import java.util.List;
17
+
18
+@ControllerAdvice
19
+public class RestExceptionHandler {
20
+
21
+    ErrorDetail errorDetail;
22
+
23
+    @Autowired
24
+    MessageSource messageSource;
25
+
26
+    @ExceptionHandler(ResourceNotFoundException.class)
27
+    public ResponseEntity<?> handleResourceNotFoundException(ResourceNotFoundException rnfe, HttpServletRequest request)
28
+    {
29
+        ErrorDetail errdetail = new ErrorDetail();
30
+
31
+        errdetail.setTimeStamp(new Date().getTime());
32
+        errdetail.setStatus(404);
33
+        errdetail.setDetail("Resource couldn't be found");
34
+
35
+        return null;
36
+    }
37
+
38
+    @ExceptionHandler(MethodArgumentNotValidException.class)
39
+    public ResponseEntity<?> handleValidationError(  MethodArgumentNotValidException manve,
40
+                            HttpServletRequest request)
41
+    {
42
+        List<FieldError> fieldErrors =  manve.getBindingResult().getFieldErrors();
43
+        for(FieldError fe : fieldErrors) {
44
+
45
+            List<ValidationError> validationErrorList = errorDetail.getErrors().get(fe.getField());
46
+            if(validationErrorList == null) {
47
+                validationErrorList = new ArrayList<>();
48
+                errorDetail.getErrors().put(fe.getField(), validationErrorList);
49
+            }
50
+            ValidationError validationError = new ValidationError();
51
+            validationError.setCode(fe.getCode());
52
+            validationError.setMessage(messageSource.getMessage(fe, null));
53
+            validationErrorList.add(validationError);
54
+        }
55
+        return null;
56
+    }
57
+}

+ 23
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/dto/error/ValidationError.java 查看文件

@@ -0,0 +1,23 @@
1
+package io.zipcoder.tc_spring_poll_application.dto.error;
2
+
3
+public class ValidationError
4
+{
5
+    private String code;
6
+    private String message;
7
+
8
+    public String getCode() {
9
+        return code;
10
+    }
11
+
12
+    public void setCode(String code) {
13
+        this.code = code;
14
+    }
15
+
16
+    public String getMessage() {
17
+        return message;
18
+    }
19
+
20
+    public void setMessage(String message) {
21
+        this.message = message;
22
+    }
23
+}

+ 21
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/exception/ResourceNotFoundException.java 查看文件

@@ -0,0 +1,21 @@
1
+package io.zipcoder.tc_spring_poll_application.exception;
2
+
3
+import org.springframework.http.HttpStatus;
4
+import org.springframework.web.bind.annotation.ResponseStatus;
5
+
6
+@ResponseStatus(HttpStatus.NOT_FOUND)
7
+public class ResourceNotFoundException extends RuntimeException
8
+{
9
+    public ResourceNotFoundException(){}
10
+
11
+    public ResourceNotFoundException(String message)
12
+    {
13
+    super (message);
14
+    }
15
+
16
+    public ResourceNotFoundException(String message, Throwable cause)
17
+    {
18
+        super (message, cause);
19
+    }
20
+
21
+}

+ 8
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/repositories/OptionRepository.java 查看文件

@@ -0,0 +1,8 @@
1
+package io.zipcoder.tc_spring_poll_application.repositories;
2
+
3
+import io.zipcoder.tc_spring_poll_application.domain.Option;
4
+import org.springframework.data.repository.CrudRepository;
5
+
6
+public interface OptionRepository extends CrudRepository<Option, Long> {
7
+
8
+}

+ 7
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/repositories/PollRepository.java 查看文件

@@ -0,0 +1,7 @@
1
+package io.zipcoder.tc_spring_poll_application.repositories;
2
+
3
+import io.zipcoder.tc_spring_poll_application.domain.Poll;
4
+import org.springframework.data.repository.CrudRepository;
5
+
6
+public interface PollRepository extends CrudRepository<Poll, Long> {
7
+}

+ 15
- 0
src/main/java/io/zipcoder/tc_spring_poll_application/repositories/VoteRepository.java 查看文件

@@ -0,0 +1,15 @@
1
+package io.zipcoder.tc_spring_poll_application.repositories;
2
+
3
+import io.zipcoder.tc_spring_poll_application.domain.Vote;
4
+import org.springframework.data.jpa.repository.Query;
5
+import org.springframework.data.repository.CrudRepository;
6
+
7
+public interface VoteRepository extends CrudRepository<Vote, Long> {
8
+    @Query(value = "SELECT v.* " +
9
+            "FROM Option o, Vote v " +
10
+            "WHERE o.POLL_ID = ?1 " +
11
+            "AND v.OPTION_ID = o.OPTION_ID", nativeQuery = true)
12
+    public Iterable<Vote> findVotesByPoll(Long pollId);
13
+
14
+    Iterable<Vote> findById(Long pollId);
15
+}

+ 76
- 0
src/main/resources/import.sql 查看文件

@@ -0,0 +1,76 @@
1
+insert into poll (poll_id, question) values (1, 'What is your favorite color?')
2
+insert into poll (poll_id, question) values (2, 'What is your favorite song?')
3
+insert into poll (poll_id, question) values (3, 'What is your favorite man?')
4
+insert into poll (poll_id, question) values (4, 'What is your favorite woman?')
5
+insert into poll (poll_id, question) values (5, 'What is your favorite pet?')
6
+insert into poll (poll_id, question) values (6, 'What is your favorite fast food?')
7
+insert into poll (poll_id, question) values (7, 'What is your favorite soda?')
8
+insert into poll (poll_id, question) values (8, 'What is your favorite chocolate?')
9
+insert into poll (poll_id, question) values (9, 'What is your favorite country?')
10
+insert into poll (poll_id, question) values (10, 'What is your favorite language?')
11
+insert into poll (poll_id, question) values (11, 'What is your favorite beach?')
12
+insert into poll (poll_id, question) values (12, 'What is your favorite job?')
13
+insert into poll (poll_id, question) values (13, 'What is your favorite food?')
14
+insert into poll (poll_id, question) values (14, 'What is your favorite flower?')
15
+insert into poll (poll_id, question) values (15, 'What is your favorite car?')
16
+
17
+
18
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 1);
19
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 1);
20
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 1);
21
+
22
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 2);
23
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 2);
24
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 2);
25
+
26
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 3);
27
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 3);
28
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 3);
29
+
30
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 4);
31
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 4);
32
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 4);
33
+
34
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 5);
35
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 5);
36
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 5);
37
+
38
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 6);
39
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 6);
40
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 6);
41
+
42
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 7);
43
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 7);
44
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 7);
45
+
46
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 8);
47
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 8);
48
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 8);
49
+
50
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 9);
51
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 9);
52
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 9);
53
+
54
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 10);
55
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 10);
56
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 10);
57
+
58
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 11);
59
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 11);
60
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 11);
61
+
62
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 12);
63
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 12);
64
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 12);
65
+
66
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 13);
67
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 13);
68
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 13);
69
+
70
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 14);
71
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 14);
72
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 14);
73
+
74
+insert into option (option_id, option_value, poll_id) values (1, 'Red', 15);
75
+insert into option (option_id, option_value, poll_id) values (2, 'Red', 15);
76
+insert into option (option_id, option_value, poll_id) values (3, 'Red', 15);

+ 2
- 0
src/main/resources/messages.properties 查看文件

@@ -0,0 +1,2 @@
1
+NotEmpty.poll.question=Question is a required field
2
+Size.poll.options=Options must be greater than {2} and less than {1}