1
2
3
4
5 package com.hack23.cia.model.sweden.impl;
6
7 import javax.persistence.DiscriminatorValue;
8 import javax.persistence.Entity;
9 import javax.persistence.Transient;
10
11 import org.hibernate.annotations.Cache;
12 import org.hibernate.annotations.CacheConcurrencyStrategy;
13
14 /***
15 * The Class BallotResult.
16 */
17 @Entity
18 @DiscriminatorValue("BallotResult")
19 @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
20 public class BallotResult extends AbstractBallotResult {
21
22 /*** The Constant serialVersionUID. */
23 private static final long serialVersionUID = 1L;
24
25 /***
26 * Instantiates a new ballot result.
27 */
28 public BallotResult() {
29 super();
30 }
31
32 /***
33 * Checks if is losing vote.
34 *
35 * @param vote the vote
36 * @return true, if is losing vote
37 */
38 @Transient
39 public boolean isLosingVote(final Vote vote) {
40 if (Vote.Position.Absent.equals(vote.getPosition())) {
41 return false;
42 } else {
43 return !getWinningPosition().equals(vote.getPosition());
44 }
45 }
46 }