Advertisement
Guest User

PlayerEntity

a guest
Feb 8th, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 13.06 KB | None | 0 0
  1. package com.castlesbattles.model.to;
  2.  
  3. import org.hibernate.annotations.Cascade;
  4.  
  5. import javax.persistence.*;
  6. import java.util.List;
  7.  
  8. /**
  9.  * Created by Reza on 1/29/2016.
  10.  */
  11. @Entity
  12. @javax.persistence.Table(name = "player", schema = "castles_battles", catalog = "")
  13. public class PlayerEntity {
  14.     private int id;
  15.     private String username;
  16.     private String password;
  17.     private String deviceId;
  18.     private String email;
  19.     private String loginToken;
  20.     private long registerTime;
  21.     private long lastLoginTime;
  22.     private String notificationToken;
  23.     private String deviceName;
  24.     private String deviceModel;
  25.     private int androidApiVersion;
  26.     private int appVersion;
  27.     private String advisingCode;
  28.     private int money;
  29.     private int xp;
  30.     private int level;
  31.     private int totalRating;
  32.     private int totalGamePlayed;
  33.     private int totalWinRatio;
  34.     private int weeklyRating;
  35.     private int totalLoot;
  36.     private int winDefences;
  37.     private int gemsPurchased;
  38.     private int gemsUsed;
  39.     private String singlePlayerData;
  40.     private boolean realPlayer;
  41.     private String extraData;
  42.     private boolean banned;
  43.     private String banReason;
  44.     private List<TownEntity> towns;
  45.     private List<MessageEntity> messages;
  46.  
  47.     @Id
  48.     @GeneratedValue(strategy = GenerationType.IDENTITY)
  49.     @javax.persistence.Column(name = "id", nullable = false)
  50.     public int getId() {
  51.         return id;
  52.     }
  53.  
  54.     public void setId(int id) {
  55.         this.id = id;
  56.     }
  57.  
  58.     @Basic
  59.     @javax.persistence.Column(name = "username", nullable = true, length = 50)
  60.     public String getUsername() {
  61.         return username;
  62.     }
  63.  
  64.     public void setUsername(String username) {
  65.         this.username = username;
  66.     }
  67.  
  68.     @Basic
  69.     @javax.persistence.Column(name = "password", nullable = true, length = 256)
  70.     public String getPassword() {
  71.         return password;
  72.     }
  73.  
  74.     public void setPassword(String password) {
  75.         this.password = password;
  76.     }
  77.  
  78.     @Basic
  79.     @javax.persistence.Column(name = "device_id", unique = true, nullable = true, length = 45)
  80.     public String getDeviceId() {
  81.         return deviceId;
  82.     }
  83.  
  84.     public void setDeviceId(String deviceId) {
  85.         this.deviceId = deviceId;
  86.     }
  87.  
  88.     @Basic
  89.     @javax.persistence.Column(name = "email", nullable = true, length = 45)
  90.     public String getEmail() {
  91.         return email;
  92.     }
  93.  
  94.     public void setEmail(String email) {
  95.         this.email = email;
  96.     }
  97.  
  98.     @Basic
  99.     @javax.persistence.Column(name = "login_token", nullable = true, length = 300)
  100.     public String getLoginToken() {
  101.         return loginToken;
  102.     }
  103.  
  104.     public void setLoginToken(String loginToken) {
  105.         this.loginToken = loginToken;
  106.     }
  107.  
  108.     @Basic
  109.     @javax.persistence.Column(name = "register_time", nullable = true)
  110.     public long getRegisterTime() {
  111.         return registerTime;
  112.     }
  113.  
  114.     public void setRegisterTime(long registerTime) {
  115.         this.registerTime = registerTime;
  116.     }
  117.  
  118.     @Basic
  119.     @javax.persistence.Column(name = "last_login_time", nullable = true)
  120.     public long getLastLoginTime() {
  121.         return lastLoginTime;
  122.     }
  123.  
  124.     public void setLastLoginTime(long lastLoginTime) {
  125.         this.lastLoginTime = lastLoginTime;
  126.     }
  127.  
  128.     @Basic
  129.     @javax.persistence.Column(name = "notification_token", nullable = true, length = 300)
  130.     public String getNotificationToken() {
  131.         return notificationToken;
  132.     }
  133.  
  134.     public void setNotificationToken(String notificationToken) {
  135.         this.notificationToken = notificationToken;
  136.     }
  137.  
  138.     @Basic
  139.     @javax.persistence.Column(name = "device_name", nullable = true, length = 45)
  140.     public String getDeviceName() {
  141.         return deviceName;
  142.     }
  143.  
  144.     public void setDeviceName(String deviceName) {
  145.         this.deviceName = deviceName;
  146.     }
  147.  
  148.     @Basic
  149.     @javax.persistence.Column(name = "device_model", nullable = true, length = 45)
  150.     public String getDeviceModel() {
  151.         return deviceModel;
  152.     }
  153.  
  154.     public void setDeviceModel(String deviceModel) {
  155.         this.deviceModel = deviceModel;
  156.     }
  157.  
  158.     @Basic
  159.     @javax.persistence.Column(name = "android_api_version", nullable = true)
  160.     public int getAndroidApiVersion() {
  161.         return androidApiVersion;
  162.     }
  163.  
  164.     public void setAndroidApiVersion(int androidApiVersion) {
  165.         this.androidApiVersion = androidApiVersion;
  166.     }
  167.  
  168.     @Basic
  169.     @javax.persistence.Column(name = "app_version", nullable = true)
  170.     public int getAppVersion() {
  171.         return appVersion;
  172.     }
  173.  
  174.     public void setAppVersion(int appVersion) {
  175.         this.appVersion = appVersion;
  176.     }
  177.  
  178.     @Basic
  179.     @javax.persistence.Column(name = "advising_code", nullable = true, length = 20)
  180.     public String getAdvisingCode() {
  181.         return advisingCode;
  182.     }
  183.  
  184.     public void setAdvisingCode(String advisingCode) {
  185.         this.advisingCode = advisingCode;
  186.     }
  187.  
  188.     @Basic
  189.     @javax.persistence.Column(name = "money", nullable = true)
  190.     public int getMoney() {
  191.         return money;
  192.     }
  193.  
  194.     public void setMoney(int money) {
  195.         this.money = money;
  196.     }
  197.  
  198.     @Basic
  199.     @javax.persistence.Column(name = "xp", nullable = true)
  200.     public int getXp() {
  201.         return xp;
  202.     }
  203.  
  204.     public void setXp(int xp) {
  205.         this.xp = xp;
  206.     }
  207.  
  208.     @Basic
  209.     @javax.persistence.Column(name = "level", nullable = true)
  210.     public int getLevel() {
  211.         return level;
  212.     }
  213.  
  214.     public void setLevel(int level) {
  215.         this.level = level;
  216.     }
  217.  
  218.     @Basic
  219.     @javax.persistence.Column(name = "total_rating", nullable = true)
  220.     public int getTotalRating() {
  221.         return totalRating;
  222.     }
  223.  
  224.     public void setTotalRating(int totalRating) {
  225.         this.totalRating = totalRating;
  226.     }
  227.  
  228.     @Basic
  229.     @javax.persistence.Column(name = "total_game_played", nullable = true)
  230.     public int getTotalGamePlayed() {
  231.         return totalGamePlayed;
  232.     }
  233.  
  234.     public void setTotalGamePlayed(int totalGamePlayed) {
  235.         this.totalGamePlayed = totalGamePlayed;
  236.     }
  237.  
  238.     @Basic
  239.     @javax.persistence.Column(name = "total_win_ratio", nullable = true)
  240.     public int getTotalWinRatio() {
  241.         return totalWinRatio;
  242.     }
  243.  
  244.     public void setTotalWinRatio(int totalWinRatio) {
  245.         this.totalWinRatio = totalWinRatio;
  246.     }
  247.  
  248.     @Basic
  249.     @javax.persistence.Column(name = "weekly_rating", nullable = true)
  250.     public int getWeeklyRating() {
  251.         return weeklyRating;
  252.     }
  253.  
  254.     public void setWeeklyRating(int weeklyRating) {
  255.         this.weeklyRating = weeklyRating;
  256.     }
  257.  
  258.     @Basic
  259.     @javax.persistence.Column(name = "total_loot", nullable = true)
  260.     public int getTotalLoot() {
  261.         return totalLoot;
  262.     }
  263.  
  264.     public void setTotalLoot(int totalLoot) {
  265.         this.totalLoot = totalLoot;
  266.     }
  267.  
  268.     @Basic
  269.     @javax.persistence.Column(name = "win_defences", nullable = true)
  270.     public int getWinDefences() {
  271.         return winDefences;
  272.     }
  273.  
  274.     public void setWinDefences(int winDefences) {
  275.         this.winDefences = winDefences;
  276.     }
  277.  
  278.     @Basic
  279.     @javax.persistence.Column(name = "gems_purchased", nullable = true)
  280.     public int getGemsPurchased() {
  281.         return gemsPurchased;
  282.     }
  283.  
  284.     public void setGemsPurchased(int gemsPurchased) {
  285.         this.gemsPurchased = gemsPurchased;
  286.     }
  287.  
  288.     @Basic
  289.     @javax.persistence.Column(name = "gems_used", nullable = true)
  290.     public int getGemsUsed() {
  291.         return gemsUsed;
  292.     }
  293.  
  294.     public void setGemsUsed(int gemsUsed) {
  295.         this.gemsUsed = gemsUsed;
  296.     }
  297.  
  298.     @Basic
  299.     @javax.persistence.Column(name = "single_player_data", nullable = true, length = 4096)
  300.     public String getSinglePlayerData() {
  301.         return singlePlayerData;
  302.     }
  303.  
  304.     public void setSinglePlayerData(String singlePlayerData) {
  305.         this.singlePlayerData = singlePlayerData;
  306.     }
  307.  
  308.     @Basic
  309.     @javax.persistence.Column(name = "real_player", nullable = true)
  310.     public boolean isRealPlayer() {
  311.         return realPlayer;
  312.     }
  313.  
  314.     public void setRealPlayer(boolean realPlayer) {
  315.         this.realPlayer = realPlayer;
  316.     }
  317.  
  318.     @Basic
  319.     @javax.persistence.Column(name = "extra_data", nullable = true, length = 2048)
  320.     public String getExtraData() {
  321.         return extraData;
  322.     }
  323.  
  324.     public void setExtraData(String extraData) {
  325.         this.extraData = extraData;
  326.     }
  327.  
  328.     @Basic
  329.     @javax.persistence.Column(name = "banned", nullable = true)
  330.     public boolean isBanned() {
  331.         return banned;
  332.     }
  333.  
  334.     public void setBanned(boolean banned) {
  335.         this.banned = banned;
  336.     }
  337.  
  338.     @Basic
  339.     @javax.persistence.Column(name = "ban_reason", nullable = true, length = 500)
  340.     public String getBanReason() {
  341.         return banReason;
  342.     }
  343.  
  344.     public void setBanReason(String banReason) {
  345.         this.banReason = banReason;
  346.     }
  347.  
  348.     @Override
  349.     public boolean equals(Object o) {
  350.         if (this == o) return true;
  351.         if (o == null || getClass() != o.getClass()) return false;
  352.  
  353.         PlayerEntity that = (PlayerEntity) o;
  354.  
  355.         if (id != that.id) return false;
  356.         if (money != that.money) return false;
  357.         if (xp != that.xp) return false;
  358.         if (level != that.level) return false;
  359.         if (totalRating != that.totalRating) return false;
  360.         if (totalGamePlayed != that.totalGamePlayed) return false;
  361.         if (totalWinRatio != that.totalWinRatio) return false;
  362.         if (weeklyRating != that.weeklyRating) return false;
  363.         if (totalLoot != that.totalLoot) return false;
  364.         if (winDefences != that.winDefences) return false;
  365.         if (gemsPurchased != that.gemsPurchased) return false;
  366.         if (gemsUsed != that.gemsUsed) return false;
  367.         if (realPlayer != that.realPlayer) return false;
  368.         if (banned != that.banned) return false;
  369.         if (username != null ? !username.equals(that.username) : that.username != null) return false;
  370.         if (password != null ? !password.equals(that.password) : that.password != null) return false;
  371.         if (deviceId != null ? !deviceId.equals(that.deviceId) : that.deviceId != null) return false;
  372.         if (email != null ? !email.equals(that.email) : that.email != null) return false;
  373.         if (loginToken != null ? !loginToken.equals(that.loginToken) : that.loginToken != null) return false;
  374.         if (notificationToken != null ? !notificationToken.equals(that.notificationToken) : that.notificationToken != null)
  375.             return false;
  376.         if (advisingCode != null ? !advisingCode.equals(that.advisingCode) : that.advisingCode != null) return false;
  377.         if (singlePlayerData != null ? !singlePlayerData.equals(that.singlePlayerData) : that.singlePlayerData != null)
  378.             return false;
  379.         if (extraData != null ? !extraData.equals(that.extraData) : that.extraData != null) return false;
  380.         if (banReason != null ? !banReason.equals(that.banReason) : that.banReason != null) return false;
  381.  
  382.         return true;
  383.     }
  384.  
  385.     @Override
  386.     public int hashCode() {
  387.         int result = id;
  388.         result = 31 * result + (username != null ? username.hashCode() : 0);
  389.         result = 31 * result + (password != null ? password.hashCode() : 0);
  390.         result = 31 * result + (deviceId != null ? deviceId.hashCode() : 0);
  391.         result = 31 * result + (email != null ? email.hashCode() : 0);
  392.         result = 31 * result + (loginToken != null ? loginToken.hashCode() : 0);
  393.         result = 31 * result + (notificationToken != null ? notificationToken.hashCode() : 0);
  394.         result = 31 * result + (advisingCode != null ? advisingCode.hashCode() : 0);
  395.         result = 31 * result + money;
  396.         result = 31 * result + xp;
  397.         result = 31 * result + level;
  398.         result = 31 * result + totalRating;
  399.         result = 31 * result + totalGamePlayed;
  400.         result = 31 * result + totalWinRatio;
  401.         result = 31 * result + weeklyRating;
  402.         result = 31 * result + totalLoot;
  403.         result = 31 * result + winDefences;
  404.         result = 31 * result + gemsPurchased;
  405.         result = 31 * result + gemsUsed;
  406.         result = 31 * result + (singlePlayerData != null ? singlePlayerData.hashCode() : 0);
  407.         result = 31 * result + (realPlayer ? 1 : 0);
  408.         result = 31 * result + (extraData != null ? extraData.hashCode() : 0);
  409.         result = 31 * result + (banned ? 1 : 0);
  410.         result = 31 * result + (banReason != null ? banReason.hashCode() : 0);
  411.         return result;
  412.     }
  413.  
  414.     @OneToMany(mappedBy = "player", cascade = CascadeType.ALL)
  415.     @Cascade(org.hibernate.annotations.CascadeType.ALL)
  416.     public List<TownEntity> getTowns() {
  417.         return towns;
  418.     }
  419.  
  420.     public void setTowns(List<TownEntity> towns) {
  421.         this.towns = towns;
  422.     }
  423.  
  424.     @OneToMany(mappedBy = "player", cascade = CascadeType.ALL)
  425.     @Cascade(org.hibernate.annotations.CascadeType.ALL)
  426.     public List<MessageEntity> getMessages() {
  427.         return messages;
  428.     }
  429.  
  430.     public void setMessages(List<MessageEntity> messages) {
  431.         this.messages = messages;
  432.     }
  433. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement