Commit ca6d414f by unknown

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

Conflicts:
	code/LanBortalWeb/WebContent/actionlog/messagelist.xhtml
	code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
2 parents 064e8714 0c03330e
Showing with 291 additions and 158 deletions
eclipse.preferences.version=1
encoding/<project>=UTF-8
...@@ -38,6 +38,8 @@ package fi.insomnia.bortal; ...@@ -38,6 +38,8 @@ package fi.insomnia.bortal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List;
import java.util.Set;
import javax.security.auth.login.LoginException; import javax.security.auth.login.LoginException;
...@@ -79,6 +81,9 @@ public class BortalLoginModule extends AppservPasswordLoginModule { ...@@ -79,6 +81,9 @@ public class BortalLoginModule extends AppservPasswordLoginModule {
throw new LoginException("Realm not SampleRealm"); throw new LoginException("Realm not SampleRealm");
} }
// find cert
log("Trying to find certificates");
RealmBeanRemote authbean = BortalRealm.getAuthBean(); RealmBeanRemote authbean = BortalRealm.getAuthBean();
if (authbean == null) { if (authbean == null) {
throw new LoginException( throw new LoginException(
...@@ -105,14 +110,14 @@ public class BortalLoginModule extends AppservPasswordLoginModule { ...@@ -105,14 +110,14 @@ public class BortalLoginModule extends AppservPasswordLoginModule {
} catch (InvalidOperationException invalidoperationexception) { } catch (InvalidOperationException invalidoperationexception) {
throw new LoginException( throw new LoginException(
(new StringBuilder()) (new StringBuilder())
.append("An InvalidOperationException was thrown " .append("An InvalidOperationException was thrown ")
).append(" while calling getGroupNames() on the SampleRealm ") .append(" while calling getGroupNames() on the SampleRealm ")
.append(invalidoperationexception).toString()); .append(invalidoperationexception).toString());
} catch (NoSuchUserException nosuchuserexception) { } catch (NoSuchUserException nosuchuserexception) {
throw new LoginException( throw new LoginException(
(new StringBuilder()) (new StringBuilder())
.append("A NoSuchUserException was thrown " .append("A NoSuchUserException was thrown ")
).append(" while calling getGroupNames() on the SampleRealm ") .append(" while calling getGroupNames() on the SampleRealm ")
.append(nosuchuserexception).toString()); .append(nosuchuserexception).toString());
} }
ArrayList<String> authenticatedGroups = new ArrayList<String>(); ArrayList<String> authenticatedGroups = new ArrayList<String>();
...@@ -124,18 +129,18 @@ public class BortalLoginModule extends AppservPasswordLoginModule { ...@@ -124,18 +129,18 @@ public class BortalLoginModule extends AppservPasswordLoginModule {
} }
// Call commitUserAuthentication with the groupNames the user belongs to // Call commitUserAuthentication with the groupNames the user belongs to
String[] groups = authenticatedGroups.toArray(new String[authenticatedGroups.size()]); String[] groups = authenticatedGroups
.toArray(new String[authenticatedGroups.size()]);
// System.out.println("groups: " + groups.length); // System.out.println("groups: " + groups.length);
// for (String str : groups) { // for (String str : groups) {
// System.out.println("Str " + str); // System.out.println("Str " + str);
// } // }
commitUserAuthentication(groups); commitUserAuthentication(groups);
} }
private void log(String s) { private void log(String s) {
System.out.println((new StringBuilder()) System.out.println((new StringBuilder()).append("BortalLoginModule::")
.append("BortalLoginModule::").append(s).toString()); .append(s).toString());
} }
} }
eclipse.preferences.version=1
encoding/<project>=UTF-8
package fi.insomnia.bortal.beans; package fi.insomnia.bortal.beans;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import javax.annotation.security.DeclareRoles; import javax.annotation.security.DeclareRoles;
...@@ -11,6 +8,9 @@ import javax.ejb.EJB; ...@@ -11,6 +8,9 @@ import javax.ejb.EJB;
import javax.ejb.LocalBean; import javax.ejb.LocalBean;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.enums.apps.BillPermission; import fi.insomnia.bortal.enums.apps.BillPermission;
import fi.insomnia.bortal.enums.apps.MapPermission; import fi.insomnia.bortal.enums.apps.MapPermission;
import fi.insomnia.bortal.enums.apps.PollPermission; import fi.insomnia.bortal.enums.apps.PollPermission;
...@@ -19,7 +19,6 @@ import fi.insomnia.bortal.enums.apps.UserPermission; ...@@ -19,7 +19,6 @@ import fi.insomnia.bortal.enums.apps.UserPermission;
import fi.insomnia.bortal.facade.MenuNavigationFacade; import fi.insomnia.bortal.facade.MenuNavigationFacade;
import fi.insomnia.bortal.facade.MenuitemFacade; import fi.insomnia.bortal.facade.MenuitemFacade;
import fi.insomnia.bortal.model.MenuNavigation; import fi.insomnia.bortal.model.MenuNavigation;
import fi.insomnia.bortal.model.Menuitem;
/** /**
* Session Bean implementation class Menubean * Session Bean implementation class Menubean
...@@ -44,30 +43,36 @@ public class Menubean implements MenubeanLocal { ...@@ -44,30 +43,36 @@ public class Menubean implements MenubeanLocal {
@EJB @EJB
private PermissionBeanLocal permbean; private PermissionBeanLocal permbean;
private static final Logger logger = LoggerFactory.getLogger(Menubean.class);
@Override @Override
public MenuNavigation getMenuNavigation(String url) { public MenuNavigation getMenuNavigation(String url) {
return navifacade.find(url, eventbean.getCurrentEvent()); MenuNavigation ret = navifacade.find(url, eventbean.getCurrentEvent());
logger.warn("Children at bean: {}", ret.getChildren());
return ret;
} }
@Override @Override
public List<MenuNavigation> getTopnavigations() { public List<MenuNavigation> getTopnavigations() {
HashMap<Menuitem, MenuNavigation> ret = new HashMap<Menuitem, MenuNavigation>(); return navifacade.findToplevels();
for (MenuNavigation navi : navifacade.findToplevels()) // HashMap<Menuitem, MenuNavigation> ret = new HashMap<Menuitem,
{ // MenuNavigation>();
if ((navi.getEvent() == null && ret.containsKey(navi.getItem()))) //
continue; // for (MenuNavigation navi : )
// {
ret.put(navi.getItem(), navi); //
} // ret.put(navi.getItem(), navi);
ArrayList<MenuNavigation> retlist = new ArrayList<MenuNavigation>(ret.values()); // }
if (retlist.isEmpty()) // ArrayList<MenuNavigation> retlist = new
{ // ArrayList<MenuNavigation>(ret.values());
initializeMenu(); // if (retlist.isEmpty())
} // {
Collections.sort(retlist); // initializeMenu();
return retlist; // }
// logger.info("Returning topmenus: {}", retlist);
// Collections.sort(retlist);
// return retlist;
} }
......
...@@ -120,7 +120,7 @@ public class MenuNavigationFacade extends GenericFacade<Integer, MenuNavigation> ...@@ -120,7 +120,7 @@ public class MenuNavigationFacade extends GenericFacade<Integer, MenuNavigation>
Root<MenuNavigation> root = cq.from(MenuNavigation.class); Root<MenuNavigation> root = cq.from(MenuNavigation.class);
Path<LanEvent> eventpath = root.get(MenuNavigation_.event); Path<LanEvent> eventpath = root.get(MenuNavigation_.event);
cq.where(cb.isNull(root.get(MenuNavigation_.parent)), cb.or(cb.equal(eventpath, eventbean.getCurrentEvent()), cb.isNull(eventpath))); cq.where(cb.isNull(root.get(MenuNavigation_.parent)), cb.or(cb.equal(eventpath, eventbean.getCurrentEvent()), cb.isNull(eventpath)), cb.isTrue(root.get(MenuNavigation_.visible)));
return em.createQuery(cq).getResultList(); return em.createQuery(cq).getResultList();
} }
......
eclipse.preferences.version=1
encoding/<project>=UTF-8
Manifest-Version: 1.0 Manifest-Version: 1.0
Class-Path: lib/LanBortalUtilities.jar Class-Path: lib/LanBortalUtilities.jar
bcprov-jdk16-146.jar
bcmail-jdk16-146.jar
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -22,6 +17,9 @@ import javax.persistence.Table; ...@@ -22,6 +17,9 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* Account event contains the money / credit traffic for the user. Each row * Account event contains the money / credit traffic for the user. Each row
* references a Product entity. * references a Product entity.
...@@ -29,6 +27,7 @@ import javax.persistence.TemporalType; ...@@ -29,6 +27,7 @@ import javax.persistence.TemporalType;
@Entity @Entity
@Table(name = "account_events") @Table(name = "account_events")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
// @NamedQueries({ // @NamedQueries({
// @NamedQuery(name = "AccountEvent.findAll", query = // @NamedQuery(name = "AccountEvent.findAll", query =
// "SELECT a FROM AccountEvent a"), // "SELECT a FROM AccountEvent a"),
......
...@@ -11,28 +11,31 @@ import javax.persistence.Table; ...@@ -11,28 +11,31 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import fi.insomnia.bortal.enums.ActionLogMessageState; import fi.insomnia.bortal.enums.ActionLogMessageState;
@Entity @Entity
@Table(name="actionlog_messages") @Table(name = "actionlog_messages")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class ActionLogMessage extends GenericEntity { public class ActionLogMessage extends GenericEntity {
private static final long serialVersionUID = -2902547412412000488L; private static final long serialVersionUID = -2902547412412000488L;
@Column(name="time", nullable=false) @Column(name = "time", nullable = false)
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date time = new Date(); private Date time = new Date();
@JoinColumn(name = "user_id")
@JoinColumn(name="user_id")
private User user; private User user;
@JoinColumn(name="crew", nullable=false) @JoinColumn(name = "crew", nullable = false)
private Role crew; private Role crew;
@Column(name="message", nullable=false) @Column(name = "message", nullable = false)
private String message; private String message;
@Column(name="state", nullable=true) @Column(name = "state", nullable = true)
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
private ActionLogMessageState state; private ActionLogMessageState state;
...@@ -76,5 +79,4 @@ public class ActionLogMessage extends GenericEntity { ...@@ -76,5 +79,4 @@ public class ActionLogMessage extends GenericEntity {
this.state = state; this.state = state;
} }
} }
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import javax.persistence.Column; import javax.persistence.Column;
...@@ -12,15 +8,15 @@ import javax.persistence.Table; ...@@ -12,15 +8,15 @@ import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import fi.insomnia.bortal.enums.BortalApplication; import fi.insomnia.bortal.enums.BortalApplication;
import fi.insomnia.bortal.enums.apps.IAppPermission; import fi.insomnia.bortal.enums.apps.IAppPermission;
/**
*
* @author jkj
*/
@Entity @Entity
@Table(name = "application_permissions", uniqueConstraints = { @UniqueConstraint(columnNames = { ApplicationPermission.ROLE_ID_COLUMN, ApplicationPermission.APPLICATION_COLUMN, ApplicationPermission.PERMISSION_COLUMN }) }) @Table(name = "application_permissions", uniqueConstraints = { @UniqueConstraint(columnNames = { ApplicationPermission.ROLE_ID_COLUMN, ApplicationPermission.APPLICATION_COLUMN, ApplicationPermission.PERMISSION_COLUMN }) })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class ApplicationPermission extends GenericEntity { public class ApplicationPermission extends GenericEntity {
protected static final String APPLICATION_PERMISSION_CONVERTER = "application_permission_perm_typeconverter"; protected static final String APPLICATION_PERMISSION_CONVERTER = "application_permission_perm_typeconverter";
......
...@@ -28,6 +28,8 @@ import javax.persistence.Temporal; ...@@ -28,6 +28,8 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned; import org.eclipse.persistence.annotations.PrivateOwned;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -47,6 +49,7 @@ import org.slf4j.LoggerFactory; ...@@ -47,6 +49,7 @@ import org.slf4j.LoggerFactory;
@NamedQuery(name = "Bill.findByPaidDate", query = "SELECT b FROM Bill b WHERE b.paidDate = :paidDate"), @NamedQuery(name = "Bill.findByPaidDate", query = "SELECT b FROM Bill b WHERE b.paidDate = :paidDate"),
@NamedQuery(name = "Bill.findByNotes", query = "SELECT b FROM Bill b WHERE b.notes = :notes"), @NamedQuery(name = "Bill.findByNotes", query = "SELECT b FROM Bill b WHERE b.notes = :notes"),
@NamedQuery(name = "Bill.findbiggestBillNumber", query = "SELECT max(b.billNumber) from Bill b where b.event = :event") }) @NamedQuery(name = "Bill.findbiggestBillNumber", query = "SELECT max(b.billNumber) from Bill b where b.event = :event") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Bill extends GenericEventChild { public class Bill extends GenericEventChild {
/** /**
......
...@@ -19,6 +19,9 @@ import javax.persistence.OneToOne; ...@@ -19,6 +19,9 @@ import javax.persistence.OneToOne;
import javax.persistence.OrderBy; import javax.persistence.OrderBy;
import javax.persistence.Table; import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -31,6 +34,7 @@ import javax.persistence.Table; ...@@ -31,6 +34,7 @@ import javax.persistence.Table;
@NamedQuery(name = "BillLine.findByQuantity", query = "SELECT b FROM BillLine b WHERE b.quantity = :quantity"), @NamedQuery(name = "BillLine.findByQuantity", query = "SELECT b FROM BillLine b WHERE b.quantity = :quantity"),
@NamedQuery(name = "BillLine.findByUnitPrice", query = "SELECT b FROM BillLine b WHERE b.unitPrice = :unitPrice"), @NamedQuery(name = "BillLine.findByUnitPrice", query = "SELECT b FROM BillLine b WHERE b.unitPrice = :unitPrice"),
@NamedQuery(name = "BillLine.findByVat", query = "SELECT b FROM BillLine b WHERE b.vat = :vat") }) @NamedQuery(name = "BillLine.findByVat", query = "SELECT b FROM BillLine b WHERE b.vat = :vat") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class BillLine extends GenericEventChild { public class BillLine extends GenericEventChild {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final BigDecimal DEFAULT_VAT = BigDecimal.ZERO; private static final BigDecimal DEFAULT_VAT = BigDecimal.ZERO;
......
...@@ -17,6 +17,9 @@ import javax.persistence.NamedQuery; ...@@ -17,6 +17,9 @@ import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* ID-card templates for the event. * ID-card templates for the event.
*/ */
...@@ -25,6 +28,7 @@ import javax.persistence.Table; ...@@ -25,6 +28,7 @@ import javax.persistence.Table;
@NamedQueries({ @NamedQueries({
@NamedQuery(name = "CardTemplate.findAll", query = "SELECT c FROM CardTemplate c"), @NamedQuery(name = "CardTemplate.findAll", query = "SELECT c FROM CardTemplate c"),
@NamedQuery(name = "CardTemplate.findByName", query = "SELECT c FROM CardTemplate c WHERE c.name = :name") }) @NamedQuery(name = "CardTemplate.findByName", query = "SELECT c FROM CardTemplate c WHERE c.name = :name") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class CardTemplate extends GenericEntity { public class CardTemplate extends GenericEntity {
private static final long serialVersionUID = -5754760238181167610L; private static final long serialVersionUID = -5754760238181167610L;
......
...@@ -19,6 +19,9 @@ import javax.persistence.Table; ...@@ -19,6 +19,9 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* Competition to be held at the event. * Competition to be held at the event.
*/ */
...@@ -34,6 +37,7 @@ import javax.persistence.TemporalType; ...@@ -34,6 +37,7 @@ import javax.persistence.TemporalType;
@NamedQuery(name = "Compo.findBySubmitEnd", query = "SELECT c FROM Compo c WHERE c.submitEnd = :submitEnd"), @NamedQuery(name = "Compo.findBySubmitEnd", query = "SELECT c FROM Compo c WHERE c.submitEnd = :submitEnd"),
@NamedQuery(name = "Compo.findByHoldVoting", query = "SELECT c FROM Compo c WHERE c.holdVoting = :holdVoting"), @NamedQuery(name = "Compo.findByHoldVoting", query = "SELECT c FROM Compo c WHERE c.holdVoting = :holdVoting"),
@NamedQuery(name = "Compo.findByDescription", query = "SELECT c FROM Compo c WHERE c.description = :description") }) @NamedQuery(name = "Compo.findByDescription", query = "SELECT c FROM Compo c WHERE c.description = :description") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Compo extends GenericEventChild { public class Compo extends GenericEventChild {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -23,6 +23,8 @@ import javax.persistence.Table; ...@@ -23,6 +23,8 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned; import org.eclipse.persistence.annotations.PrivateOwned;
/** /**
...@@ -37,6 +39,7 @@ import org.eclipse.persistence.annotations.PrivateOwned; ...@@ -37,6 +39,7 @@ import org.eclipse.persistence.annotations.PrivateOwned;
@NamedQuery(name = "CompoEntry.findByNotes", query = "SELECT c FROM CompoEntry c WHERE c.notes = :notes"), @NamedQuery(name = "CompoEntry.findByNotes", query = "SELECT c FROM CompoEntry c WHERE c.notes = :notes"),
@NamedQuery(name = "CompoEntry.findByScreenMessage", query = "SELECT c FROM CompoEntry c WHERE c.screenMessage = :screenMessage"), @NamedQuery(name = "CompoEntry.findByScreenMessage", query = "SELECT c FROM CompoEntry c WHERE c.screenMessage = :screenMessage"),
@NamedQuery(name = "CompoEntry.findBySort", query = "SELECT c FROM CompoEntry c WHERE c.sort = :sort") }) @NamedQuery(name = "CompoEntry.findBySort", query = "SELECT c FROM CompoEntry c WHERE c.sort = :sort") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class CompoEntry extends GenericEventChild { public class CompoEntry extends GenericEventChild {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -19,6 +19,9 @@ import javax.persistence.Table; ...@@ -19,6 +19,9 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -31,6 +34,7 @@ import javax.persistence.TemporalType; ...@@ -31,6 +34,7 @@ import javax.persistence.TemporalType;
@NamedQuery(name = "CompoEntryFile.findByDescription", query = "SELECT c FROM CompoEntryFile c WHERE c.description = :description"), @NamedQuery(name = "CompoEntryFile.findByDescription", query = "SELECT c FROM CompoEntryFile c WHERE c.description = :description"),
@NamedQuery(name = "CompoEntryFile.findByHash", query = "SELECT c FROM CompoEntryFile c WHERE c.hash = :hash"), @NamedQuery(name = "CompoEntryFile.findByHash", query = "SELECT c FROM CompoEntryFile c WHERE c.hash = :hash"),
@NamedQuery(name = "CompoEntryFile.findByUploaded", query = "SELECT c FROM CompoEntryFile c WHERE c.uploaded = :uploaded") }) @NamedQuery(name = "CompoEntryFile.findByUploaded", query = "SELECT c FROM CompoEntryFile c WHERE c.uploaded = :uploaded") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class CompoEntryFile extends GenericEventChild { public class CompoEntryFile extends GenericEventChild {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Column(name = "mime_type") @Column(name = "mime_type")
......
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.util.Calendar; import java.util.Calendar;
...@@ -18,6 +13,9 @@ import javax.persistence.Table; ...@@ -18,6 +13,9 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -27,6 +25,7 @@ import javax.persistence.TemporalType; ...@@ -27,6 +25,7 @@ import javax.persistence.TemporalType;
@NamedQuery(name = "CompoEntryParticipant.findAll", query = "SELECT c FROM CompoEntryParticipant c"), @NamedQuery(name = "CompoEntryParticipant.findAll", query = "SELECT c FROM CompoEntryParticipant c"),
@NamedQuery(name = "CompoEntryParticipant.findByRole", query = "SELECT c FROM CompoEntryParticipant c WHERE c.role = :role") }) @NamedQuery(name = "CompoEntryParticipant.findByRole", query = "SELECT c FROM CompoEntryParticipant c WHERE c.role = :role") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class CompoEntryParticipant extends GenericEventChild { public class CompoEntryParticipant extends GenericEventChild {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.math.BigDecimal; import java.math.BigDecimal;
......
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import javax.persistence.Entity; import javax.persistence.Entity;
...@@ -12,12 +8,16 @@ import javax.persistence.NamedQueries; ...@@ -12,12 +8,16 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
@Entity @Entity
@Table(name = "discount_instances") @Table(name = "discount_instances")
@NamedQueries({ @NamedQuery(name = "DiscountInstance.findAll", query = "SELECT d FROM DiscountInstance d") }) @NamedQueries({ @NamedQuery(name = "DiscountInstance.findAll", query = "SELECT d FROM DiscountInstance d") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class DiscountInstance extends GenericEventChild { public class DiscountInstance extends GenericEventChild {
/** /**
......
...@@ -6,7 +6,11 @@ import java.util.Random; ...@@ -6,7 +6,11 @@ import java.util.Random;
import javax.persistence.MappedSuperclass; import javax.persistence.MappedSuperclass;
import javax.persistence.Transient; import javax.persistence.Transient;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
@MappedSuperclass @MappedSuperclass
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public abstract class EntityEquals { public abstract class EntityEquals {
@Override @Override
......
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -16,6 +12,9 @@ import javax.persistence.OneToMany; ...@@ -16,6 +12,9 @@ import javax.persistence.OneToMany;
import javax.persistence.OrderBy; import javax.persistence.OrderBy;
import javax.persistence.Table; import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -25,6 +24,7 @@ import javax.persistence.Table; ...@@ -25,6 +24,7 @@ import javax.persistence.Table;
// @NamedQuery(name = "EventMap.findAll", query = "SELECT e FROM EventMap e"), // @NamedQuery(name = "EventMap.findAll", query = "SELECT e FROM EventMap e"),
// @NamedQuery(name = "EventMap.findByName", query = // @NamedQuery(name = "EventMap.findByName", query =
// "SELECT e FROM EventMap e WHERE e.name = :name") }) // "SELECT e FROM EventMap e WHERE e.name = :name") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class EventMap extends GenericEntity { public class EventMap extends GenericEntity {
/** /**
......
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.util.List; import java.util.List;
...@@ -15,11 +11,15 @@ import javax.persistence.OneToMany; ...@@ -15,11 +11,15 @@ import javax.persistence.OneToMany;
import javax.persistence.OrderBy; import javax.persistence.OrderBy;
import javax.persistence.Table; import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
@Entity @Entity
@Table(name = "event_organiser") @Table(name = "event_organiser")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class EventOrganiser extends GenericEntity { public class EventOrganiser extends GenericEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -14,6 +14,9 @@ import javax.persistence.Enumerated; ...@@ -14,6 +14,9 @@ import javax.persistence.Enumerated;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import fi.insomnia.bortal.enums.EventStatusEnum; import fi.insomnia.bortal.enums.EventStatusEnum;
/** /**
...@@ -27,6 +30,7 @@ import fi.insomnia.bortal.enums.EventStatusEnum; ...@@ -27,6 +30,7 @@ import fi.insomnia.bortal.enums.EventStatusEnum;
// "SELECT e FROM EventStatus e"), // "SELECT e FROM EventStatus e"),
// @NamedQuery(name = "EventStatus.findByStatusName", query = // @NamedQuery(name = "EventStatus.findByStatusName", query =
// "SELECT e FROM EventStatus e WHERE e.name = :name") }) // "SELECT e FROM EventStatus e WHERE e.name = :name") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class EventStatus extends GenericEntity { public class EventStatus extends GenericEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -20,6 +20,9 @@ import javax.persistence.Table; ...@@ -20,6 +20,9 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -32,6 +35,7 @@ import javax.persistence.TemporalType; ...@@ -32,6 +35,7 @@ import javax.persistence.TemporalType;
@NamedQuery(name = "FoodWave.findByDescription", query = "SELECT f FROM FoodWave f WHERE f.description = :description"), @NamedQuery(name = "FoodWave.findByDescription", query = "SELECT f FROM FoodWave f WHERE f.description = :description"),
@NamedQuery(name = "FoodWave.findByTime", query = "SELECT f FROM FoodWave f WHERE f.time = :time"), @NamedQuery(name = "FoodWave.findByTime", query = "SELECT f FROM FoodWave f WHERE f.time = :time"),
@NamedQuery(name = "FoodWave.findByClosed", query = "SELECT f FROM FoodWave f WHERE f.closed = :closed") }) @NamedQuery(name = "FoodWave.findByClosed", query = "SELECT f FROM FoodWave f WHERE f.closed = :closed") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class FoodWave extends GenericEventChild { public class FoodWave extends GenericEventChild {
/** /**
......
...@@ -15,6 +15,9 @@ import javax.persistence.NamedQuery; ...@@ -15,6 +15,9 @@ import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -25,6 +28,7 @@ import javax.persistence.Table; ...@@ -25,6 +28,7 @@ import javax.persistence.Table;
@NamedQuery(name = "FoodWaveTemplate.findByName", query = "SELECT f FROM FoodWaveTemplate f WHERE f.name = :name"), @NamedQuery(name = "FoodWaveTemplate.findByName", query = "SELECT f FROM FoodWaveTemplate f WHERE f.name = :name"),
@NamedQuery(name = "FoodWaveTemplate.findByDescription", query = "SELECT f FROM FoodWaveTemplate f WHERE f.description = :description") }) @NamedQuery(name = "FoodWaveTemplate.findByDescription", query = "SELECT f FROM FoodWaveTemplate f WHERE f.description = :description") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class FoodWaveTemplate extends GenericEventChild { public class FoodWaveTemplate extends GenericEventChild {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -7,6 +7,8 @@ import javax.persistence.Id; ...@@ -7,6 +7,8 @@ import javax.persistence.Id;
import javax.persistence.MappedSuperclass; import javax.persistence.MappedSuperclass;
import javax.persistence.Version; import javax.persistence.Version;
import org.eclipse.persistence.annotations.ReturnInsert;
import fi.insomnia.bortal.utilities.jpa.ModelInterface; import fi.insomnia.bortal.utilities.jpa.ModelInterface;
@MappedSuperclass @MappedSuperclass
...@@ -17,23 +19,10 @@ public class GenericEntity extends EntityEquals implements ModelInterface<Intege ...@@ -17,23 +19,10 @@ public class GenericEntity extends EntityEquals implements ModelInterface<Intege
@Id @Id
@Column(name = ID_COLUMN, nullable = false) @Column(name = ID_COLUMN, nullable = false)
@ReturnInsert(returnOnly=true)
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id; private Integer id;
@Version
@Column(nullable = false)
private int jpaVersionField = 0;
@Override
public final int getJpaVersionField() {
return jpaVersionField;
}
@Override
public final void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
@Override @Override
public final Integer getId() { public final Integer getId() {
return id; return id;
......
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import javax.persistence.Column;
import javax.persistence.EmbeddedId; import javax.persistence.EmbeddedId;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass; import javax.persistence.MappedSuperclass;
import javax.persistence.Version;
import fi.insomnia.bortal.utilities.jpa.ModelInterface; import fi.insomnia.bortal.utilities.jpa.ModelInterface;
...@@ -17,9 +15,6 @@ public abstract class GenericEventChild extends EntityEquals implements ModelInt ...@@ -17,9 +15,6 @@ public abstract class GenericEventChild extends EntityEquals implements ModelInt
public static final String ID_COLUMN = "id"; public static final String ID_COLUMN = "id";
@EmbeddedId @EmbeddedId
private EventPk id; private EventPk id;
@Version
@Column(nullable = false)
private int jpaVersionField = 0;
public static final String EVENT_ID_COLUMN = "event_id"; public static final String EVENT_ID_COLUMN = "event_id";
@ManyToOne() @ManyToOne()
...@@ -49,16 +44,6 @@ public abstract class GenericEventChild extends EntityEquals implements ModelInt ...@@ -49,16 +44,6 @@ public abstract class GenericEventChild extends EntityEquals implements ModelInt
this.id = id; this.id = id;
} }
@Override
public final int getJpaVersionField() {
return jpaVersionField;
}
@Override
public final void setJpaVersionField(int jpaVersionField) {
this.jpaVersionField = jpaVersionField;
}
public final void setEvent(LanEvent event) { public final void setEvent(LanEvent event) {
this.event = event; this.event = event;
} }
......
...@@ -18,6 +18,9 @@ import javax.persistence.Temporal; ...@@ -18,6 +18,9 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -34,6 +37,7 @@ import javax.persistence.UniqueConstraint; ...@@ -34,6 +37,7 @@ import javax.persistence.UniqueConstraint;
// "SELECT g FROM GroupMembership g WHERE g.inviteEmail = :inviteEmail"), // "SELECT g FROM GroupMembership g WHERE g.inviteEmail = :inviteEmail"),
// @NamedQuery(name = "GroupMembership.findByInviteName", query = // @NamedQuery(name = "GroupMembership.findByInviteName", query =
// "SELECT g FROM GroupMembership g WHERE g.inviteName = :inviteName") }) // "SELECT g FROM GroupMembership g WHERE g.inviteName = :inviteName") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class GroupMembership extends GenericEntity { public class GroupMembership extends GenericEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -18,6 +18,9 @@ import javax.persistence.Table; ...@@ -18,6 +18,9 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -31,6 +34,7 @@ import javax.persistence.TemporalType; ...@@ -31,6 +34,7 @@ import javax.persistence.TemporalType;
// "SELECT e FROM LanEvent e WHERE e.endTime = :endTime"), // "SELECT e FROM LanEvent e WHERE e.endTime = :endTime"),
// @NamedQuery(name = "LanEvent.findByName", query = // @NamedQuery(name = "LanEvent.findByName", query =
// "SELECT e FROM LanEvent e WHERE e.name = :name") }) // "SELECT e FROM LanEvent e WHERE e.name = :name") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class LanEvent extends GenericEntity { public class LanEvent extends GenericEntity {
/** /**
......
...@@ -13,6 +13,9 @@ import javax.persistence.ManyToOne; ...@@ -13,6 +13,9 @@ import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -23,6 +26,7 @@ import javax.persistence.Table; ...@@ -23,6 +26,7 @@ import javax.persistence.Table;
// //
// @NamedQuery(name = "Location.findByLocationName", query = // @NamedQuery(name = "Location.findByLocationName", query =
// "SELECT l FROM Location l WHERE l.name = :name") }) // "SELECT l FROM Location l WHERE l.name = :name") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Location extends GenericEntity { public class Location extends GenericEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -18,6 +18,9 @@ import javax.persistence.NamedQuery; ...@@ -18,6 +18,9 @@ import javax.persistence.NamedQuery;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -27,6 +30,7 @@ import javax.persistence.Temporal; ...@@ -27,6 +30,7 @@ import javax.persistence.Temporal;
@NamedQuery(name = "LogEntry.findAll", query = "SELECT l FROM LogEntry l"), @NamedQuery(name = "LogEntry.findAll", query = "SELECT l FROM LogEntry l"),
@NamedQuery(name = "LogEntry.findByTime", query = "SELECT l FROM LogEntry l WHERE l.time = :time"), @NamedQuery(name = "LogEntry.findByTime", query = "SELECT l FROM LogEntry l WHERE l.time = :time"),
@NamedQuery(name = "LogEntry.findByDescription", query = "SELECT l FROM LogEntry l WHERE l.description = :description") }) @NamedQuery(name = "LogEntry.findByDescription", query = "SELECT l FROM LogEntry l WHERE l.description = :description") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class LogEntry extends GenericEntity { public class LogEntry extends GenericEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -15,6 +15,9 @@ import javax.persistence.NamedQuery; ...@@ -15,6 +15,9 @@ import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -26,6 +29,7 @@ import javax.persistence.Table; ...@@ -26,6 +29,7 @@ import javax.persistence.Table;
@NamedQuery(name = "LogEntryType.findAll", query = "SELECT l FROM LogEntryType l"), @NamedQuery(name = "LogEntryType.findAll", query = "SELECT l FROM LogEntryType l"),
@NamedQuery(name = "LogEntryType.findByName", query = "SELECT l FROM LogEntryType l WHERE l.name = :name"), @NamedQuery(name = "LogEntryType.findByName", query = "SELECT l FROM LogEntryType l WHERE l.name = :name"),
@NamedQuery(name = "LogEntryType.findByDescription", query = "SELECT l FROM LogEntryType l WHERE l.description = :description") }) @NamedQuery(name = "LogEntryType.findByDescription", query = "SELECT l FROM LogEntryType l WHERE l.description = :description") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class LogEntryType extends GenericEntity { public class LogEntryType extends GenericEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -8,6 +8,7 @@ import java.util.List; ...@@ -8,6 +8,7 @@ import java.util.List;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.Lob; import javax.persistence.Lob;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
...@@ -16,6 +17,8 @@ import javax.persistence.OrderBy; ...@@ -16,6 +17,8 @@ import javax.persistence.OrderBy;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned; import org.eclipse.persistence.annotations.PrivateOwned;
import fi.insomnia.bortal.enums.BortalApplication; import fi.insomnia.bortal.enums.BortalApplication;
...@@ -25,6 +28,7 @@ import fi.insomnia.bortal.enums.apps.IAppPermission; ...@@ -25,6 +28,7 @@ import fi.insomnia.bortal.enums.apps.IAppPermission;
@Table(name = "menu_navigation") @Table(name = "menu_navigation")
// uniqueConstraints = { @UniqueConstraint(columnNames = { // uniqueConstraints = { @UniqueConstraint(columnNames = {
// MenuNavigation.ITEM_COLUMN, MenuNavigation.EVENT_COLUMN }) }) // MenuNavigation.ITEM_COLUMN, MenuNavigation.EVENT_COLUMN }) })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class MenuNavigation extends GenericEntity implements Comparable<MenuNavigation> { public class MenuNavigation extends GenericEntity implements Comparable<MenuNavigation> {
private static final long serialVersionUID = 1404769998091479699L; private static final long serialVersionUID = 1404769998091479699L;
...@@ -60,10 +64,10 @@ public class MenuNavigation extends GenericEntity implements Comparable<MenuNavi ...@@ -60,10 +64,10 @@ public class MenuNavigation extends GenericEntity implements Comparable<MenuNavi
@JoinColumn(nullable = true) @JoinColumn(nullable = true)
private MenuNavigation parent; private MenuNavigation parent;
@OneToMany(mappedBy = "parent", cascade = ALL) @OneToMany(mappedBy = "parent", cascade = ALL, fetch = FetchType.EAGER)
@PrivateOwned @PrivateOwned
@OrderBy("sort") @OrderBy("sort")
private List<MenuNavigation> children; private List<MenuNavigation> children = new ArrayList<MenuNavigation>();
@Transient @Transient
transient private IAppPermission privatePerm; transient private IAppPermission privatePerm;
......
...@@ -9,10 +9,13 @@ import javax.persistence.Lob; ...@@ -9,10 +9,13 @@ import javax.persistence.Lob;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned; import org.eclipse.persistence.annotations.PrivateOwned;
@Entity @Entity
@Table(name = "menuitem") @Table(name = "menuitem")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Menuitem extends GenericEntity { public class Menuitem extends GenericEntity {
private static final long serialVersionUID = -3544095800802935237L; private static final long serialVersionUID = -3544095800802935237L;
......
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.util.Date; import java.util.Date;
...@@ -15,12 +11,16 @@ import javax.persistence.Table; ...@@ -15,12 +11,16 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
* @author jkj * @author jkj
*/ */
@Entity @Entity
@Table(name = "news") @Table(name = "news")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class News extends GenericEntity { public class News extends GenericEntity {
private static final long serialVersionUID = 498925968565236275L; private static final long serialVersionUID = 498925968565236275L;
......
...@@ -18,6 +18,8 @@ import javax.persistence.OrderBy; ...@@ -18,6 +18,8 @@ import javax.persistence.OrderBy;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned; import org.eclipse.persistence.annotations.PrivateOwned;
/** /**
...@@ -26,6 +28,7 @@ import org.eclipse.persistence.annotations.PrivateOwned; ...@@ -26,6 +28,7 @@ import org.eclipse.persistence.annotations.PrivateOwned;
*/ */
@Entity @Entity
@Table(name = "news_groups", uniqueConstraints = @UniqueConstraint(columnNames = { "event_id", "group_name" })) @Table(name = "news_groups", uniqueConstraints = @UniqueConstraint(columnNames = { "event_id", "group_name" }))
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class NewsGroup extends GenericEntity { public class NewsGroup extends GenericEntity {
/** /**
......
...@@ -11,8 +11,12 @@ import javax.persistence.Table; ...@@ -11,8 +11,12 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
@Entity @Entity
@Table(name = "site_page_content") @Table(name = "site_page_content")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class PageContent extends GenericEntity { public class PageContent extends GenericEntity {
private static final long serialVersionUID = 8359021214886290522L; private static final long serialVersionUID = 8359021214886290522L;
......
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.util.Calendar; import java.util.Calendar;
...@@ -17,6 +13,9 @@ import javax.persistence.Table; ...@@ -17,6 +13,9 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -36,6 +35,7 @@ import javax.persistence.TemporalType; ...@@ -36,6 +35,7 @@ import javax.persistence.TemporalType;
// "SELECT p FROM Place p WHERE p.details = :details"), // "SELECT p FROM Place p WHERE p.details = :details"),
// @NamedQuery(name = "Place.findByCode", query = // @NamedQuery(name = "Place.findByCode", query =
// "SELECT p FROM Place p WHERE p.code = :code") }) // "SELECT p FROM Place p WHERE p.code = :code") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Place extends GenericEntity { public class Place extends GenericEntity {
/** /**
......
...@@ -22,6 +22,9 @@ import javax.persistence.Table; ...@@ -22,6 +22,9 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -37,6 +40,7 @@ import javax.persistence.TemporalType; ...@@ -37,6 +40,7 @@ import javax.persistence.TemporalType;
@NamedQuery(name = "PlaceGroup.findByName", query = "SELECT p FROM PlaceGroup p WHERE p.name = :name"), @NamedQuery(name = "PlaceGroup.findByName", query = "SELECT p FROM PlaceGroup p WHERE p.name = :name"),
@NamedQuery(name = "PlaceGroup.findByActive", query = "SELECT p FROM PlaceGroup p WHERE p.active = :active"), @NamedQuery(name = "PlaceGroup.findByActive", query = "SELECT p FROM PlaceGroup p WHERE p.active = :active"),
@NamedQuery(name = "PlaceGroup.findByDetails", query = "SELECT p FROM PlaceGroup p WHERE p.details = :details") }) @NamedQuery(name = "PlaceGroup.findByDetails", query = "SELECT p FROM PlaceGroup p WHERE p.details = :details") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class PlaceGroup extends GenericEntity { public class PlaceGroup extends GenericEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -18,12 +18,16 @@ import javax.persistence.OrderBy; ...@@ -18,12 +18,16 @@ import javax.persistence.OrderBy;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* Entity implementation class for Entity: Poll * Entity implementation class for Entity: Poll
* *
*/ */
@Entity @Entity
@Table(name = "poll") @Table(name = "poll")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Poll extends GenericEntity { public class Poll extends GenericEntity {
/** /**
......
...@@ -9,8 +9,12 @@ import javax.persistence.Lob; ...@@ -9,8 +9,12 @@ import javax.persistence.Lob;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.Table; import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
@Entity @Entity
@Table(name = "poll_answer") @Table(name = "poll_answer")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class PollAnswer extends GenericEntity implements Serializable { public class PollAnswer extends GenericEntity implements Serializable {
/** /**
......
...@@ -12,8 +12,12 @@ import javax.persistence.ManyToOne; ...@@ -12,8 +12,12 @@ import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
@Entity @Entity
@Table(name = "poll_question") @Table(name = "poll_question")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class PollQuestion extends GenericEntity { public class PollQuestion extends GenericEntity {
public PollQuestion() { public PollQuestion() {
......
...@@ -11,8 +11,12 @@ import javax.persistence.ManyToOne; ...@@ -11,8 +11,12 @@ import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
@Entity @Entity
@Table(name = "possible_answer") @Table(name = "possible_answer")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class PossibleAnswer extends GenericEntity { public class PossibleAnswer extends GenericEntity {
public PossibleAnswer() { public PossibleAnswer() {
......
...@@ -23,6 +23,9 @@ import javax.persistence.TemporalType; ...@@ -23,6 +23,9 @@ import javax.persistence.TemporalType;
import javax.persistence.Transient; import javax.persistence.Transient;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -40,6 +43,7 @@ import javax.persistence.UniqueConstraint; ...@@ -40,6 +43,7 @@ import javax.persistence.UniqueConstraint;
// "SELECT p FROM PrintedCard p WHERE p.enabled = :enabled"), // "SELECT p FROM PrintedCard p WHERE p.enabled = :enabled"),
// @NamedQuery(name = "PrintedCard.findByRfidUid", query = // @NamedQuery(name = "PrintedCard.findByRfidUid", query =
// "SELECT p FROM PrintedCard p WHERE p.rfidUid = :rfidUid") }) // "SELECT p FROM PrintedCard p WHERE p.rfidUid = :rfidUid") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class PrintedCard extends GenericEntity { public class PrintedCard extends GenericEntity {
/** /**
......
...@@ -19,6 +19,9 @@ import javax.persistence.OneToMany; ...@@ -19,6 +19,9 @@ import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -34,6 +37,7 @@ import javax.persistence.UniqueConstraint; ...@@ -34,6 +37,7 @@ import javax.persistence.UniqueConstraint;
// "SELECT p FROM Product p WHERE p.sort = :sort"), // "SELECT p FROM Product p WHERE p.sort = :sort"),
// @NamedQuery(name = "Product.findByBarcode", query = // @NamedQuery(name = "Product.findByBarcode", query =
// "SELECT p FROM Product p WHERE p.barcode = :barcode") }) // "SELECT p FROM Product p WHERE p.barcode = :barcode") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Product extends GenericEntity { public class Product extends GenericEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -16,6 +16,9 @@ import javax.persistence.OneToMany; ...@@ -16,6 +16,9 @@ import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
...@@ -28,6 +31,7 @@ import javax.persistence.UniqueConstraint; ...@@ -28,6 +31,7 @@ import javax.persistence.UniqueConstraint;
// "SELECT r FROM Reader r WHERE r.identification = :identification"), // "SELECT r FROM Reader r WHERE r.identification = :identification"),
// @NamedQuery(name = "Reader.findByDescription", query = // @NamedQuery(name = "Reader.findByDescription", query =
// "SELECT r FROM Reader r WHERE r.description = :description") }) // "SELECT r FROM Reader r WHERE r.description = :description") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Reader extends GenericEntity { public class Reader extends GenericEntity {
public Reader(LanEvent ev, String ident) { public Reader(LanEvent ev, String ident) {
......
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import static javax.persistence.CascadeType.ALL; import static javax.persistence.CascadeType.ALL;
...@@ -16,11 +12,15 @@ import javax.persistence.Table; ...@@ -16,11 +12,15 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
@Entity @Entity
@Table(name = "reader_events") @Table(name = "reader_events")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class ReaderEvent extends GenericEntity { public class ReaderEvent extends GenericEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -17,6 +13,8 @@ import javax.persistence.OneToMany; ...@@ -17,6 +13,8 @@ import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned; import org.eclipse.persistence.annotations.PrivateOwned;
/** /**
...@@ -24,6 +22,7 @@ import org.eclipse.persistence.annotations.PrivateOwned; ...@@ -24,6 +22,7 @@ import org.eclipse.persistence.annotations.PrivateOwned;
*/ */
@Entity @Entity
@Table(name = "roles", uniqueConstraints = { @UniqueConstraint(columnNames = { Role.EVENT_ID_COLUMN, Role.NAME_COLUMN }) }) @Table(name = "roles", uniqueConstraints = { @UniqueConstraint(columnNames = { Role.EVENT_ID_COLUMN, Role.NAME_COLUMN }) })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Role extends GenericEntity { public class Role extends GenericEntity {
private static final long serialVersionUID = -4602863502464505404L; private static final long serialVersionUID = -4602863502464505404L;
......
...@@ -12,10 +12,13 @@ import javax.persistence.OneToMany; ...@@ -12,10 +12,13 @@ import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned; import org.eclipse.persistence.annotations.PrivateOwned;
@Entity @Entity
@Table(name = "site_pages", uniqueConstraints = @UniqueConstraint(columnNames = { "event_id", "name" })) @Table(name = "site_pages", uniqueConstraints = @UniqueConstraint(columnNames = { "event_id", "name" }))
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class SitePage extends GenericEntity { public class SitePage extends GenericEntity {
private static final long serialVersionUID = -4333555423866132524L; private static final long serialVersionUID = -4333555423866132524L;
......
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model; package fi.insomnia.bortal.model;
import static javax.persistence.CascadeType.ALL; import static javax.persistence.CascadeType.ALL;
...@@ -30,6 +26,8 @@ import javax.persistence.TemporalType; ...@@ -30,6 +26,8 @@ import javax.persistence.TemporalType;
import javax.persistence.Transient; import javax.persistence.Transient;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned; import org.eclipse.persistence.annotations.PrivateOwned;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -42,6 +40,7 @@ import fi.insomnia.bortal.utilities.PasswordFunctions; ...@@ -42,6 +40,7 @@ import fi.insomnia.bortal.utilities.PasswordFunctions;
*/ */
@Entity @Entity
@Table(name = "users") @Table(name = "users")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class User extends GenericEntity { public class User extends GenericEntity {
public static final String ANONYMOUS_LOGINNAME = "anonymous"; public static final String ANONYMOUS_LOGINNAME = "anonymous";
private static final long serialVersionUID = -1632200627103418206L; private static final long serialVersionUID = -1632200627103418206L;
......
...@@ -16,11 +16,15 @@ import javax.persistence.Table; ...@@ -16,11 +16,15 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* *
*/ */
@Entity @Entity
@Table(name = "user_images") @Table(name = "user_images")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
// @NamedQueries({ // @NamedQueries({
// @NamedQuery(name = "UserImage.findAll", query = "SELECT u FROM UserImage u"), // @NamedQuery(name = "UserImage.findAll", query = "SELECT u FROM UserImage u"),
// //
......
...@@ -18,6 +18,9 @@ import javax.persistence.Temporal; ...@@ -18,6 +18,9 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/** /**
* A vote for a compo entry * A vote for a compo entry
*/ */
...@@ -27,6 +30,7 @@ import javax.persistence.UniqueConstraint; ...@@ -27,6 +30,7 @@ import javax.persistence.UniqueConstraint;
@NamedQuery(name = "Vote.findAll", query = "SELECT v FROM Vote v"), @NamedQuery(name = "Vote.findAll", query = "SELECT v FROM Vote v"),
@NamedQuery(name = "Vote.findByScore", query = "SELECT v FROM Vote v WHERE v.score = :score"), @NamedQuery(name = "Vote.findByScore", query = "SELECT v FROM Vote v WHERE v.score = :score"),
@NamedQuery(name = "Vote.findByTime", query = "SELECT v FROM Vote v WHERE v.time = :time") }) @NamedQuery(name = "Vote.findByTime", query = "SELECT v FROM Vote v WHERE v.time = :time") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Vote extends GenericEventChild { public class Vote extends GenericEventChild {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -7,9 +7,4 @@ public interface ModelInterface<T extends Serializable> extends Serializable { ...@@ -7,9 +7,4 @@ public interface ModelInterface<T extends Serializable> extends Serializable {
T getId(); T getId();
void setId(T id); void setId(T id);
int getJpaVersionField();
void setJpaVersionField(int jpaVersionField);
} }
eclipse.preferences.version=1
encoding/<project>=UTF-8
...@@ -114,6 +114,9 @@ ...@@ -114,6 +114,9 @@
<auth-constraint> <auth-constraint>
<description>Thou shall not read the sources or use utils directly</description> <description>Thou shall not read the sources or use utils directly</description>
</auth-constraint> </auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint> </security-constraint>
<servlet> <servlet>
<description></description> <description></description>
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/cditools/user" xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:f="http://java.sun.com/jsf/core" xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
> >
<h:body> <h:body>
...@@ -45,6 +46,8 @@ ...@@ -45,6 +46,8 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<h2>#{i18n['actionlog.tasklist.header']}</h2> <h2>#{i18n['actionlog.tasklist.header']}</h2>
<div id="actionlog"> <div id="actionlog">
<h:form id="refresh">
<p:poll interval="1" update="actionlogtable" />
<h:dataTable styleClass="bordertable" rowClasses="roweven,rowodd" id="actionlogtable" value="#{actionLogMessageView.messages}" var="message"> <h:dataTable styleClass="bordertable" rowClasses="roweven,rowodd" id="actionlogtable" value="#{actionLogMessageView.messages}" var="message">
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
...@@ -52,7 +55,6 @@ ...@@ -52,7 +55,6 @@
</f:facet> </f:facet>
<h:outputText value="#{message.time}"> <h:outputText value="#{message.time}">
<f:convertDateTime type="both" pattern="dd.MM.yyyy HH:mm" /> <f:convertDateTime type="both" pattern="dd.MM.yyyy HH:mm" />
<!-- <f:convertDateTime type="both" dateStyle="HH:mm" /> -->
</h:outputText> </h:outputText>
</h:column> </h:column>
<h:column> <h:column>
...@@ -75,13 +77,12 @@ ...@@ -75,13 +77,12 @@
<h:outputText value="#{message.message}" /> <h:outputText value="#{message.message}" />
</h:column> </h:column>
<h:column> <h:column>
<h:link rendered="#{!empty message.state}" > <h:link rendered="#{!empty message.state}" >
Näytä tehtävä Näytä tehtävä
</h:link> </h:link>
</h:column> </h:column>
</h:dataTable> </h:dataTable>
</h:form>
</div> </div>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
......
...@@ -43,11 +43,6 @@ ...@@ -43,11 +43,6 @@
</div> </div>
<div id="container" class="top" /> <div id="container" class="top" />
<div id="container" class="clearfix"> <div id="container" class="clearfix">
<div id="left">
<ui:insert name="title" />
<h:messages globalOnly="true" />
<ui:insert name="content" />
</div>
<c:if test="#{menuView.submenu.size() > 1}"> <c:if test="#{menuView.submenu.size() > 1}">
<div id="right"> <div id="right">
...@@ -61,6 +56,12 @@ ...@@ -61,6 +56,12 @@
</ul> </ul>
</div> </div>
</c:if> </c:if>
<div id="left">
<ui:insert name="title" />
<h:messages globalOnly="true" />
<ui:insert name="content" />
</div>
</div> </div>
<div id="container" class="bottom"></div> <div id="container" class="bottom"></div>
</div> </div>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:news="http://java.sun.com/jsf/composite/cditools/news" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:news="http://java.sun.com/jsf/composite/cditools/news" xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:p="http://primefaces.org/ui"
> >
<h:body> <h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml"> <ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:news="http://java.sun.com/jsf/composite/cditools/news" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:news="http://java.sun.com/jsf/composite/cditools/news" xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:p="http://primefaces.org/ui"
> >
<h:body> <h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml"> <ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:poll="http://java.sun.com/jsf/composite/cditools/poll" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:poll="http://java.sun.com/jsf/composite/cditools/poll" xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:p="http://primefaces.org/ui"
> >
<h:body> <h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml"> <ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:poll="http://java.sun.com/jsf/composite/cditools/poll" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:poll="http://java.sun.com/jsf/composite/cditools/poll" xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:p="http://primefaces.org/ui"
> >
<h:body> <h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml"> <ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tools="http://java.sun.com/jsf/composite/tools" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:p="http://primefaces.org/ui"
> >
......
...@@ -14,11 +14,11 @@ body, html {width: 100%; height: 100%; color: #343434; font-family: trebuchet m ...@@ -14,11 +14,11 @@ body, html {width: 100%; height: 100%; color: #343434; font-family: trebuchet m
a {color: #0037bc;} a {color: #0037bc;}
a:hover {color: #7dac0c;} a:hover {color: #7dac0c;}
#container {width: 100%; background:url(../img/container.png) repeat-y; font-size: 13px;} #container {width: 100%; background:url(../img/container.png) repeat-y; font-size: 13px;}
#container #left {width: 680px; float: left; padding: 10px 20px;} #container #left {padding: 10px 20px;}
#left h1 {color:#7dac0c; font-size: 24px; padding-top:0px; margin-top: 0px;} #left h1 {color:#7dac0c; font-size: 24px; padding-top:0px; margin-top: 0px;}
#left h2 {color:#7dac0c; font-size: 18px;} #left h2 {color:#7dac0c; font-size: 18px;}
#left h3 {color:#7dac0c; font-size: 16px;} #left h3 {color:#7dac0c; font-size: 16px;}
#right {float:left; border-left: 1px dotted #c0c0c0; padding: 10px 20px; width: 200px;} #right {float:right; border-left: 1px dotted #c0c0c0; padding: 10px 20px; width: 200px;}
#right h1, #right h1 a {color:#7dac0c; font-size: 18px; padding-top: 0px; margin-top:0px; text-decoration:none;} #right h1, #right h1 a {color:#7dac0c; font-size: 18px; padding-top: 0px; margin-top:0px; text-decoration:none;}
#container.top {width: 100%; background:url(../img/container-top.png) no-repeat; height: 15px;} #container.top {width: 100%; background:url(../img/container-top.png) no-repeat; height: 15px;}
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/tools/user" xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/tools/user"
xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"
> >
<h:body> <h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml"> <ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui"
xmlns:users="http://java.sun.com/jsf/composite/cditools/user" xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:shop="http://java.sun.com/jsf/composite/cditools/shop" xmlns:shop="http://java.sun.com/jsf/composite/cditools/shop"
> >
......
...@@ -15,9 +15,19 @@ import fi.insomnia.bortal.web.cdiview.GenericCDIView; ...@@ -15,9 +15,19 @@ import fi.insomnia.bortal.web.cdiview.GenericCDIView;
public class ActionLogMessageView extends GenericCDIView { public class ActionLogMessageView extends GenericCDIView {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private boolean updateEnabled = true;
@EJB @EJB
private ActionLogBeanLocal actionLogBean; private ActionLogBeanLocal actionLogBean;
public boolean getUpdateEnabled() {
return updateEnabled;
}
public void setUpdateEnabled(boolean updateEnabled) {
this.updateEnabled = updateEnabled;
}
public List<ActionLogMessage> getMessages() { public List<ActionLogMessage> getMessages() {
return actionLogBean.getAllActionLogEvents(); return actionLogBean.getAllActionLogEvents();
} }
......
...@@ -23,6 +23,15 @@ public class JsfMenuitem { ...@@ -23,6 +23,15 @@ public class JsfMenuitem {
// item = new Menuitem("/page/?id=" + sitepage.getId(), null, null); // item = new Menuitem("/page/?id=" + sitepage.getId(), null, null);
// text = sitepage.getName(); // text = sitepage.getName();
// } // }
public String hetFooter()
{
return navigation.getFooter();
}
public String getHeader()
{
return navigation.getHeader();
}
public void setSelected() { public void setSelected() {
selected = true; selected = true;
......
...@@ -25,7 +25,6 @@ public class MenuView { ...@@ -25,7 +25,6 @@ public class MenuView {
private String pagename; private String pagename;
private List<JsfMenuitem> submenu; private List<JsfMenuitem> submenu;
private List<JsfMenuitem> topmenu; private List<JsfMenuitem> topmenu;
private MenuNavigation currentPage;
@Inject @Inject
private FacesContext context; private FacesContext context;
...@@ -37,6 +36,7 @@ public class MenuView { ...@@ -37,6 +36,7 @@ public class MenuView {
@EJB @EJB
private SitePageBeanLocal sitepagebean; private SitePageBeanLocal sitepagebean;
private ArrayList<MenuNavigation> menupath;
private static final Logger logger = LoggerFactory.getLogger(MenuView.class); private static final Logger logger = LoggerFactory.getLogger(MenuView.class);
public String getPagename() { public String getPagename() {
...@@ -54,18 +54,26 @@ public class MenuView { ...@@ -54,18 +54,26 @@ public class MenuView {
{ {
if (submenu == null) if (submenu == null)
{ {
getTopmenu();
MenuNavigation topPage = menupath.get(menupath.size() - 1);
submenu = new ArrayList<JsfMenuitem>(); submenu = new ArrayList<JsfMenuitem>();
for (MenuNavigation item : menubean.getMenuNavigation(getPagename()).getChildren()) {
if (permbean.hasPermission(item.getPermission())) { for (MenuNavigation navi : topPage.getChildren()) {
JsfMenuitem thisitem = new JsfMenuitem(item); logger.info("Trying to add item {}", navi.getKey());
if (permbean.hasPermission(navi.getPermission())) {
JsfMenuitem thisitem = new JsfMenuitem(navi);
submenu.add(thisitem); submenu.add(thisitem);
if (currentPage.equals(item)) { if (menupath.contains(navi)) {
thisitem.setSelected(); thisitem.setSelected();
} }
} }
} }
logger.info("Initialized submenu {}", submenu);
} }
return submenu; return submenu;
} }
...@@ -77,14 +85,21 @@ public class MenuView { ...@@ -77,14 +85,21 @@ public class MenuView {
// if there are no results! // if there are no results!
List<MenuNavigation> menuitems = menubean.getTopnavigations(); List<MenuNavigation> menuitems = menubean.getTopnavigations();
currentPage = menubean.getMenuNavigation(getPagename()); menupath = new ArrayList<MenuNavigation>();
MenuNavigation topPage = currentPage; MenuNavigation currentPage = menubean.getMenuNavigation(getPagename());
while (topPage.getParent() != null)
while (currentPage != null)
{ {
topPage = topPage.getParent(); menupath.add(currentPage);
currentPage = currentPage.getParent();
} }
for (MenuNavigation m : menuitems) { for (MenuNavigation m : menuitems) {
if (m.getPermission() != null && !permbean.hasPermission(m.getPermission()))
{
continue;
}
JsfMenuitem thisitem = new JsfMenuitem(m); JsfMenuitem thisitem = new JsfMenuitem(m);
if (m.getItem() == null && m.getSitepage() == null) if (m.getItem() == null && m.getSitepage() == null)
{ {
...@@ -99,12 +114,11 @@ public class MenuView { ...@@ -99,12 +114,11 @@ public class MenuView {
} }
} }
logger.info("Trying to add topmenu {}", m.getKey());
if (thisitem.getOutcome() != null) if (thisitem.getOutcome() != null)
{ {
topmenu.add(thisitem); topmenu.add(thisitem);
if (m.equals(topPage)) { if (menupath.contains(m)) {
thisitem.setSelected(); thisitem.setSelected();
} }
} }
......
eclipse.preferences.version=1
encoding/<project>=UTF-8
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!