/**
* 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 java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
import uk.ac.horizon.ug.lobby.protocol.GameTemplateInfo;
/** Information for a browser/viewer to show available game (templates).
* Heavily based on RSS for the first bit.
*
* A persistent instance is used for configuration.
*
* @author cmg
*
*/
@Entity
public class GameIndex {
/** key - autogenerated */
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Key key;
/** version - required */
private int version;
/** 'current' version */
public static final int CURRENT_VERSION = 1;
/** title (RSS2.0, required) */
private String title;
/** description (RSS2.0, required) */
private String description;
/** link - URL to corresponding website (RSS2.0, required) */
private String link;
/** language (RSS2.0, optional) */
private String language;
/** last build date - when content last changed - Java time (unlike RSS, which uses RFC822 format dates, optional) */
private long lastBuildDate;
/** time to line - minutes (RSS2.0, optional) */
private int ttlMinutes;
/** generator - program creating this (RSS2.0, optional) */
private String generator;
/** docs - URL of a description of the format (RSS2.0, optional) */
private String docs;
/** image / url (RSS2.0, optional), (not a sub-element as in RSS; title & link omitted) */
private String imageUrl;
/** game templates (with extra info) */
transient private List<GameTemplateInfo> items;
/** fixed name */
private static final String CONFIGURATION_NAME = "configuration";
/** get default key */
public static Key getConfigurationKey() {
Key parentKey = ServerConfiguration.getConfigurationKey();
return KeyFactory.createKey(parentKey, GameIndex.class.getSimpleName(), CONFIGURATION_NAME);
}
/** cons */
public GameIndex() {
}
/**
* @return the key
*/
public Key getKey() {
return key;
}
/**
* @param key the key to set
*/
public void setKey(Key key) {
this.key = key;
}
/**
* @return the version
*/
public int getVersion() {
return version;
}
/**
* @param version the version to set
*/
public void setVersion(int version) {
this.version = version;
}
/**
* @return the title
*/
public String getTitle() {
return title;
}
/**
* @param title the title to set
*/
public void setTitle(String title) {
this.title = title;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the link
*/
public String getLink() {
return link;
}
/**
* @param link the link to set
*/
public void setLink(String link) {
this.link = link;
}
/**
* @return the language
*/
public String getLanguage() {
return language;
}
/**
* @param language the language to set
*/
public void setLanguage(String language) {
this.language = language;
}
/**
* @return the lastBuildDate
*/
public long getLastBuildDate() {
return lastBuildDate;
}
/**
* @param lastBuildDate the lastBuildDate to set
*/
public void setLastBuildDate(long lastBuildDate) {
this.lastBuildDate = lastBuildDate;
}
/**
* @return the ttlMinutes
*/
public int getTtlMinutes() {
return ttlMinutes;
}
/**
* @param ttlMinutes the ttlMinutes to set
*/
public void setTtlMinutes(int ttlMinutes) {
this.ttlMinutes = ttlMinutes;
}
/**
* @return the generator
*/
public String getGenerator() {
return generator;
}
/**
* @param generator the generator to set
*/
public void setGenerator(String generator) {
this.generator = generator;
}
/**
* @return the docs
*/
public String getDocs() {
return docs;
}
/**
* @param docs the docs to set
*/
public void setDocs(String docs) {
this.docs = docs;
}
/**
* @return the imageUrl
*/
public String getImageUrl() {
return imageUrl;
}
/**
* @param imageUrl the imageUrl to set
*/
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
/**
* @return the items
*/
public List<GameTemplateInfo> getItems() {
return items;
}
/**
* @param items the items to set
*/
public void setItems(List<GameTemplateInfo> items) {
this.items = items;
}
}