Commit 09f270ec by Tuomas Riihimäki

Merge branch 'master' of dev.intra.insomnia.fi:/data/bortal

2 parents afd08334 ee59250a
*/nbproject/private
*/build
*/dist
*/nbproject/faces-config.NavData
......@@ -45,9 +45,6 @@ public class AccessRight implements ModelInterface {
@Column(name = "right_description")
private String description;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "accessRight")
private List<NewsGroup> newsGroups;
@OneToMany(mappedBy = "accessRight")
private List<RoleRight> roleRights;
......@@ -87,14 +84,6 @@ public class AccessRight implements ModelInterface {
this.name = accessRight;
}
public List<NewsGroup> getNewsGroupList() {
return newsGroups;
}
public void setNewsGroupList(List<NewsGroup> newsGroupList) {
this.newsGroups = newsGroupList;
}
public List<RoleRight> getRoleRightList() {
return roleRights;
}
......
......@@ -73,6 +73,12 @@ public class Bill implements ModelInterface {
@ManyToOne(optional = false)
private User user;
@ManyToOne
@JoinColumn(name = "events_id", referencedColumnName = "events_id")
private Event event;
@Override
public Integer getId() {
return id;
......@@ -83,6 +89,8 @@ public class Bill implements ModelInterface {
this.id = id;
}
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -186,4 +194,18 @@ public class Bill implements ModelInterface {
public int getJpaVersionField() {
return jpaVersionField;
}
/**
* @return the event
*/
public Event getEvent() {
return event;
}
/**
* @param event the event to set
*/
public void setEvent(Event event) {
this.event = event;
}
}
......@@ -75,6 +75,10 @@ public class Compo implements ModelInterface {
@Column(name = "description")
private String description;
@Column(name = "max_participant_count")
private int maxParticipantCount;
@Column(name = "hold_voting", nullable = false, columnDefinition = "boolean default true")
private boolean holdVoting;
......@@ -229,4 +233,18 @@ public class Compo implements ModelInterface {
return description;
}
/**
* @return the maxParticipantCount
*/
public int getMaxParticipantCount() {
return maxParticipantCount;
}
/**
* @param maxParticipantCount the maxParticipantCount to set
*/
public void setMaxParticipantCount(int maxParticipantCount) {
this.maxParticipantCount = maxParticipantCount;
}
}
......@@ -5,6 +5,7 @@
package fi.insomnia.bortal.model;
import java.util.Calendar;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
......@@ -15,6 +16,8 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;
/**
......@@ -37,6 +40,14 @@ public class CompoEntryParticipant implements ModelInterface {
@Column(name = "role")
private String role;
@Column(name = "nick")
private String nick;
@Column(name = "confirmed")
@Temporal(TemporalType.TIMESTAMP)
private Calendar confirmed;
@JoinColumn(name = "entries_id", referencedColumnName = "entries_id", nullable = false)
@ManyToOne(optional = false)
private CompoEntry entry;
......@@ -144,4 +155,32 @@ public class CompoEntryParticipant implements ModelInterface {
return jpaVersionField;
}
/**
* @return the nick
*/
public String getNick() {
return nick;
}
/**
* @param nick the nick to set
*/
public void setNick(String nick) {
this.nick = nick;
}
/**
* @return the confirmed
*/
public Calendar getConfirmed() {
return confirmed;
}
/**
* @param confirmed the confirmed to set
*/
public void setConfirmed(Calendar confirmed) {
this.confirmed = confirmed;
}
}
......@@ -85,6 +85,12 @@ public class Event implements ModelInterface {
@Version
@Column(nullable = false)
private int jpaVersionField;
@OneToMany(mappedBy = "event")
private List<Bill> bills;
@OneToMany(mappedBy = "event")
private List<Reader> readers;
public Event() {
}
......@@ -246,4 +252,32 @@ public class Event implements ModelInterface {
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
/**
* @return the bills
*/
public List<Bill> getBills() {
return bills;
}
/**
* @param bills the bills to set
*/
public void setBills(List<Bill> bills) {
this.bills = bills;
}
/**
* @return the readers
*/
public List<Reader> getReaders() {
return readers;
}
/**
* @param readers the readers to set
*/
public void setReaders(List<Reader> readers) {
this.readers = readers;
}
}
......@@ -55,6 +55,8 @@ public class EventMap implements ModelInterface {
@Version
@Column(nullable = false)
private int jpaVersionField;
@OneToMany(mappedBy = "eventMap")
private List<Reader> readers;
public EventMap() {
}
......@@ -155,4 +157,18 @@ public class EventMap implements ModelInterface {
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
/**
* @return the readers
*/
public List<Reader> getReaders() {
return readers;
}
/**
* @param readers the readers to set
*/
public void setReaders(List<Reader> readers) {
this.readers = readers;
}
}
......@@ -12,6 +12,8 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
......@@ -36,15 +38,20 @@ public class EventSettings implements ModelInterface {
@Column(name = "event_settings_id", nullable = false)
private Integer id;
@Column(name = "base_name")
private String baseName;
@Column(name = "organisation")
private String organisation;
@Column(name = "style_sheet")
private String styleSheet;
@Column(name = "bundle_country")
private String bundleCountry;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "settings")
private List<Event> events;
@ManyToOne
@JoinColumn(name = "users_id", referencedColumnName = "users_id", nullable = false)
private User admin;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -56,22 +63,6 @@ public class EventSettings implements ModelInterface {
this.id = eventSettingsId;
}
public String getBaseName() {
return baseName;
}
public void setBaseName(String resourceBundle) {
this.baseName = resourceBundle;
}
public String getStyleSheet() {
return styleSheet;
}
public void setStyleSheet(String styleSheet) {
this.styleSheet = styleSheet;
}
public List<Event> getEvents() {
return events;
}
......@@ -140,4 +131,46 @@ public class EventSettings implements ModelInterface {
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
/**
* @return the organisation
*/
public String getOrganisation() {
return organisation;
}
/**
* @param organisation the organisation to set
*/
public void setOrganisation(String organisation) {
this.organisation = organisation;
}
/**
* @return the bundleCountry
*/
public String getBundleCountry() {
return bundleCountry;
}
/**
* @param bundleCountry the bundleCountry to set
*/
public void setBundleCountry(String bundleCountry) {
this.bundleCountry = bundleCountry;
}
/**
* @return the admin
*/
public User getAdmin() {
return admin;
}
/**
* @param admin the admin to set
*/
public void setAdmin(User admin) {
this.admin = admin;
}
}
......@@ -64,6 +64,12 @@ public class GroupMembership implements ModelInterface {
@ManyToOne
private User user;
@Column(name = "entered_event")
@Temporal(TemporalType.TIMESTAMP)
private Calendar enteredEvent;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -183,4 +189,18 @@ public class GroupMembership implements ModelInterface {
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
/**
* @return the enteredEvent
*/
public Calendar getEnteredEvent() {
return enteredEvent;
}
/**
* @param enteredEvent the enteredEvent to set
*/
public void setEnteredEvent(Calendar enteredEvent) {
this.enteredEvent = enteredEvent;
}
}
......@@ -13,8 +13,9 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
......@@ -51,9 +52,9 @@ public class NewsGroup implements ModelInterface {
@Column(name = "priority", nullable = false)
private int priority;
@JoinColumn(name = "access_rights_id", referencedColumnName = "access_rights_id", nullable = false)
@ManyToOne(optional = false)
private AccessRight accessRight;
@ManyToMany
@JoinTable(name = "roles_news_groups", joinColumns = @JoinColumn(name = "news_groups_id", referencedColumnName = "news_groups_id"), inverseJoinColumns = @JoinColumn(name = "roles_id", referencedColumnName = "roles_id"))
private List<Role> roles;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "group")
private List<News> news;
......@@ -99,14 +100,6 @@ public class NewsGroup implements ModelInterface {
this.priority = priority;
}
public AccessRight getAccessRight() {
return accessRight;
}
public void setAccessRight(AccessRight accessRightsId) {
this.accessRight = accessRightsId;
}
public List<News> getNews() {
return news;
}
......@@ -176,4 +169,18 @@ public class NewsGroup implements ModelInterface {
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
/**
* @return the roles
*/
public List<Role> getRoles() {
return roles;
}
/**
* @param roles the roles to set
*/
public void setRoles(List<Role> roles) {
this.roles = roles;
}
}
......@@ -54,6 +54,21 @@ public class Reader implements ModelInterface {
@ManyToOne
private Location location;
@ManyToOne
@JoinColumn(name = "events_id", referencedColumnName = "events_id")
private Event event;
@ManyToOne
@JoinColumn(name = "maps_id", referencedColumnName = "maps_id")
private EventMap eventMap;
@Column(name = "map_x")
private Integer mapX;
@Column(name = "map_y")
private Integer mapY;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -157,4 +172,60 @@ public class Reader implements ModelInterface {
public void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
/**
* @return the event
*/
public Event getEvent() {
return event;
}
/**
* @param event the event to set
*/
public void setEvent(Event event) {
this.event = event;
}
/**
* @return the mapX
*/
public Integer getMapX() {
return mapX;
}
/**
* @param mapX the mapX to set
*/
public void setMapX(Integer mapX) {
this.mapX = mapX;
}
/**
* @return the mapY
*/
public Integer getMapY() {
return mapY;
}
/**
* @param mapY the mapY to set
*/
public void setMapY(Integer mapY) {
this.mapY = mapY;
}
/**
* @return the eventMap
*/
public EventMap getEventMap() {
return eventMap;
}
/**
* @param eventMap the eventMap to set
*/
public void setEventMap(EventMap eventMap) {
this.eventMap = eventMap;
}
}
......@@ -67,10 +67,14 @@ public class Role implements ModelInterface {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "role")
private List<Discount> discounts;
@ManyToMany(mappedBy = "roles")
private List<NewsGroup> newsGroups;
@Version
@Column(nullable = false)
private int jpaVersionField;
public Role() {
}
......
......@@ -114,6 +114,14 @@ public class User implements ModelInterface {
@Lob
private String login;
@Column(name = "confirm_hash")
@Lob
private String confirmHash;
@Column(name = "confirm_time")
@Temporal(TemporalType.TIMESTAMP)
private Calendar confirmTime;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "voter")
private List<Vote> votes;
......@@ -163,6 +171,10 @@ public class User implements ModelInterface {
@Column(nullable = false)
private int jpaVersionField;
@OneToMany(mappedBy = "admin")
private List<EventSettings> eventSettings;
public User() {
}
......@@ -480,4 +492,46 @@ public class User implements ModelInterface {
public List<AccountEvent> getSoldItems() {
return soldItems;
}
/**
* @return the confirmHash
*/
public String getConfirmHash() {
return confirmHash;
}
/**
* @param confirmHash the confirmHash to set
*/
public void setConfirmHash(String confirmHash) {
this.confirmHash = confirmHash;
}
/**
* @return the confirmTime
*/
public Calendar getConfirmTime() {
return confirmTime;
}
/**
* @param confirmTime the confirmTime to set
*/
public void setConfirmTime(Calendar confirmTime) {
this.confirmTime = confirmTime;
}
/**
* @return the eventSettings
*/
public List<EventSettings> getEventSettings() {
return eventSettings;
}
/**
* @param eventSettings the eventSettings to set
*/
public void setEventSettings(List<EventSettings> eventSettings) {
this.eventSettings = eventSettings;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="BortalDb" transaction-type="JTA">
<jta-data-source>jdbc/bortalDatabase</jta-data-source>
<jta-data-source>jdbc/bortal</jta-data-source>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.ddl-generation.output-mode" value="database"/>
<property name="eclipselink.target-database" value="MySQL"/>
</properties>
</persistence-unit>
</persistence>
......@@ -25,7 +25,7 @@
<f:facet name="header">
<h:outputText value="Real name" />
</f:facet>
<h:outputText value="#{user.name}" />
<h:outputText value="#{user.firstnames}" />
</h:column>
<h:column>
<f:facet name="header">
......
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.handler;
import javax.enterprise.context.SessionScoped;
import javax.faces.bean.ManagedBean;
/**
*
* @author tuukka
*/
@ManagedBean(name="SessionHandler")
@SessionScoped
public class SessionHandler {
/** Creates a new instance of SessionHandler */
public SessionHandler() {
}
private boolean hasPermission(String target) {
throw new UnsupportedOperationException("Not yet implemented");
}
}
......@@ -19,82 +19,73 @@ public class UserView {
@EJB
private UserBeanLocal userBean;
private static final Logger logger = LoggerFactory.getLogger(UserView.class);
private User user;
private ListDataModel<User> items;
private String nick;
private String password;
public String edit() {
setUser(items.getRowData());
return "edit";
setUser(items.getRowData());
return "edit";
}
public String getLocale()
{
return "en_IN_XII";
public String getLocale() {
return "en_IN_XII";
}
public String createUser() {
logger.info("Saving user");
// Luodaan uusi kÔøΩyttÔøΩjÔøΩ UserBeanin funktiolla createNewUser jolle
// annetaan parametrina pakolliset tiedot ( nick ja salasana )
// Paluuarvona saadaan uusi uljas k�ytt�j�-olio.
setUser(userBean.createNewUser(nick, password));
nick = "";
password = "";
if (getUser() == null) {
logger.warn("Could not create user. function returned null!");
return "fault";
}
return "edit";
logger.info("Saving user");
// Luodaan uusi kÔøΩyttÔøΩjÔøΩ UserBeanin funktiolla createNewUser jolle
// annetaan parametrina pakolliset tiedot ( nick ja salasana )
// Paluuarvona saadaan uusi uljas k�ytt�j�-olio.
setUser(userBean.createNewUser(nick, password));
nick = "";
password = "";
if (getUser() == null) {
logger.warn("Could not create user. function returned null!");
return "fault";
}
return "edit";
}
public String saveUser() {
userBean.mergeChanges(getUser());
return "edit";
userBean.mergeChanges(getUser());
return "edit";
}
public ListDataModel<User> getUsers() {
List<User> users = userBean.getUsers();
items = new ListDataModel<User>(users);
logger.info("Fetching users. Found {}", items.getRowCount());
return items;
List<User> users = userBean.getUsers();
items = new ListDataModel<User>(users);
logger.info("Fetching users. Found {}", items.getRowCount());
return items;
}
// Getters and setters...
public String getNick() {
return nick;
return nick;
}
public void setNick(String nick) {
this.nick = nick;
this.nick = nick;
}
public String getPassword() {
return password;
return password;
}
public void setPassword(String password) {
this.password = password;
this.password = password;
}
public void setUser(User user) {
this.user = user;
this.user = user;
}
public User getUser() {
return user;
return user;
}
}
user.username=Kyttjtunnus
user.username=K\u00E4ytt\u00E4j\u00E4tunnus
user.realname=Nimi
user.password=Salasana
user.email=Shkpostiosoite
user.email=S\u00E4hk\u00F6postiosoite
user.phone=Puhelinnumero
user.bankaccount=Tilinumero
user.bank=Pankki
save=Tallenna
cancel=Peruuta
login.username=Kyttjtunnus:
login.username=K\u00E4ytt\u00E4j\u00E4tunnus:
login.password=Salasana:
login.submit=Kirjaudu sisn
login.submit=Kirjaudu sis\u00E4\u00E4n
user.validate.notUniqueUsername=i18n Kyttjtunnus on jo olemassa. Ole hyv ja valitse toinen tunnus.
user.validate.notUniqueUsername=i18n K\u00E4ytt\u00E4j\u00E4tunnus on jo olemassa. Ole hyv\u00E4 ja valitse toinen tunnus.
fallbackstr="fallback default"
teststr=default locale test
defaultstr="Something default..."
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!