/** * Copyright 2010 The University of Nottingham * * This file is part of lobbyservice. * * lobbyservice is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * lobbyservice is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with lobbyservice. If not, see <http://www.gnu.org/licenses/>. * */ package uk.ac.horizon.ug.lobby.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import com.google.appengine.api.datastore.Key; /** * @author cmg * */ @Entity public class GameInstance { /** key - autogenerated */ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key key; /** game template id */ private String gameTemplateId; /** server */ private Key gameServerId; /** title */ private String title; /** start time */ private long startTime; /** end time */ private long endTime; /** location name - human consumption */ private String locationName; /** latitude */ private int latitudeE6; /** longitude */ private int longitudeE6; /** radius metres (or 0) */ private double radiusMetres; /** current nominal status */ private GameInstanceNominalStatus nominalStatus; /** current/last known status */ private GameInstanceStatus status; /** visibility - i.e. seen by browsers or not*/ private GameTemplateVisibility visibility; /** max num slots */ private int maxNumSlots; /** allow anonymous (non-account) clients */ private boolean allowAnonymousClients; /** cache of num slots allocated */ private int numSlotsAllocated; /** cache of full */ private boolean full; /** game instance base url (several games may be hosted by the same GameServer) */ private String baseUrl; /** game instance factory key (if created from a game instance factory) */ private Key gameInstanceFactoryKey; /** created time */ private Long createdTime; /** server configuration info (JSON) - for lifecycle */ private String serverConfigJson; /** cons */ public GameInstance() { } /** * @return the key */ public Key getKey() { return key; } /** * @param key the key to set */ public void setKey(Key key) { this.key = key; } /** * @return the gameTemplateId */ public String getGameTemplateId() { return gameTemplateId; } /** * @param gameTemplateId the gameTemplateId to set */ public void setGameTemplateId(String gameTemplateId) { this.gameTemplateId = gameTemplateId; } /** * @return the gameServerId */ public Key getGameServerId() { return gameServerId; } /** * @param gameServerId the gameServerId to set */ public void setGameServerId(Key gameServerId) { this.gameServerId = gameServerId; } /** * @return the title */ public String getTitle() { return title; } /** * @param title the title to set */ public void setTitle(String title) { this.title = title; } /** * @return the latitudeE6 */ public int getLatitudeE6() { return latitudeE6; } /** * @param latitudeE6 the latitudeE6 to set */ public void setLatitudeE6(int latitudeE6) { this.latitudeE6 = latitudeE6; } /** * @return the longitudeE6 */ public int getLongitudeE6() { return longitudeE6; } /** * @param longitudeE6 the longitudeE6 to set */ public void setLongitudeE6(int longitudeE6) { this.longitudeE6 = longitudeE6; } /** * @return the radiusMetres */ public double getRadiusMetres() { return radiusMetres; } /** * @param radiusMetres the radiusMetres to set */ public void setRadiusMetres(double radiusMetres) { this.radiusMetres = radiusMetres; } /** * @return the startTime */ public long getStartTime() { return startTime; } /** * @param startTime the startTime to set */ public void setStartTime(long startTime) { this.startTime = startTime; } /** * @return the endTime */ public long getEndTime() { return endTime; } /** * @param endTime the endTime to set */ public void setEndTime(long endTime) { this.endTime = endTime; } /** * @return the status */ public GameInstanceStatus getStatus() { return status; } /** * @param status the status to set */ public void setStatus(GameInstanceStatus status) { this.status = status; } /** * @return the baseUrl */ public String getBaseUrl() { return baseUrl; } /** * @param baseUrl the baseUrl to set */ public void setBaseUrl(String baseUrl) { this.baseUrl = baseUrl; } /** * @return the nominalStatus */ public GameInstanceNominalStatus getNominalStatus() { return nominalStatus; } /** * @param nominalStatus the nominalStatus to set */ public void setNominalStatus(GameInstanceNominalStatus nominalStatus) { this.nominalStatus = nominalStatus; } /** * @return the visibility */ public GameTemplateVisibility getVisibility() { return visibility; } /** * @param visibility the visibility to set */ public void setVisibility(GameTemplateVisibility visibility) { this.visibility = visibility; } /** * @return the maxNumSlots */ public int getMaxNumSlots() { return maxNumSlots; } /** * @param maxNumSlots the maxNumSlots to set */ public void setMaxNumSlots(int maxNumSlots) { this.maxNumSlots = maxNumSlots; } /** * @return the allowAnonymousClients */ public boolean isAllowAnonymousClients() { return allowAnonymousClients; } /** * @param allowAnonymousClients the allowAnonymousClients to set */ public void setAllowAnonymousClients(boolean allowAnonymousClients) { this.allowAnonymousClients = allowAnonymousClients; } /** * @return the numSlotsAllocated */ public int getNumSlotsAllocated() { return numSlotsAllocated; } /** * @param numSlotsAllocated the numSlotsAllocated to set */ public void setNumSlotsAllocated(int numSlotsAllocated) { this.numSlotsAllocated = numSlotsAllocated; } /** * @return the full */ public boolean isFull() { return full; } /** * @param full the full to set */ public void setFull(boolean full) { this.full = full; } /** * @return the locationName */ public String getLocationName() { return locationName; } /** * @param locationName the locationName to set */ public void setLocationName(String locationName) { this.locationName = locationName; } /** * @return the gameInstanceFactoryKey */ public Key getGameInstanceFactoryKey() { return gameInstanceFactoryKey; } /** * @param gameInstanceFactoryKey the gameInstanceFactoryKey to set */ public void setGameInstanceFactoryKey(Key gameInstanceFactoryKey) { this.gameInstanceFactoryKey = gameInstanceFactoryKey; } /** * @return the createdTime */ public Long getCreatedTime() { return createdTime; } /** * @param createdTime the createdTime to set */ public void setCreatedTime(Long createdTime) { this.createdTime = createdTime; } /** * @return the serverConfigJson */ public String getServerConfigJson() { return serverConfigJson; } /** * @param serverConfigJson the serverConfigJson to set */ public void setServerConfigJson(String serverConfigJson) { this.serverConfigJson = serverConfigJson; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return "GameInstance [allowAnonymousClients=" + allowAnonymousClients + ", baseUrl=" + baseUrl + ", createdTime=" + createdTime + ", endTime=" + endTime + ", full=" + full + ", gameInstanceFactoryKey=" + gameInstanceFactoryKey + ", gameServerId=" + gameServerId + ", gameTemplateId=" + gameTemplateId + ", key=" + key + ", latitudeE6=" + latitudeE6 + ", locationName=" + locationName + ", longitudeE6=" + longitudeE6 + ", maxNumSlots=" + maxNumSlots + ", nominalStatus=" + nominalStatus + ", numSlotsAllocated=" + numSlotsAllocated + ", radiusMetres=" + radiusMetres + ", serverConfigJson=" + serverConfigJson + ", startTime=" + startTime + ", status=" + status + ", title=" + title + ", visibility=" + visibility + "]"; } }