Commit 34debee2 by Tuomas Riihimäki

Massive rename. We have finally a name

1 parent a36dde13
Showing with 0 additions and 4921 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

eclipse.preferences.version=1
encoding/<project>=UTF-8
package fi.insomnia.bortal.beans;
import javax.ejb.Local;
@Local
public interface BillLineBeanLocal {
}
package fi.insomnia.bortal.beans;
import javax.ejb.Local;
@Local
public interface GameBeanLocal {
}
package fi.insomnia.bortal.beans;
import javax.ejb.Local;
@Local
public interface JaasBeanLocal {
}
package fi.insomnia.bortal.beans;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ejb.Local;
import fi.insomnia.bortal.model.AccountEvent;
import fi.insomnia.bortal.model.Discount;
import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.model.InventoryEvent;
import fi.insomnia.bortal.model.Product;
import fi.insomnia.bortal.model.ProductFlag;
@Local
public interface ProductBeanLocal {
List<Product> listUserShoppableProducts();
List<Product> findProductsByFlag(ProductFlag... productFlags);
void create(Product prod);
List<Product> getProducts();
Product mergeChanges(Product product);
Product findCreditProduct();
// BigDecimal calculateTotal(Product key, BigDecimal value);
AccountEvent createAccountEvent(Product product, BigDecimal quantity, EventUser user);
// List<Discount> getActiveDiscounts(Product product, BigDecimal quantity);
Product findById(int parseInt);
Product findByBarcode(String barcode);
List<Product> findForStaffshop();
Discount findDiscount(Integer discountid);
Discount save(Discount discount);
BigDecimal calculateTotal(Product product, BigDecimal quantity, Calendar date);
HashMap<Integer, BigDecimal> getProductLimit(Map<Integer, BigDecimal> prodCounts, EventUser user);
BigDecimal getProductLimit(Product product, EventUser user, Map<Integer, BigDecimal> prodCounts);
void saveInventoryEvent(InventoryEvent ie);
List<Product> findProductsForEvent();
}
package fi.insomnia.bortal.beans;
import java.util.List;
import javax.ejb.Local;
import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.model.PrintedCard;
import fi.insomnia.bortal.model.Reader;
import fi.insomnia.bortal.model.ReaderEvent;
import fi.insomnia.bortal.model.User;
@Local
public interface ReaderBeanLocal {
ReaderEvent checkTag(String reader, String tag, String hash);
// WAT!
// ReaderEvent assocTagToPlacecode(String tag, String readerIdent, String
// placecode) throws BortalCatchableException, PermissionDeniedException;
ReaderEvent assocTagToCard(String tag, String readerIdent, PrintedCard card);
List<Reader> getReaders();
List<ReaderEvent> getReaderEvents(Integer readerId);
ReaderEvent getEvent(Integer eventid);
User findTagFromAnyEvent(String value);
ReaderEvent createCard(ReaderEvent event, EventUser user);
Reader getReader(Integer readerid);
Reader saveReader(Reader reader);
}
package fi.insomnia.bortal.beans;
import java.io.IOException;
import java.util.List;
import javax.ejb.Local;
import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.model.GroupMembership;
import fi.insomnia.bortal.model.Role;
import fi.insomnia.bortal.model.User;
import fi.insomnia.bortal.model.UserImage;
import fi.insomnia.bortal.util.UserSearchQuery;
import fi.insomnia.bortal.utilities.SearchQuery;
import fi.insomnia.bortal.utilities.SearchResult;
@Local
public interface UserBeanLocal {
List<EventUser> getUsers();
SearchResult<User> getUsers(SearchQuery search);
SearchResult<User> getEventUsers(SearchQuery search);
EventUser mergeChanges(EventUser user);
UserImage uploadImage(EventUser user, String contentType, byte[] image, String filename, String description);
UserImage findUserImage(int id);
void createNewUser(EventUser user, String password);
User findPasswordResetUser(Integer id, String hash);
boolean resetPassword(User user, String password, String hash);
boolean initPasswordReset(String user, String mailpath);
/**
* Search EventUser entity by User entity ID
*
* @param userid
* ID of the User entity to be searcher
* @return
*/
EventUser findByUserId(Integer userid);
EventUser findByEventUserId(Integer integer);
GroupMembership findToken(String token);
void createFromToken(EventUser user, String token);
UserImage findUserimageFORCE(Integer id);
UserImage saveCroppedImage(UserImage currentImage, int left, int top, int width, int height) throws IOException;
EventUser createNewUser(User usr);
boolean userExists(String login);
boolean invite(String invitemail, String url);
EventUser mergeEventUserChanges(EventUser shoppingUser);
List<Role> findUsersRoles(EventUser u);
/**
* NOTICE! If the user parameter is a persisted object the returned
* EventUser has a reloaded user, eg changes to the User object are lost!
*
* @param user
* @return
*/
EventUser getEventUser(User user);
EventUser validateUser(String username, String password);
EventUser getUserByBarcode(String barcode);
SearchResult<EventUser> getThisEventsUsers(UserSearchQuery searchQuery);
void submitFeedback(String feedback);
}
package fi.insomnia.bortal.beans;
import java.util.List;
import javax.ejb.Local;
import fi.insomnia.bortal.model.Compo;
import fi.insomnia.bortal.model.CompoEntry;
import fi.insomnia.bortal.model.CompoEntryFile;
import fi.insomnia.bortal.model.Vote;
@Local
public interface VotingBeanLocal {
public void createCompo(Compo c);
public void addEntry(CompoEntry compoEntry, CompoEntryFile compoEntryFile);
public List<Compo> getCompoList();
public Compo getCompoById(Integer compoId);
public Compo addEntry(CompoEntry entry);
public CompoEntry saveEntry(CompoEntry entry);
public List<CompoEntryFile> getEntryFiles(CompoEntry entry);
public CompoEntryFile findEntryFile(Integer id);
public CompoEntry findEntry(Integer entryId);
public CompoEntry saveSort(CompoEntry e);
public Vote saveVote(CompoEntry entry, Integer vote);
}
package fi.insomnia.bortal.beans.mail;
import javax.ejb.Local;
@Local
public interface MailBeanLocal {
}
package fi.insomnia.bortal.salespoint;
import java.util.ArrayList;
public class Cart {
ArrayList<CartItem> cartItems;
}
package fi.insomnia.bortal.util;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class CheckoutBank {
private final String key;
private final String url;
private final String icon;
private final String name;
private final List<Valuepair> postParams = new ArrayList<Valuepair>();
private static final Logger logger = LoggerFactory.getLogger(CheckoutBank.class);
public CheckoutBank(Node bank) {
if (bank.getNodeType() != 1)
{
throw new RuntimeException("Wrong type of node " + bank + " type " + bank.getNodeType());
}
key = bank.getNodeName();
logger.info("Bank type {}", bank);
NamedNodeMap attrs = bank.getAttributes();
String iconval = null;
String nameval = null;
String urlval = null;
for (int j = 0; j < attrs.getLength(); ++j)
{
Node attr = attrs.item(j);
if (attr.getNodeName().equals("icon")) {
iconval = attr.getNodeValue();
} else if (attr.getNodeName().equals("name")) {
nameval = attr.getNodeValue();
} else if (attr.getNodeName().equals("url")) {
urlval = attr.getNodeValue();
}
}
icon = iconval;
name = nameval;
url = urlval;
NodeList children = bank.getChildNodes();
for (int i = 0; i < children.getLength(); ++i)
{
Node childnode = children.item(i);
if (childnode.getNodeType() == 1)
{
String paramName = childnode.getNodeName();
String paramValue = childnode.getTextContent();
getPostParams().add(new Valuepair(paramName, paramValue));
logger.info("Added param for {} name {} value {}", new Object[] { key, paramName, paramValue });
}
}
System.out.println();
}
public String getKey() {
return key;
}
public String getUrl() {
return url;
}
public String getIcon() {
return icon;
}
public String getName() {
return name;
}
public List<Valuepair> getPostParams() {
return postParams;
}
}
package fi.insomnia.bortal.util;
public enum CheckoutReturnType {
RETURN, DELAYED, REJECT, CANCEL
}
package fi.insomnia.bortal.util;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import javax.mail.internet.InternetAddress;
import fi.insomnia.bortal.model.User;
public class MailMessage implements Serializable {
/**
*
*/
private static final long serialVersionUID = -4769468394850407107L;
private static final String DEFAULT_MAIL_CHARSET = "ISO-8859-1";
private String subject;
private String fromName;
private String fromAddress;
private String toName;
private String toAddress;
private String message;
private String charset = DEFAULT_MAIL_CHARSET;
public InternetAddress getTo() throws UnsupportedEncodingException {
return new InternetAddress(toAddress, toName, getCharset());
}
public InternetAddress getFrom() throws UnsupportedEncodingException {
return new InternetAddress(fromAddress, fromName, getCharset());
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getFromName() {
return fromName;
}
public void setFromName(String fromName) {
this.fromName = fromName;
}
public String getFromAddress() {
return fromAddress;
}
public void setFromAddress(String fromAddress) {
this.fromAddress = fromAddress;
}
public String getToName() {
return toName;
}
public void setToName(String toName) {
this.toName = toName;
}
public String getToAddress() {
return toAddress;
}
public void setToAddress(String toAddress) {
this.toAddress = toAddress;
}
public String getMessage() {
return message;
}
public void setMessage(Object... msgpart) {
StringBuilder msg = new StringBuilder();
for (Object o : msgpart) {
msg.append(o);
}
message = msg.toString();
}
public void setMessage(String message) {
this.message = message;
}
public static String getDefaultMailCharset() {
return DEFAULT_MAIL_CHARSET;
}
public void setCharset(String charset) {
this.charset = charset;
}
public String getCharset() {
return charset;
}
public void setTo(User user) {
setToName(user.getWholeName());
setToAddress(user.getEmail());
}
@Override
public String toString() {
return new StringBuilder("fi.insomnia.bortal.util.MailMessage[to=").append(toAddress).append("]").toString();
}
}
package fi.insomnia.bortal.util;
public enum SvmReturnType {
SUCCESS, FAILURE, PENDING, NOTIFICATION
}
package fi.insomnia.bortal.util;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import fi.insomnia.bortal.enums.DatabaseHasCompare;
import fi.insomnia.bortal.enums.DatabaseValueCompare;
import fi.insomnia.bortal.model.Role;
import fi.insomnia.bortal.utilities.SearchQuery;
public class UserSearchQuery extends SearchQuery {
private static final long serialVersionUID = 1383445517981308383L;
private List<Role> filterRoles = new ArrayList<Role>();
private boolean onlyThisEvent = true;
private boolean placeAssoc = false;
private DatabaseHasCompare requireImage = DatabaseHasCompare.NONE;
private BigDecimal accountSaldo;
private DatabaseValueCompare accountSaldoCompare = DatabaseValueCompare.NONE;
public DatabaseValueCompare[] getAccountCompareValues()
{
return DatabaseValueCompare.values();
}
public boolean isOnlyThisEvent() {
return onlyThisEvent;
}
public void setOnlyThisEvent(boolean onlyThisEvent) {
this.onlyThisEvent = onlyThisEvent;
}
public List<Role> getFilterRoles() {
return filterRoles;
}
public void setFilterRoles(List<Role> filterRoles) {
this.filterRoles = filterRoles;
}
public BigDecimal getAccountSaldo() {
return accountSaldo;
}
public void setAccountSaldo(BigDecimal accountSaldo) {
this.accountSaldo = accountSaldo;
}
public DatabaseValueCompare getAccountSaldoCompare() {
return accountSaldoCompare;
}
public void setAccountSaldoCompare(DatabaseValueCompare accountSaldoCompare) {
this.accountSaldoCompare = accountSaldoCompare;
}
public boolean isPlaceAssoc() {
return placeAssoc;
}
public void setPlaceAssoc(boolean placeAssoc) {
this.placeAssoc = placeAssoc;
}
public DatabaseHasCompare getRequireImage() {
return requireImage;
}
public void setRequireImage(DatabaseHasCompare requireImage) {
this.requireImage = requireImage;
}
}
package fi.insomnia.bortal.util;
import java.io.Serializable;
public class VerkkomaksutReturnEntry implements Serializable {
/**
*
*/
private static final long serialVersionUID = 5421016087752752267L;
public boolean isError()
{
return errorCode != null;
}
// Error stuff
private String errorCode;
private String errorMessage;
// payment stuff
private String orderNumber;
private String token;
private String url;
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="src" path="/LanBortalUtilities"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish 3.1.2">
<attributes>
<attribute name="owner.project.facets" value="jst.utility"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<booleanAttribute key="org.eclipse.debug.core.ATTR_REFRESH_RECURSIVE" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/LanBortal/EarContent/lib/LanBortalDatabase.jar&quot; type=&quot;1&quot;/&gt;&#10;&lt;/resources&gt;}"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/LanBortalDatabase/jarbuild.xml"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ant.internal.launching.remote.InternalAntRunner"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="LanBortalDatabase"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/LanBortalDatabase/src&quot; type=&quot;2&quot;/&gt;&#10;&lt;/resources&gt;}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/LanBortalDatabase/jarbuild.xml}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/>
</launchConfiguration>
<?xml version="1.0" encoding="UTF-8"?>
<graniteProperties version="2.0">
<gas3 uid="uid" as3TypeFactory="org.granite.generator.as3.DefaultAs3TypeFactory" entityFactory="org.granite.generator.as3.DefaultEntityFactory" remoteDestinationFactory="org.granite.generator.as3.DefaultRemoteDestinationFactory" debugEnabled="false" flexConfig="false" externalizeLong="false" externalizeBigInteger="false" externalizeBigDecimal="false">
<source path="src" includes="" excludes="" output="../LanBortalWeb/as3;"/>
<template kind="ENTITY" uris="class:org/granite/generator/template/entity.gsp;class:org/granite/generator/template/entityBase.gsp"/>
<template kind="BEAN" uris="class:org/granite/generator/template/bean.gsp;class:org/granite/generator/template/beanBase.gsp"/>
<template kind="ENUM" uris="class:org/granite/generator/template/enum.gsp"/>
<template kind="REMOTE_DESTINATION" uris="class:org/granite/generator/template/remote.gsp;class:org/granite/generator/template/remoteBase.gsp"/>
<template kind="INTERFACE" uris="class:org/granite/generator/template/interface.gsp"/>
<transformer type="org.granite.generator.as3.JavaAs3GroovyTransformer"/>
</gas3>
</graniteProperties>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>LanBortalDatabase</name>
<comment></comment>
<projects>
<project>LanBortalUtilities</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.jboss.tools.jst.web.kb.kbbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>auto,full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/LanBortalDatabase JAR builder.launch</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.axdt.as3.imp.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.axdt.as3.imp.nature</nature>
<nature>org.jboss.tools.jst.web.kb.kbnature</nature>
</natures>
</projectDescription>
#Sun Mar 07 01:44:04 EET 2010
eclipse.preferences.version=1
filesCopiedToWebInfLib=
#Sun Mar 07 01:44:04 EET 2010
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
#Sun Mar 07 01:44:04 EET 2010
eclipse.preferences.version=1
filesCopiedToWebInfLib=
#Thu Jul 15 02:45:50 EEST 2010
SOURCE_PATHS=../LanBortalWeb/as3
eclipse.preferences.version=1
#Wed Oct 27 00:25:52 EEST 2010
eclipse.preferences.version=1
encoding/<project>=UTF-8
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="LanBortalDatabase" default="default" basedir=".">
<description>Builds, tests, and runs the project LanBortalDatabase.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="LanBortalDatabase-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project name="LanBortalDatabase" default="LanBortalDatabase.jar">
<description>Build the JAR to be embedded in your EAR</description>
<property name="LanBortalDatabase.jar" location="../LanBortal/EarContent/lib/LanBortalDatabase.jar" />
<uptodate property="LanBortalDatabase.jar-uptodate" targetfile="${LanBortalDatabase.jar}">
<srcfiles dir="build/classes" includes="**" />
</uptodate>
<target name="LanBortalDatabase.jar" unless="LanBortalDatabase.jar-uptodate">
<jar destfile="${LanBortalDatabase.jar}" basedir="build/classes" />
</target>
</project>
\ No newline at end of file
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
build.xml.data.CRC32=063cb014
build.xml.script.CRC32=d54e84fc
build.xml.stylesheet.CRC32=958a1d3e@1.32.1.45
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=063cb014
nbproject/build-impl.xml.script.CRC32=0fc51d31
nbproject/build-impl.xml.stylesheet.CRC32=576378a2@1.32.1.45
application.title=LanBortalDatabase
application.vendor=tuukka
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/LanBortalDatabase.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.LanBortalDatabase-src=src
file.reference.slf4j-api-1.5.8.jar=../LanBortal/EarContent/lib/slf4j-api-1.5.8.jar
file.reference.slf4j-jdk14-1.5.8.jar=../LanBortal/EarContent/lib/slf4j-jdk14-1.5.8.jar
includes=**
jar.compress=false
javac.classpath=\
${libs.javaee-api-6.0.classpath}:\
${file.reference.slf4j-api-1.5.8.jar}:\
${file.reference.slf4j-jdk14-1.5.8.jar}:\
${reference.LanBortalUtilities.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.source=1.5
javac.target=1.5
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit.classpath}:\
${libs.junit_4.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
main.class=
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
platform.active=default_platform
project.LanBortalUtilities=../LanBortalUtilities
reference.LanBortalUtilities.jar=${project.LanBortalUtilities}/dist/LanBortalUtilities.jar
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=${file.reference.LanBortalDatabase-src}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>LanBortalDatabase</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots/>
</data>
<references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
<reference>
<foreign-project>LanBortalUtilities</foreign-project>
<artifact-type>jar</artifact-type>
<script>build.xml</script>
<target>jar</target>
<clean-target>clean</clean-target>
<id>jar</id>
</reference>
</references>
</configuration>
</project>
<?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/bortal</jta-data-source>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.cache.size.default" value="16384" />
<property name="eclipselink.ddl-generation.output-mode"
value="database" />
<property name="eclipselink.logging.logger" value="ServerLogger" />
<property name="eclipselink.jdbc.uppercase-columns" value="false" />
<property name="eclipselink.target-database"
value="fi.insomnia.bortal.database.BortalPostgreSQLPlatform" />
<property name="eclipselink.session-event-listener"
value="org.ancoron.postgresql.jpa.eclipselink.ConverterInitializer" />
<property name="eclipselink.descriptor.customizer"
value="fi.insomnia.bortal.database.BortalDescriptorCustomizer" />
</properties>
</persistence-unit>
</persistence>
# Do not delete: this file is used by automated destinations discovery.
\ No newline at end of file
package fi.insomnia.bortal.database;
import java.util.List;
import org.eclipse.persistence.config.DescriptorCustomizer;
import org.eclipse.persistence.descriptors.ChangedFieldsLockingPolicy;
import org.eclipse.persistence.descriptors.ClassDescriptor;
import org.eclipse.persistence.descriptors.ReturningPolicy;
import org.eclipse.persistence.internal.helper.DatabaseField;
public class BortalDescriptorCustomizer implements DescriptorCustomizer {
@Override
public void customize(ClassDescriptor descriptor) throws Exception {
// Optimistic locking policy
ChangedFieldsLockingPolicy changedFieldsLockingPolicy = new ChangedFieldsLockingPolicy();
descriptor.setOptimisticLockingPolicy(changedFieldsLockingPolicy);
// Returningpolicy
ReturningPolicy returningPolicy = new ReturningPolicy();
List<DatabaseField> pkFields = descriptor.getPrimaryKeyFields();
for (final DatabaseField field : pkFields) {
returningPolicy.addFieldForInsertReturnOnly(field);
field.setUpdatable(false);
field.setInsertable(false);
}
for (final DatabaseField field : descriptor.getFields()) {
if (pkFields.contains(field))
continue;
returningPolicy.addFieldForInsert(field);
returningPolicy.addFieldForUpdate(field);
}
descriptor.setReturningPolicy(returningPolicy);
}
}
package fi.insomnia.bortal.database;
import java.util.Hashtable;
import org.eclipse.persistence.internal.databaseaccess.FieldTypeDefinition;
import org.eclipse.persistence.platform.database.PostgreSQLPlatform;
public class BortalPostgreSQLPlatform extends PostgreSQLPlatform {
private static final long serialVersionUID = 6351395815598077327L;
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected Hashtable buildFieldTypes() {
Hashtable map = super.buildFieldTypes();
map.put(String.class, new FieldTypeDefinition("TEXT", false));
map.put(java.sql.Timestamp.class, new FieldTypeDefinition(
"TIMESTAMPTZ", false));
return map;
}
}
package fi.insomnia.bortal.model;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned;
import fi.insomnia.bortal.enums.ActionLogMessageState;
@Entity
@Table(name = "actionlog_messages")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class ActionLogMessage extends GenericEntity {
private static final long serialVersionUID = -2902547412412000488L;
@Column(name = "time", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date time = new Date();
@JoinColumn(name = "user_id")
private User user;
@JoinColumn(name = "crew", nullable = false)
private Role crew;
@Column(name = "message", nullable = false)
private String message;
@OneToMany(mappedBy = "actionLogMessage", cascade = CascadeType.ALL)
@PrivateOwned
@OrderBy("id")
private List<ActionLogMessageResponse> actionLogMessageResponses = new ArrayList<ActionLogMessageResponse>();
@Column(name = "state", nullable = true)
@Enumerated(EnumType.STRING)
private ActionLogMessageState state;
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Role getCrew() {
return crew;
}
public void setCrew(Role crew) {
this.crew = crew;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public ActionLogMessageState getState() {
return state;
}
public void setState(ActionLogMessageState state) {
this.state = state;
}
public List<ActionLogMessageResponse> getActionLogMessageResponses() {
return actionLogMessageResponses;
}
public void setActionLogMessageResponses(List<ActionLogMessageResponse> actionLogMessageResponses) {
this.actionLogMessageResponses = actionLogMessageResponses;
}
}
package fi.insomnia.bortal.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import fi.insomnia.bortal.enums.ActionLogMessageState;
@Entity
@Table(name = "actionlog_message_responses")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class ActionLogMessageResponse extends GenericEntity {
private static final long serialVersionUID = 1L;
@Column(name = "time", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date time = new Date();
@JoinColumn(name = "user_id")
private EventUser user;
@Column(name = "message", nullable = false)
private String message;
@Column(name = "state_change", nullable = true)
@Enumerated(EnumType.STRING)
private ActionLogMessageState stateChange;
@JoinColumn(name = "actionlog_message_id", referencedColumnName = "id")
@ManyToOne(optional = false)
private ActionLogMessage actionLogMessage;
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public EventUser getUser() {
return user;
}
public void setUser(EventUser user) {
this.user = user;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public ActionLogMessageState getStateChange() {
return stateChange;
}
public void setStateChange(ActionLogMessageState stateChange) {
this.stateChange = stateChange;
}
public ActionLogMessage getActionLogMessage() {
return actionLogMessage;
}
public void setActionLogMessage(ActionLogMessage message) {
this.actionLogMessage = message;
}
}
package fi.insomnia.bortal.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
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.apps.IAppPermission;
@Entity
@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 {
protected static final String APPLICATION_PERMISSION_CONVERTER = "application_permission_perm_typeconverter";
private static final long serialVersionUID = -7768599976770042101L;
protected static final String ROLE_ID_COLUMN = "role_id";
public static final String APPLICATION_COLUMN = "application";
public static final String PERMISSION_COLUMN = "permission";
@Column(name = APPLICATION_COLUMN, nullable = false, length = 40)
private String application;
// @ManyToOne
// @JoinColumn(nullable = false, name = EVENT_ID_COLUMN)
// private LanEvent event;
@ManyToOne(optional = false)
@JoinColumn(nullable = false, name = ROLE_ID_COLUMN)
private Role role;
@Column(nullable = false, name = PERMISSION_COLUMN, length = 40)
private String permission;
public ApplicationPermission() {
super();
}
public ApplicationPermission(Role role) {
this.role = role;
}
public ApplicationPermission(Role role, IAppPermission perm) {
this(role);
this.role = role;
setPermission(perm);
}
public Role getRole() {
return role;
}
public void setRole(Role rolesId) {
this.role = rolesId;
}
@Transient
private BortalApplication privateApp;
@Transient
private IAppPermission privatePerm;
public BortalApplication getApplication() {
if (privateApp == null && application != null) {
privateApp = BortalApplication.valueOf(application);
}
return privateApp;
}
public void setPermission(IAppPermission perm) {
privatePerm = perm;
privateApp = perm.getParent();
this.application = perm.getParent().toString();
this.permission = perm.toString();
}
public IAppPermission getPermission() {
if (privatePerm == null && application != null && permission != null) {
for (IAppPermission appPerm : getApplication().getPermissions()) {
if (appPerm.toString().equals(permission)) {
privatePerm = appPerm;
break;
}
}
}
return privatePerm;
}
}
package fi.insomnia.bortal.model;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
@Entity
@Table(name = "card_barcode")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class CardBarcode extends GenericEntity {
private static final long serialVersionUID = 4771609802672223277L;
@ManyToOne
@JoinColumn(name = "printed_cards_id")
private PrintedCard printedCard;
public PrintedCard getPrintedCard() {
return printedCard;
}
public void setPrintedCard(PrintedCard printedCard) {
this.printedCard = printedCard;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
* ID-card templates for the event.
*/
@Entity
@Table(name = "card_templates")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class CardTemplate extends GenericEntity {
private static final long serialVersionUID = -5754760238181167610L;
@ManyToOne
@JoinColumn(nullable = false, name = "event_id", referencedColumnName = LanEvent.ID_COLUMN)
private LanEvent event;
@Lob
@Column(name = "template_image")
private byte[] image;
@Column(name = "template_name", nullable = false)
private String name;
@Column(name = "power", nullable = false)
private int power = 0;
@OneToMany(mappedBy = "cardTemplate")
private List<Role> roles;
@OneToMany(mappedBy = "template")
private List<PrintedCard> cards;
public CardTemplate() {
super();
}
public CardTemplate(LanEvent event) {
super();
this.setEvent(event);
}
public CardTemplate(LanEvent event, String templateName) {
this(event);
this.name = templateName;
}
public byte[] getImage() {
return image;
}
public void setImage(byte[] templateImage) {
this.image = templateImage;
}
public String getName() {
return name;
}
public void setName(String templateName) {
this.name = templateName;
}
public List<Role> getRoles() {
return roles;
}
public void setRoles(List<Role> roleList) {
this.roles = roleList;
}
public void setCards(List<PrintedCard> cards) {
this.cards = cards;
}
public List<PrintedCard> getCards() {
return cards;
}
public LanEvent getEvent() {
return event;
}
public void setPower(int power) {
this.power = power;
}
public int getPower() {
return power;
}
public void setEvent(LanEvent event) {
this.event = event;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import java.util.Calendar;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
* Competition to be held at the event.
*/
@Entity
@Table(name = "compos")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Compo extends GenericEntity {
private static final long serialVersionUID = 2L;
/**
* Name of the competition.
*/
@Column(name = "compo_name", nullable = false)
private String name;
public static final String EVENT_ID_COLUMN = "event_id";
@ManyToOne()
@JoinColumn(name = EVENT_ID_COLUMN, nullable = false)
private LanEvent event;
/**
* Start time of the competition Submitting entries should be disabled after
* this time.
*/
@Column(name = "compo_start")
@Temporal(TemporalType.TIMESTAMP)
private Calendar startTime;
@Column(name = "compo_end")
@Temporal(TemporalType.TIMESTAMP)
private Calendar endTime;
/**
* When the voting should start
*
* @see {@link #holdVoting}
*/
@Column(name = "vote_start")
@Temporal(TemporalType.TIMESTAMP)
private Calendar voteStart;
@Column(name = "vote_end")
@Temporal(TemporalType.TIMESTAMP)
private Calendar voteEnd;
@Column(name = "submit_start")
@Temporal(TemporalType.TIMESTAMP)
private Calendar submitStart;
@Column(name = "submit_end")
@Temporal(TemporalType.TIMESTAMP)
private Calendar submitEnd;
@Lob
@Column(name = "description")
private String description;
@Column(name = "max_participant_count")
private int maxParticipantCount;
/**
* If ( for some unimaginable reason ) compo is delayed hold voting can be
* used to postpone the start of the voting from the time specified in
* {@link #voteStart}
*/
@Column(name = "hold_voting", nullable = false)
private boolean holdVoting = true;
/**
* Entries submitted to participate this compo.
*/
@OneToMany(cascade = CascadeType.ALL, mappedBy = "compo")
@OrderBy("sort")
private List<CompoEntry> compoEntries;
public Compo(String compoName, boolean holdVoting) {
this();
this.name = compoName;
this.holdVoting = holdVoting;
}
public Compo() {
super();
}
public String getName() {
return name;
}
public void setName(String compoName) {
this.name = compoName;
}
public Calendar getStartTime() {
return startTime;
}
public void setStartTime(Calendar compoStart) {
this.startTime = compoStart;
}
public Calendar getVoteStart() {
return voteStart;
}
public void setVoteStart(Calendar voteStart) {
this.voteStart = voteStart;
}
public Calendar getVoteEnd() {
return voteEnd;
}
public void setVoteEnd(Calendar voteEnd) {
this.voteEnd = voteEnd;
}
public Calendar getSubmitStart() {
return submitStart;
}
public void setSubmitStart(Calendar submitStart) {
this.submitStart = submitStart;
}
public Calendar getSubmitEnd() {
return submitEnd;
}
public void setSubmitEnd(Calendar submitEnd) {
this.submitEnd = submitEnd;
}
public boolean getHoldVoting() {
return holdVoting;
}
public void setHoldVoting(boolean holdVoting) {
this.holdVoting = holdVoting;
}
public List<CompoEntry> getCompoEntries() {
return compoEntries;
}
public void setCompoEntries(List<CompoEntry> compoEntryList) {
this.compoEntries = compoEntryList;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
/**
* @return the maxParticipantCount
*/
public int getMaxParticipantCount() {
return maxParticipantCount;
}
/**
* @param maxParticipantCount
* the maxParticipantCount to set
*/
public void setMaxParticipantCount(int maxParticipantCount) {
this.maxParticipantCount = maxParticipantCount;
}
public LanEvent getEvent() {
return event;
}
public void setEvent(LanEvent event) {
this.event = event;
}
public Calendar getEndTime() {
return endTime;
}
public void setEndTime(Calendar endTime) {
this.endTime = endTime;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import java.util.Calendar;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned;
/**
*
*/
@Entity
@Table(name = "compo_entries")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class CompoEntry extends GenericEntity {
private static final long serialVersionUID = 2L;
@JoinColumn(name = "compo_id", referencedColumnName = "id", nullable = false)
@ManyToOne(optional = false)
private Compo compo;
@Column(name = "entry_created", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Calendar created = Calendar.getInstance();
@Column(name = "title", nullable = false)
private String title;
@Column(name = "author")
private String author;
@Lob
@Column(name = "notes")
private String notes;
@Lob
@Column(name = "screen_message")
private String screenMessage;
@Column(name = "sort")
private Integer sort;
@Column(name = "final_position")
private Integer finalPosition;
@JoinColumn(name = "current_file_id", referencedColumnName = CompoEntryFile.ID_COLUMN)
@OneToOne
private CompoEntryFile currentFile;
@OneToMany(mappedBy = "compoEntry")
private List<Vote> votes;
@PrivateOwned
@OneToMany(cascade = CascadeType.ALL, mappedBy = "entry", fetch = FetchType.LAZY)
private List<CompoEntryFile> files;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "entry")
private List<CompoEntryParticipant> participants;
@JoinColumn(name = "creator_eventuser_id", referencedColumnName = EventUser.ID_COLUMN)
@ManyToOne
private EventUser creator;
public CompoEntry() {
super();
}
public Calendar getCreated() {
return created;
}
public void setCreated(Calendar entryCreated) {
this.created = entryCreated;
}
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
public String getScreenMessage() {
return screenMessage;
}
public void setScreenMessage(String screenMessage) {
this.screenMessage = screenMessage;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public List<Vote> getVotes() {
return votes;
}
public void setVotes(List<Vote> voteList) {
this.votes = voteList;
}
public List<CompoEntryFile> getFiles() {
return files;
}
public void setFiles(List<CompoEntryFile> compoEntryFileList) {
this.files = compoEntryFileList;
}
public List<CompoEntryParticipant> getParticipants() {
return participants;
}
public void setParticipants(
List<CompoEntryParticipant> compoEntryParticipantList) {
this.participants = compoEntryParticipantList;
}
public Compo getCompo() {
return compo;
}
public void setCompo(Compo composId) {
this.compo = composId;
}
public EventUser getCreator() {
return creator;
}
public void setCreator(EventUser creator) {
this.creator = creator;
}
public void setFinalPosition(Integer finalPosition) {
this.finalPosition = finalPosition;
}
public Integer getFinalPosition() {
return finalPosition;
}
public void setCurrentFile(CompoEntryFile currentFile) {
this.currentFile = currentFile;
}
public CompoEntryFile getCurrentFile() {
return currentFile;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import java.util.Calendar;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
*
*/
@Entity
@Table(name = "compo_entry_files")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class CompoEntryFile extends GenericEntity {
private static final long serialVersionUID = 1L;
@Column(name = "mime_type")
private String mimeType;
@Column(name = "file_name")
private String fileName;
@Lob
@Column(name = "description")
private String description;
@Column(name = "hash")
private String hash;
@Lob
@Column(name = "file_data")
private byte[] fileData;
@Column(name = "uploaded", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Calendar uploaded = Calendar.getInstance();
@JoinColumn(name = "entry_id", referencedColumnName = "id", nullable = false, updatable = false)
@ManyToOne(optional = false)
private CompoEntry entry;
public CompoEntryFile() {
super();
}
public CompoEntryFile(CompoEntry entry) {
this.entry = entry;
}
public String getMimeType() {
return mimeType;
}
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
public byte[] getFileData() {
return fileData;
}
public void setFileData(byte[] fileData) {
this.fileData = fileData;
}
public Calendar getUploaded() {
return uploaded;
}
public void setUploaded(Calendar uploaded) {
this.uploaded = uploaded;
}
public CompoEntry getEntriesId() {
return entry;
}
public void setEntriesId(CompoEntry entriesId) {
this.entry = entriesId;
}
}
package fi.insomnia.bortal.model;
import java.util.Calendar;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
*
*/
@Entity
@Table(name = "compo_entry_participations")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class CompoEntryParticipant extends GenericEntity {
private static final long serialVersionUID = 2L;
@JoinColumn(name = "entry_id", referencedColumnName = "id", nullable = false, updatable = false)
@ManyToOne(optional = false)
private CompoEntry entry;
@Column(name = "role")
private String role;
@Column(name = "nick")
private String nick;
@Column(name = "confirmed")
@Temporal(TemporalType.TIMESTAMP)
private Calendar confirmed;
@JoinColumn(name = "eventuser_id", referencedColumnName = EventUser.ID_COLUMN, nullable = false, updatable = false)
@ManyToOne(optional = false)
private EventUser user;
public CompoEntry getEntry() {
return entry;
}
public void setEntry(CompoEntry entry) {
this.entry = entry;
}
public CompoEntryParticipant(CompoEntry entry, EventUser participant) {
super();
this.entry = entry;
this.user = participant;
}
public CompoEntryParticipant() {
super();
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public EventUser getUser() {
return user;
}
public void setUser(EventUser user) {
this.user = user;
}
/**
* @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;
}
}
package fi.insomnia.bortal.model;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
*
*/
@Entity
@Table(name = "discount_instances")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class DiscountInstance extends GenericEntity {
private static final long serialVersionUID = 2192672129232748522L;
@JoinColumn(name = "account_event_id", referencedColumnName = "id", nullable = false, updatable = false)
@ManyToOne
private AccountEvent accountEvent;
@JoinColumn(name = "discount_id", referencedColumnName = "id", nullable = false, updatable = false)
@ManyToOne(optional = false)
private Discount discount;
public DiscountInstance() {
super();
}
public DiscountInstance(AccountEvent ac, Discount d) {
super();
accountEvent = ac;
discount = d;
}
public AccountEvent getAccountEvent() {
return accountEvent;
}
public void setAccountEvent(AccountEvent accountEventsId) {
this.accountEvent = accountEventsId;
}
public Discount getDiscount() {
return discount;
}
public void setDiscount(Discount discountsId) {
this.discount = discountsId;
}
}
package fi.insomnia.bortal.model;
import java.util.Date;
import java.util.Random;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
@MappedSuperclass
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public abstract class EntityEquals {
@Override
public final String toString() {
return new StringBuilder(this.getClass().getCanonicalName()).append("[").append(getId()).append("]").toString();
}
@Transient
private Integer rndid;
protected abstract Object getId();
@Override
public boolean equals(Object o) {
boolean ret = false;
if (this == o) {
ret = true;
} else if (o != null && o instanceof EntityEquals && this.getClass().getCanonicalName().equals(o.getClass().getCanonicalName())) {
EntityEquals oobj = (EntityEquals) o;
if (getId() == null) {
ret = (getRndid().equals(oobj.rndid));
} else {
ret = getId().equals(oobj.getId());
}
}
return ret;
}
private Integer getRndid() {
if (rndid == null) {
Random rng = new Random(new Date().getTime());
rndid = Integer.valueOf(rng.nextInt());
}
return rndid;
}
@Override
public final int hashCode() {
return ((rndid != null || getId() == null) ? getRndid() : getId().hashCode());
}
}
package fi.insomnia.bortal.model;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned;
/**
*
*/
@Entity
@Table(name = "maps")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class EventMap extends GenericEntity {
private static final long serialVersionUID = 3411450245513673619L;
@ManyToOne()
private LanEvent event;
public LanEvent getEvent() {
return event;
}
public void setEvent(LanEvent event) {
this.event = event;
}
@Lob
@Column(name = "map_data")
private byte[] mapData;
@Column(name = "map_name")
private String name;
@OrderBy("name")
@OneToMany(cascade = CascadeType.ALL, mappedBy = "map")
@PrivateOwned
private List<Place> places = new ArrayList<Place>();
@OneToMany(mappedBy = "eventMap")
private List<Reader> readers;
@Column(nullable = false)
private boolean active = true;
@Column(name = "notes")
@Lob
private String notes;
public EventMap() {
super();
}
public EventMap(LanEvent event) {
super();
this.event = event;
}
public String getName() {
return name;
}
public void setName(String mapName) {
this.name = mapName;
}
public List<Place> getPlaces() {
return places;
}
public void setPlaces(List<Place> placeList) {
this.places = placeList;
}
/**
* @return the readers
*/
public List<Reader> getReaders() {
return readers;
}
/**
* @param readers
* the readers to set
*/
public void setReaders(List<Reader> readers) {
this.readers = readers;
}
public void setMapData(byte[] mapData) {
this.mapData = mapData;
}
public byte[] getMapData() {
return mapData;
}
public void setActive(boolean active) {
this.active = active;
}
public boolean isActive() {
return active;
}
public void setNotes(String notes) {
this.notes = notes;
}
public String getNotes() {
return notes;
}
}
package fi.insomnia.bortal.model;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
*
*/
@Entity
@Table(name = "event_organiser")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class EventOrganiser extends GenericEntity {
private static final long serialVersionUID = 1L;
@Column(name = "organisation")
private String organisation;
@Column(name = "bundle_country")
private String bundleCountry;
@OrderBy
@OneToMany(cascade = CascadeType.ALL, mappedBy = "organiser")
private List<LanEvent> events;
@Column(nullable = false, name = "bill_address1")
private String billAddress1 = "";
@Column(nullable = false, name = "bill_address2")
private String billAddress2 = "";
@Column(nullable = false, name = "bill_address3")
private String billAddress3 = "";
@Column(nullable = false, name = "bill_address4")
private String billAddress4 = "";
@Column(nullable = false, name = "bank_number1")
private String bankNumber1 = "";
@Column(nullable = false, name = "bank_number2")
private String bankNumber2 = "";
@Column(nullable = false, name = "bank_name1")
private String bankName1 = "";
@Column(nullable = false, name = "bank_name2")
private String bankName2 = "";
public List<LanEvent> getEvents() {
return events;
}
public void setEvents(List<LanEvent> eventList) {
this.events = eventList;
}
/**
* @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;
}
public String getBillAddress1() {
return billAddress1;
}
public void setBillAddress1(String billAddress1) {
this.billAddress1 = billAddress1;
}
public String getBillAddress2() {
return billAddress2;
}
public void setBillAddress2(String billAddress2) {
this.billAddress2 = billAddress2;
}
public String getBillAddress3() {
return billAddress3;
}
public void setBillAddress3(String billAddress3) {
this.billAddress3 = billAddress3;
}
public String getBillAddress4() {
return billAddress4;
}
public void setBillAddress4(String billAddress4) {
this.billAddress4 = billAddress4;
}
public String getBankNumber1() {
return bankNumber1;
}
public void setBankNumber1(String bankNumber1) {
this.bankNumber1 = bankNumber1;
}
public String getBankNumber2() {
return bankNumber2;
}
public void setBankNumber2(String bankNumber2) {
this.bankNumber2 = bankNumber2;
}
public String getBankName1() {
return bankName1;
}
public void setBankName1(String bankName1) {
this.bankName1 = bankName1;
}
public String getBankName2() {
return bankName2;
}
public void setBankName2(String bankName2) {
this.bankName2 = bankName2;
}
}
package fi.insomnia.bortal.model;
import java.io.Serializable;
import java.util.Calendar;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
public class Feedback extends GenericEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ManyToOne(optional = true)
@JoinColumn(nullable = true, name = "eventuser_id")
private EventUser sender;
@ManyToOne(optional = false)
@JoinColumn(nullable = false, name = "event_id")
private LanEvent event;
@Temporal(TemporalType.TIMESTAMP)
private Calendar timestamp;
@Lob
private String message;
public Feedback() {
super();
}
public EventUser getSender() {
return sender;
}
public void setSender(EventUser sender) {
this.sender = sender;
}
public Calendar getTimestamp() {
return timestamp;
}
public void setTimestamp(Calendar timestamp) {
this.timestamp = timestamp;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public LanEvent getEvent() {
return event;
}
public void setEvent(LanEvent event) {
this.event = event;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
*
*/
@Entity
@Table(name = "food_waves")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class FoodWave extends GenericEntity {
private static final long serialVersionUID = 9221716203467295049L;
@Column(name = "wave_name", nullable = false)
private String name;
@Lob
@Column(name = "wave_description")
private String description;
@Column(name = "wave_time")
@Temporal(TemporalType.TIMESTAMP)
private Date time;
@Column(name = "max_foods")
private Integer maximumFoods;
@Column(name = "wave_closed", nullable = false, columnDefinition = "boolean default false")
private boolean closed = false;
@OneToMany(mappedBy = "foodWave")
private List<AccountEvent> accountEvents;
@OneToMany(mappedBy = "foodwave")
private List<BillLine> billLines;
@ManyToOne
@JoinColumn(name = "template_id", referencedColumnName = "id", nullable = false)
private FoodWaveTemplate template;
public FoodWave() {
super();
}
public FoodWave(String waveName, boolean waveClosed) {
super();
this.name = waveName;
this.closed = waveClosed;
}
public String getName() {
return name;
}
public void setName(String waveName) {
this.name = waveName;
}
public String getDescription() {
return description;
}
public void setDescription(String waveDescription) {
this.description = waveDescription;
}
public Date getTime() {
return time;
}
public void setTime(Date waveTime) {
this.time = waveTime;
}
public boolean getClosed() {
return closed;
}
public boolean isClosed() {
return closed;
}
public void setClosed(boolean waveClosed) {
this.closed = waveClosed;
}
public void toggleClosed() {
this.closed = !isClosed();
}
public List<AccountEvent> getAccountEvents() {
return accountEvents;
}
public void setAccountEvents(List<AccountEvent> accountEventList) {
this.accountEvents = accountEventList;
}
public void setTemplate(FoodWaveTemplate template) {
this.template = template;
}
public FoodWaveTemplate getTemplate() {
return template;
}
public boolean isFull() {
if(getMaximumFoods() <= 0) {
return false;
}
if(getReservedCount() >= getMaximumFoods()) {
return true;
}
return false;
}
/**
* Check if foodwave is orderable
*
* That means that it's not closed, full and it's in future
*
* @return
*/
public boolean isOrderable() {
if (isClosed()) {
return false;
}
if (getTime().before(new Date())) {
return false;
}
if (isFull()) {
return false;
}
return true;
}
public List<Product> getOrderedProducts() {
List<Product> retlist = new ArrayList<Product>();
if (getAccountEvents() != null) {
for (AccountEvent ae : getAccountEvents()) {
if (!retlist.contains(ae.getProduct())) {
retlist.add(ae.getProduct());
}
}
}
return retlist;
}
public List<BillLine> getBillLines() {
return billLines;
}
public Integer getMaximumFoods() {
if(maximumFoods == null) {
return 0;
}
return maximumFoods;
}
public void setBillLines(List<BillLine> billLines) {
this.billLines = billLines;
}
public Integer getReservedCount() {
Integer retval = 0;
retval += getOrderedCount();
retval += getUnpaidCount();
return retval;
}
public void setMaximumFoods(Integer maximumFoods) {
this.maximumFoods = maximumFoods;
}
public Integer getUnpaidCount() {
Integer ret = 0;
for (BillLine line : getBillLines()) {
if (!line.getBill().isPaid()) {
ret += line.getQuantity().intValue();
}
}
return ret;
}
public Integer getOrderedCount() {
Integer ret = 0;
if (getAccountEvents() != null) {
for(AccountEvent ae : getAccountEvents()) {
ret += ae.getQuantity().intValue();
}
}
return ret;
}
public boolean isDelivered() {
if (getAccountEvents() != null && getReservedCount() != 0) {
for(AccountEvent ae : getAccountEvents()) {
if (ae.isEventDelivered()) {
return true;
}
}
return false;
}
return true;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
*
*/
@Entity
@Table(name = "food_wave_templates")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class FoodWaveTemplate extends GenericEntity {
private static final long serialVersionUID = 1L;
private static final String EVENT_ID = "event_id";
@ManyToOne()
@JoinColumn(name = EVENT_ID, nullable = false)
private LanEvent event;
@Column(name = "template_name", nullable = false)
private String name;
@Lob
@Column(name = "template_description")
private String description;
@ManyToMany(mappedBy = "foodWaveTemplates", cascade=CascadeType.ALL)
private List<Product> products;
@OneToMany(mappedBy = "template")
@OrderBy(value = "time")
private List<FoodWave> foodwaves;
@Column(name = "max_foods")
private Integer maximumFoods;
public FoodWaveTemplate() {
}
public FoodWaveTemplate(String templateName) {
super();
this.name = templateName;
}
public String getName() {
return name;
}
public void setName(String templateName) {
this.name = templateName;
}
public String getDescription() {
return description;
}
public void setDescription(String templateDescription) {
this.description = templateDescription;
}
/**
* @return the products
*/
public List<Product> getProducts() {
return products;
}
/**
* @param products
* the products to set
*/
public void setProducts(List<Product> products) {
this.products = products;
}
public void setFoodwaves(List<FoodWave> foodwaves) {
this.foodwaves = foodwaves;
}
public List<FoodWave> getFoodwaves() {
return foodwaves;
}
public LanEvent getEvent() {
return event;
}
public void setEvent(LanEvent event) {
this.event = event;
}
public List<FoodWave> getOrderableFoodwaves() {
List<FoodWave> returnList = new ArrayList<FoodWave>();
for (FoodWave wave : getFoodwaves()) {
if (wave.isOrderable()) {
returnList.add(wave);
}
}
return returnList;
}
}
package fi.insomnia.bortal.model;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import fi.insomnia.bortal.utilities.jpa.ModelInterface;
@MappedSuperclass
public class GenericEntity extends EntityEquals implements ModelInterface {
private static final long serialVersionUID = -9041737052951021560L;
public static final String ID_COLUMN = "id";
@Id
@Column(name = ID_COLUMN, nullable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Override
public final Integer getId() {
return id;
}
@Override
public final void setId(Integer id) {
this.id = id;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import static javax.persistence.CascadeType.ALL;
import java.util.Calendar;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
*
*/
@Entity
@Table(name = "group_memberships")
// , uniqueConstraints = { @UniqueConstraint(columnNames = {
// GroupMembership.EVENTUSER_ID, GroupMembership.GROUP_ID }) })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class GroupMembership extends GenericEntity {
/**
*
*/
private static final long serialVersionUID = 2195875306960651526L;
protected static final String EVENTUSER_ID = "eventuser_id";
protected static final String GROUP_ID = "group_id";
@Column(name = "invite_token", unique = true, nullable = false)
private String inviteToken;
@Column(name = "invite_accepted")
@Temporal(TemporalType.TIMESTAMP)
private Calendar inviteAccepted;
@Column(name = "invite_email")
private String inviteEmail;
@Column(name = "invite_name")
private String inviteName;
@ManyToOne(optional = false, cascade = ALL)
@JoinColumn(name = GROUP_ID, referencedColumnName = "id", nullable = false)
private PlaceGroup placeGroup;
@OneToOne(optional = false)
@JoinColumn(name = "place_reservation_id", referencedColumnName = "id", nullable = true)
private Place placeReservation;
@JoinColumn(name = EVENTUSER_ID, referencedColumnName = EventUser.ID_COLUMN)
@ManyToOne
private EventUser user;
@Column(name = "entered_event")
@Temporal(TemporalType.TIMESTAMP)
private Calendar enteredEvent;
public GroupMembership() {
}
public GroupMembership(PlaceGroup pg, Place p, String token) {
super();
this.setPlaceGroup(pg);
this.setPlaceReservation(p);
this.inviteToken = token;
}
public Calendar getInviteAccepted() {
return inviteAccepted;
}
public void setInviteAccepted(Calendar inviteAccepted) {
this.inviteAccepted = inviteAccepted;
}
public String getInviteEmail() {
return inviteEmail;
}
public void setInviteEmail(String inviteEmail) {
this.inviteEmail = inviteEmail;
}
public String getInviteName() {
return inviteName;
}
public void setInviteName(String inviteName) {
this.inviteName = inviteName;
}
public PlaceGroup getPlaceGroup() {
return placeGroup;
}
public void setPlaceGroup(PlaceGroup groupsId) {
this.placeGroup = groupsId;
}
public Place getPlaceReservation() {
return placeReservation;
}
public void setPlaceReservation(Place placeReservation) {
this.placeReservation = placeReservation;
}
public EventUser getUser() {
return user;
}
public void setUser(EventUser usersId) {
this.user = usersId;
}
/**
* @return the enteredEvent
*/
public Calendar getEnteredEvent() {
return enteredEvent;
}
/**
* @param enteredEvent
* the enteredEvent to set
*/
public void setEnteredEvent(Calendar enteredEvent) {
this.enteredEvent = enteredEvent;
}
public void setInviteToken(String inviteToken) {
this.inviteToken = inviteToken;
}
public String getInviteToken() {
return inviteToken;
}
}
package fi.insomnia.bortal.model;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import fi.insomnia.bortal.enums.Gender;
public interface IUser {
public abstract Calendar getCreated();
public abstract void setCreated(Calendar created);
public abstract boolean getActive();
public abstract void setActive(boolean active);
public abstract String getPassword();
public abstract void setPassword(String password);
public abstract String getWholeName();
public abstract String getLastname();
public abstract void setLastname(String lastname);
public abstract String getFirstnames();
public abstract void setFirstnames(String firstnames);
public abstract Date getBirthday();
public abstract void setBirthday(Date birthday);
public abstract String getNick();
public abstract void setNick(String nick);
public abstract String getEmail();
public abstract void setEmail(String email);
public abstract String getAddress();
public abstract void setAddress(String address);
public abstract String getZip();
public abstract void setZip(String zip);
public abstract String getTown();
public abstract void setTown(String town);
public abstract String getPhone();
public abstract void setPhone(String phone);
public abstract String getLogin();
public abstract void setLogin(String login);
public abstract List<UserImage> getUserImageList();
public abstract void setUserImageList(List<UserImage> userImageList);
/**
* @return the confirmHash
*/
public abstract String getConfirmHash();
/**
* @param confirmHash
* the confirmHash to set
*/
public abstract void setConfirmHash(String confirmHash);
/**
* @return the confirmTime
*/
public abstract Calendar getConfirmTime();
/**
* @param confirmTime
* the confirmTime to set
*/
public abstract void setConfirmTime(Calendar confirmTime);
public abstract void resetPassword(String password);
public abstract boolean checkPassword(String plainPassword);
public abstract void setSuperadmin(boolean superadmin);
public abstract boolean isSuperadmin();
public abstract void setPostalTown(String postalTown);
public abstract String getPostalTown();
public abstract void setGender(Gender gender);
public abstract Gender getGender();
public abstract void setCurrentImage(UserImage currentImage);
public abstract UserImage getCurrentImage();
public abstract boolean isAnonymous();
}
\ No newline at end of file
package fi.insomnia.bortal.model;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
@Entity
@Table(name = "inventory_events")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class InventoryEvent extends GenericEntity {
private static final long serialVersionUID = 1L;
@Column(name = "created", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date created = new Date();
@JoinColumn(name = "user_id")
private User user;
@JoinColumn(name = "product_id")
private Product product;
@Column(name = "info", nullable = true)
private String info;
@Column(name = "quantity", nullable = false, precision = 24, scale = 4)
private BigDecimal quantity;
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public BigDecimal getQuantity() {
return quantity;
}
public void setQuantity(BigDecimal quantity) {
this.quantity = quantity;
}
}
package fi.insomnia.bortal.model;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned;
import fi.insomnia.bortal.enums.EventStatus;
import fi.insomnia.bortal.model.salespoint.Salespoint;
/**
*
*/
@Entity
@Table(name = "events")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class LanEvent extends GenericEntity {
private static final long serialVersionUID = 179811358211927126L;
@Column(name = "start_time")
@Temporal(TemporalType.TIMESTAMP)
private Calendar startTime;
@Column(name = "end_time")
@Temporal(TemporalType.TIMESTAMP)
private Calendar endTime;
@Column(name = "name", nullable = false, unique = true)
private String name;
@Column(nullable = false, name = "event_enabled")
private boolean eventEnabled = false;
/**
* Bill's reference number will be formed by adding this number to the bill
* number and adding the checksum of that number as the last digit
*/
private Integer referenceNumberBase = 54321;
@Column(nullable = false)
private int nextBillNumber = 1;
@JoinColumn(name = "event_organiser_id", referencedColumnName = "id", nullable = false, updatable = false)
@ManyToOne(optional = false)
private EventOrganiser organiser;
@Column(name = "status", nullable = false)
@Enumerated(EnumType.STRING)
private EventStatus status = EventStatus.INACTIVE;
@OneToMany(mappedBy = "parentEvent")
private List<LogEntry> logEntries;
@JoinColumn(name = "default_role_id", referencedColumnName = "id")
@OneToOne
private Role defaultRole;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "event")
private List<Compo> compos;
@OneToMany(mappedBy = "event", cascade = CascadeType.ALL)
private List<CardTemplate> cardTemplates;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "event")
private List<EventMap> eventMaps;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "event")
private List<Role> roles;
@OneToMany(mappedBy = "event")
private List<Bill> bills;
@OneToMany(mappedBy = "event")
private List<Reader> readers;
@OneToMany(mappedBy = "event", cascade = CascadeType.ALL)
private List<Poll> polls;
@OneToMany(mappedBy = "event", cascade = CascadeType.ALL)
private List<Salespoint> salespoints;
@OneToMany(mappedBy = "event", cascade = CascadeType.ALL)
@PrivateOwned
private List<LanEventDomain> domains = new ArrayList<LanEventDomain>();
@PrivateOwned
@OneToMany(mappedBy = "event", cascade = CascadeType.ALL)
private List<LanEventProperty> properties = new ArrayList<LanEventProperty>();
public LanEvent() {
}
public Calendar getStartTime() {
return startTime;
}
public void setStartTime(Calendar startTime) {
this.startTime = startTime;
}
public Calendar getEndTime() {
return endTime;
}
public void setEndTime(Calendar endTime) {
this.endTime = endTime;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public EventStatus getStatus() {
return status;
}
public void setStatus(EventStatus eventStatusId) {
this.status = eventStatusId;
}
public Role getDefaultRole() {
return defaultRole;
}
public void setDefaultRole(Role defaultRole) {
this.defaultRole = defaultRole;
}
public List<Compo> getCompos() {
return compos;
}
public void setCompos(List<Compo> compoList) {
this.compos = compoList;
}
public List<CardTemplate> getCardTemplates() {
return cardTemplates;
}
public void setCardTemplates(List<CardTemplate> cardTemplateList) {
this.cardTemplates = cardTemplateList;
}
public List<EventMap> getEventMaps() {
return eventMaps;
}
public void setEventMaps(List<EventMap> eventMapList) {
this.eventMaps = eventMapList;
}
public List<Role> getRoles() {
return roles;
}
public void setRoles(List<Role> roleList) {
this.roles = roleList;
}
/**
* @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;
}
public void setOrganiser(EventOrganiser organiser) {
this.organiser = organiser;
}
public EventOrganiser getOrganiser() {
return organiser;
}
public void setReferenceNumberBase(Integer referenceNumberBase) {
this.referenceNumberBase = referenceNumberBase;
}
public Integer getReferenceNumberBase() {
return referenceNumberBase;
}
public void setLogEntries(List<LogEntry> logEntries) {
this.logEntries = logEntries;
}
public List<LogEntry> getLogEntries() {
return logEntries;
}
public void setNextBillNumber(int nextBillNumber) {
this.nextBillNumber = nextBillNumber;
}
public int getNextBillNumber() {
return nextBillNumber;
}
public boolean isEventEnabled() {
return eventEnabled;
}
public void setEventEnabled(boolean eventEnabled) {
this.eventEnabled = eventEnabled;
}
public List<Poll> getPolls() {
return polls;
}
public void setPolls(List<Poll> polls) {
this.polls = polls;
}
public List<Salespoint> getSalespoints() {
return salespoints;
}
public void setSalespoints(List<Salespoint> salespoints) {
this.salespoints = salespoints;
}
public List<LanEventDomain> getDomains() {
return domains;
}
public void setDomains(List<LanEventDomain> domains) {
this.domains = domains;
}
public List<LanEventProperty> getProperties() {
return properties;
}
public void setProperties(List<LanEventProperty> properties) {
this.properties = properties;
}
}
package fi.insomnia.bortal.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
@Entity
@Table(name = "event_domains")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class LanEventDomain extends GenericEntity {
public LanEventDomain() {
super();
}
public LanEventDomain(LanEvent e, String dom) {
super();
event = e;
domain = dom;
}
private static final long serialVersionUID = -8050125804595746831L;
@Column(name = "domainname", nullable = false, unique = true)
private String domain;
@Lob
@Column(name = "description")
private String description;
@ManyToOne(optional = false)
@JoinColumn(name = "event_id", nullable = false)
private LanEvent event;
private int overridePriority;
public String getDomain() {
return domain;
}
public void setDomain(String domain) {
this.domain = domain;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public LanEvent getEvent() {
return event;
}
public void setEvent(LanEvent event) {
this.event = event;
}
public int getOverridePriority() {
return overridePriority;
}
public void setOverridePriority(int overridePriority) {
this.overridePriority = overridePriority;
}
}
package fi.insomnia.bortal.model;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
@Entity
@Table(name = "event_private_properties", uniqueConstraints = {
@UniqueConstraint(columnNames = { LanEventPrivateProperty.EVENT_ID_COLUMN, LanEventPrivateProperty.KEY_COLUMN }),
@UniqueConstraint(columnNames = { LanEventPrivateProperty.EVENTORG_ID_COLUMN, LanEventPrivateProperty.KEY_COLUMN }),
})
public class LanEventPrivateProperty extends GenericEntity {
/**
*
*/
private static final long serialVersionUID = 1L;
protected static final String KEY_COLUMN = "key";
protected static final String EVENT_ID_COLUMN = "event_id";
protected static final String EVENTORG_ID_COLUMN = "organisation_id";
@ManyToOne()
@JoinColumn(name = EVENTORG_ID_COLUMN, nullable = true)
private EventOrganiser eventorg;
@ManyToOne()
@JoinColumn(name = EVENT_ID_COLUMN, nullable = true)
private LanEvent event;
@Column(name = KEY_COLUMN, nullable = false)
@Enumerated(EnumType.STRING)
private LanEventPrivatePropertyKey key;
@Lob
@Column(name = "description")
private String description;
@Column(name = "boolean_value")
private boolean booleanValue;
@Column(name = "text_value")
@Lob
private String textvalue;
@Column(precision = 30, scale = 8, name = "decimal_value")
private BigDecimal decimalValue;
@Column(name = "long_value")
private Long longValue;
@Column(name = "byte_mime")
private String byteMime;
@Column(name = "byte_value")
@Lob
private byte[] byteValue;
@Column(name = "date_value")
@Temporal(TemporalType.TIMESTAMP)
private Date dateValue;
public LanEvent getEvent() {
return event;
}
public void setEvent(LanEvent event) {
this.event = event;
}
public LanEventPrivatePropertyKey getKey() {
return key;
}
public void setKey(LanEventPrivatePropertyKey key) {
this.key = key;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isBooleanValue() {
return booleanValue;
}
public void setBooleanValue(boolean booleanValue) {
this.booleanValue = booleanValue;
}
public String getTextvalue() {
return textvalue;
}
public void setTextvalue(String textvalue) {
this.textvalue = textvalue;
}
public BigDecimal getDecimalValue() {
return decimalValue;
}
public void setDecimalValue(BigDecimal decimalValue) {
this.decimalValue = decimalValue;
}
public Long getLongValue() {
return longValue;
}
public void setLongValue(Long longValue) {
this.longValue = longValue;
}
public String getByteMime() {
return byteMime;
}
public void setByteMime(String byteMime) {
this.byteMime = byteMime;
}
public byte[] getByteValue() {
return byteValue;
}
public void setByteValue(byte[] byteValue) {
this.byteValue = byteValue;
}
public Date getDateValue() {
return dateValue;
}
public void setDateValue(Date dateValue) {
this.dateValue = dateValue;
}
public EventOrganiser getEventorg() {
return eventorg;
}
public void setEventorg(EventOrganiser eventorg) {
this.eventorg = eventorg;
}
}
package fi.insomnia.bortal.model;
// Private data that should never be allowed out of the EJB layer!
public enum LanEventPrivatePropertyKey {
VERKKOMAKSU_KEY_EXPIRE(Type.DATE, null),
VERKKOMAKSU_MERCHANT_ID(Type.TEXT, null),
VERKKOMAKSU_MERCHANT_PASSWORD(Type.TEXT, null),
CHECKOUT_FI_MERCHANT_PASSWORD(Type.TEXT, null),
CHECKOUT_FI_MERCHANT_ID(Type.TEXT, null),
CHECKOUT_FI_KEY_EXPIRE(Type.DATE, null),
;
private enum Type {
TEXT, DATE, DATA
};
private final String defaultvalue;
private final Type type;
public boolean isText() {
return Type.TEXT.equals(type);
}
public boolean isDate() {
return Type.DATE.equals(type);
}
public boolean isData() {
return Type.DATA.equals(type);
}
private LanEventPrivatePropertyKey(Type t, String def)
{
this.type = t;
defaultvalue = def;
}
public String getDefaultvalue() {
return defaultvalue;
}
public Type getType() {
return type;
}
}
package fi.insomnia.bortal.model;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
@Entity
@Table(name = "event_properties", uniqueConstraints = {
@UniqueConstraint(columnNames = { LanEventProperty.EVENT_ID_COLUMN, LanEventProperty.KEY_COLUMN }),
@UniqueConstraint(columnNames = { LanEventProperty.EVENTORG_ID_COLUMN, LanEventProperty.KEY_COLUMN }),
})
public class LanEventProperty extends GenericEntity {
/**
*
*/
private static final long serialVersionUID = 1L;
protected static final String KEY_COLUMN = "key";
protected static final String EVENT_ID_COLUMN = "event_id";
protected static final String EVENTORG_ID_COLUMN = "organisation_id";
@ManyToOne()
@JoinColumn(name = EVENTORG_ID_COLUMN, nullable = true)
private EventOrganiser eventorg;
@ManyToOne()
@JoinColumn(name = EVENT_ID_COLUMN, nullable = true)
private LanEvent event;
@Column(name = KEY_COLUMN, nullable = false)
@Enumerated(EnumType.STRING)
private LanEventPropertyKey key;
@Lob
@Column(name = "description")
private String description;
@Column(name = "boolean_value")
private boolean booleanValue;
@Column(name = "text_value")
@Lob
private String textvalue;
@Column(precision = 30, scale = 8, name = "decimal_value")
private BigDecimal decimalValue;
@Column(name = "long_value")
private Long longValue;
@Column(name = "byte_mime")
private String byteMime;
@Column(name = "byte_value")
@Lob
private byte[] byteValue;
@Column(name = "date_value")
@Temporal(TemporalType.TIMESTAMP)
private Date dateValue;
public LanEvent getEvent() {
return event;
}
public void setEvent(LanEvent event) {
this.event = event;
}
public LanEventPropertyKey getKey() {
return key;
}
public void setKey(LanEventPropertyKey key) {
this.key = key;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isBooleanValue() {
return booleanValue;
}
public void setBooleanValue(boolean booleanValue) {
this.booleanValue = booleanValue;
}
public String getTextvalue() {
return textvalue;
}
public void setTextvalue(String textvalue) {
this.textvalue = textvalue;
}
public BigDecimal getDecimalValue() {
return decimalValue;
}
public void setDecimalValue(BigDecimal decimalValue) {
this.decimalValue = decimalValue;
}
public Long getLongValue() {
return longValue;
}
public void setLongValue(Long longValue) {
this.longValue = longValue;
}
public String getByteMime() {
return byteMime;
}
public void setByteMime(String byteMime) {
this.byteMime = byteMime;
}
public byte[] getByteValue() {
return byteValue;
}
public void setByteValue(byte[] byteValue) {
this.byteValue = byteValue;
}
public Date getDateValue() {
return dateValue;
}
public void setDateValue(Date dateValue) {
this.dateValue = dateValue;
}
public EventOrganiser getEventorg() {
return eventorg;
}
public void setEventorg(EventOrganiser eventorg) {
this.eventorg = eventorg;
}
}
package fi.insomnia.bortal.model;
public enum LanEventPropertyKey {
EVENT_LOGO(Type.DATA, null),
INVITEMAIL_SUBJECT(Type.TEXT, "Invitation to Stream demoparty"),
INVITEMAIL_CONTENT(Type.TEXT, "You have been invited to Stream demoparty by {1}.\n\nYou can register to stream demparty intranet at: {0}\n\nAfter registering to the intranet you can buy a ticket to Stream demoparty reduced price and invite your friends to join the party with you. More information can be found in the intranet. Remember also to visit our website at http://www.streamparty.org and join us at #streamparty in IRCNet. If you have any questions about this mail, registering to intranet, or anything else regarding Stream demoparty, please send us email to info@streamparty.org\n\n-- \nStream organizing\ninfo@streamparty.org"),
PORTAL_EMAIL_ADDRESS(Type.TEXT, "intra@streamparty.org"),
PORTAL_EMAIL_NAME(Type.TEXT, "Streamparty intranet"),
ADMIN_MAIL(Type.TEXT, "intra@streamparty.org"),
EVENT_LAYOUT(Type.TEXT, "template1"),
SHOP_DEFAULT_CASH(Type.BOOL, null), ;
private enum Type {
TEXT, DATE, DATA, BOOL
};
private final String defaultvalue;
private final Type type;
public boolean isText() {
return Type.TEXT.equals(type);
}
public boolean isDate() {
return Type.DATE.equals(type);
}
public boolean isData() {
return Type.DATA.equals(type);
}
public boolean isBoolean() {
return Type.DATA.equals(type);
}
private LanEventPropertyKey(Type t, String def)
{
this.type = t;
defaultvalue = def;
}
public String getDefaultvalue() {
return defaultvalue;
}
public Type getType() {
return type;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
*
*/
@Entity
@Table(name = "locations")
// @NamedQueries({
// @NamedQuery(name = "Location.findAll", query = "SELECT l FROM Location l"),
//
// @NamedQuery(name = "Location.findByLocationName", query =
// "SELECT l FROM Location l WHERE l.name = :name") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Location extends GenericEntity {
private static final long serialVersionUID = 1L;
public static final String EVENT_ID_COLUMN = "event_id";
@ManyToOne()
@JoinColumn(name = EVENT_ID_COLUMN, nullable = false)
private LanEvent event;
@Column(name = "location_name", nullable = false)
private String name;
@OneToMany(mappedBy = "location")
private List<Reader> readers;
@OneToMany(mappedBy = "currentLocation")
private List<PrintedCard> printedCardsAtLocation;
public Location() {
super();
}
public Location(LanEvent event) {
super();
this.event = event;
}
public Location(LanEvent event, String name) {
super();
this.event = event;
this.name = name;
}
public String getName() {
return name;
}
public void setName(String locationName) {
this.name = locationName;
}
public List<Reader> getReaders() {
return readers;
}
public void setReaders(List<Reader> readerList) {
this.readers = readerList;
}
public List<PrintedCard> getPrintedCardsAtLocation() {
return printedCardsAtLocation;
}
public void setPrintedCardsAtLocation(List<PrintedCard> printedCardList) {
this.printedCardsAtLocation = printedCardList;
}
public LanEvent getEvent() {
return event;
}
public void setEvent(LanEvent event) {
this.event = event;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import static javax.persistence.TemporalType.TIMESTAMP;
import java.util.Calendar;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
*
*/
@Entity
@Table(name = "event_log")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class LogEntry extends GenericEntity {
private static final long serialVersionUID = 1L;
@ManyToOne
private LanEvent parentEvent;
@Column(name = "event_time", nullable = false)
@Temporal(TIMESTAMP)
private Calendar time = Calendar.getInstance();
@Lob
@Column(name = "event_description")
private String description;
@JoinColumn(name = "event_log_type_id", referencedColumnName = "id", nullable = false)
@ManyToOne(optional = false)
private LogEntryType type;
@JoinColumn(name = "user_id", referencedColumnName = "id")
@ManyToOne
private User user;
public LogEntry() {
}
public LogEntry(Calendar eventTime) {
this.time = eventTime;
}
public Calendar getTime() {
return time;
}
public void setTime(Calendar eventTime) {
this.time = eventTime;
}
public String getDescription() {
return description;
}
public void setDescription(String eventDescription) {
this.description = eventDescription;
}
public LogEntryType getType() {
return type;
}
public void setType(LogEntryType eventLogTypesId) {
this.type = eventLogTypesId;
}
public User getUser() {
return user;
}
public void setUser(User usersId) {
this.user = usersId;
}
public void setParentEvent(LanEvent parentEvent) {
this.parentEvent = parentEvent;
}
public LanEvent getParentEvent() {
return parentEvent;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
*
*/
@Entity
@Table(name = "event_log_types")
// , uniqueConstraints = { @UniqueConstraint(columnNames = { "events_pk_id",
// "type_name" }) })
@NamedQueries({
@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.findByDescription", query = "SELECT l FROM LogEntryType l WHERE l.description = :description") })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class LogEntryType extends GenericEntity {
private static final long serialVersionUID = 1L;
/**
* Do not change this.. log entries are added to this field..
*/
@Column(name = "type_name", nullable = false, updatable = false, unique = true)
private String name;
@Lob
@Column(name = "event_type_description")
private String description;
/**
* Entries of this type of entrytypes...
*/
@OneToMany(cascade = CascadeType.ALL, mappedBy = "type")
private List<LogEntry> logEntries;
/**
* Admins can change the loglevel of EntryTypes to receive eg. email for
* certain entry types.
*/
private int logLevel = 1;
public LogEntryType() {
}
public String getDescription() {
return description;
}
public void setDescription(String eventTypeDescription) {
this.description = eventTypeDescription;
}
public List<LogEntry> getLogEntries() {
return logEntries;
}
public void setLogEntries(List<LogEntry> logEntryList) {
this.logEntries = logEntryList;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setLogLevel(int logLevel) {
this.logLevel = logLevel;
}
public int getLogLevel() {
return logLevel;
}
}
package fi.insomnia.bortal.model;
import static javax.persistence.CascadeType.ALL;
import static javax.persistence.CascadeType.PERSIST;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned;
import fi.insomnia.bortal.enums.BortalApplication;
import fi.insomnia.bortal.enums.apps.IAppPermission;
@Entity
@Table(name = "menu_navigation",
uniqueConstraints = { @UniqueConstraint(columnNames = {
MenuNavigation.ITEM_COLUMN,
MenuNavigation.EVENT_COLUMN })
})
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class MenuNavigation extends GenericEntity implements Comparable<MenuNavigation> {
private static final long serialVersionUID = 1404769998091479699L;
protected static final String ITEM_COLUMN = "item_id";
protected static final String EVENT_COLUMN = "event_id";
@ManyToOne
@JoinColumn(nullable = false, name = EVENT_COLUMN)
private LanEvent event;
@Lob
private String key;
@Lob
private String header;
@Lob
private String footer;
@Column(nullable = false)
private Integer sort = 1000;
@Column(nullable = false)
private boolean visible = false;
@ManyToOne(cascade = PERSIST)
@JoinColumn(name = ITEM_COLUMN)
private Menuitem item;
@ManyToOne()
private SitePage sitepage;
@ManyToOne
@JoinColumn(nullable = true)
private MenuNavigation parent;
@OneToMany(mappedBy = "parent", cascade = ALL)
@PrivateOwned
@OrderBy("sort")
private List<MenuNavigation> children = new ArrayList<MenuNavigation>();
@Transient
transient private IAppPermission privatePerm;
@Transient
transient private BortalApplication privateApp;
private String application;
private String permission;
private MenuNavigation() {
super();
}
public MenuNavigation(LanEvent ev, String keyString, Integer sort) {
super();
this.sort = sort;
this.event = ev;
this.key = keyString;
this.visible = true;
}
public BortalApplication getApplication() {
if (privateApp == null && application != null) {
privateApp = BortalApplication.valueOf(application);
}
return privateApp;
}
public void setPermission(IAppPermission perm) {
if (perm != null)
{
privatePerm = perm;
privateApp = perm.getParent();
this.application = perm.getParent().toString();
this.permission = perm.toString();
}
}
public IAppPermission getPermission() {
if (privatePerm == null && application != null && permission != null) {
for (IAppPermission appPerm : getApplication().getPermissions()) {
if (appPerm.toString().equals(permission)) {
privatePerm = appPerm;
break;
}
}
}
return privatePerm;
}
public List<MenuNavigation> getChildren() {
return children;
}
public void setChildren(List<MenuNavigation> children) {
this.children = children;
}
public MenuNavigation getParent() {
return parent;
}
public void setParent(MenuNavigation parent) {
this.parent = parent;
}
public Menuitem getItem() {
return item;
}
public void setItem(Menuitem item) {
this.item = item;
}
public String getFooter() {
return footer;
}
public void setFooter(String footer) {
this.footer = footer;
}
public String getHeader() {
return header;
}
public void setHeader(String header) {
this.header = header;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public boolean isVisible() {
return visible;
}
public void setVisible(boolean visible) {
this.visible = visible;
}
@Override
public int compareTo(MenuNavigation o) {
return sort.compareTo(o.sort);
}
@Transient
private transient Integer pagesort = 0;
// used only for initialization function...
public MenuNavigation addPage(Menuitem item, IAppPermission permission) {
int childSort = 100;
if (children == null || children.size() == 0) {
children = new ArrayList<MenuNavigation>();
} else {
childSort = children.get(children.size() - 1).getSort() + 10;
}
MenuNavigation add = new MenuNavigation();
add.setSort(pagesort += 10);
if (item != null)
{
add.setKey("submenu" + item.getUrl().replace("/", "."));
}
add.setItem(item);
add.setEvent(event);
add.setPermission(permission);
add.setParent(this);
add.setVisible(true);
add.setSort(childSort);
children.add(add);
return add;
}
public SitePage getSitepage() {
return sitepage;
}
public void setSitepage(SitePage sitepage) {
this.sitepage = sitepage;
}
public LanEvent getEvent() {
return event;
}
public void setEvent(LanEvent event) {
this.event = event;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
}
package fi.insomnia.bortal.model;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned;
@Entity
@Table(name = "menuitem")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class Menuitem extends GenericEntity {
private static final long serialVersionUID = -3544095800802935237L;
@Column(nullable = false, unique = true)
private String url;
@Lob
private String description;
@OneToMany(mappedBy = "item", cascade = CascadeType.ALL)
@PrivateOwned
private List<MenuNavigation> navigations;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<MenuNavigation> getNavigations() {
return navigations;
}
public void setNavigations(List<MenuNavigation> navigations) {
this.navigations = navigations;
}
}
package fi.insomnia.bortal.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
/**
*
* @author jkj
*/
@Entity
@Table(name = "news")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class News extends GenericEntity {
private static final long serialVersionUID = 498925968565236275L;
@Column(name = "title")
private String title;
@Lob
@Column(name = "body")
private String body;
@Lob
@Column(name = "abstract")
private String bodyAbstract;
@Column(name = "publish")
@Temporal(TemporalType.TIMESTAMP)
private Date publish = new Date();
@Column(name = "expire")
@Temporal(TemporalType.TIMESTAMP)
private Date expire;
@ManyToOne()
@JoinColumn(nullable = false)
private EventUser creator;
public Date getPublish() {
return publish;
}
public void setPublish(Date publish) {
this.publish = publish;
}
public Date getExpire() {
return expire;
}
public void setExpire(Date expire) {
this.expire = expire;
}
@Column(name = "priority", nullable = false)
private int priority = 10;
@ManyToOne(optional = false)
@JoinColumn(nullable = false, name = "group_id")
private NewsGroup group;
public News() {
super();
}
public News(NewsGroup group, String title, int priority) {
super();
this.group = group;
this.title = title;
this.priority = priority;
}
public News(NewsGroup newsgroup, EventUser creator) {
super();
this.creator = creator;
group = newsgroup;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public String getBodyAbstract() {
return bodyAbstract;
}
public void setBodyAbstract(String abstract1) {
this.bodyAbstract = abstract1;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public NewsGroup getGroup() {
return group;
}
public void setGroup(NewsGroup newsGroupsId) {
this.group = newsGroupsId;
}
public EventUser getCreator() {
return creator;
}
public void setCreator(EventUser creator) {
this.creator = creator;
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.model;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned;
/**
*
* @author jkj
*/
@Entity
@Table(name = "news_groups", uniqueConstraints = @UniqueConstraint(columnNames = { NewsGroup.EVENT_ID_COLUMN, NewsGroup.GROUP_NAME }))
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class NewsGroup extends GenericEntity {
protected static final String GROUP_NAME = "group_name";
/**
*
*/
private static final long serialVersionUID = 4014463478275469802L;
public static final String EVENT_ID_COLUMN = "event_id";
@ManyToOne()
@JoinColumn(name = EVENT_ID_COLUMN, nullable = false)
private LanEvent event;
@Column(name = GROUP_NAME, nullable = false)
private String name;
@Lob
@Column(name = "group_description")
private String description;
@Column(name = "priority", nullable = false)
private int priority;
@ManyToOne()
@JoinColumn(name = "writer_role_id", referencedColumnName = Role.ID_COLUMN)
private Role writerRole;
@OrderBy("priority")
@OneToMany(cascade = CascadeType.ALL, mappedBy = "group")
@PrivateOwned
private List<News> news;
@ManyToMany()
private List<Role> readerRoles;
public NewsGroup() {
super();
}
public NewsGroup(LanEvent event) {
super();
this.setEvent(event);
}
public String getName() {
return name;
}
public void setName(String groupName) {
this.name = groupName;
}
public String getDescription() {
return description;
}
public void setDescription(String groupDescription) {
this.description = groupDescription;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public List<News> getNews() {
return news;
}
public void setNews(List<News> newsList) {
this.news = newsList;
}
public void setWriterRole(Role writerRole) {
this.writerRole = writerRole;
}
public Role getWriterRole() {
return writerRole;
}
public void setReaderRoles(List<Role> readerRoles) {
this.readerRoles = readerRoles;
}
public List<Role> getReaderRoles() {
return readerRoles;
}
public LanEvent getEvent() {
return event;
}
public void setEvent(LanEvent event) {
this.event = event;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!