Commit 4f95edcd by Tuomas Riihimäki

Changed layout, added shopping for bill, and propably something else...

1 parent 07f6ac62
Showing with 1221 additions and 377 deletions
...@@ -9,6 +9,8 @@ package fi.insomnia.bortal.beans { ...@@ -9,6 +9,8 @@ package fi.insomnia.bortal.beans {
import fi.insomnia.bortal.beanutil.AuthorisationBeanLocal; import fi.insomnia.bortal.beanutil.AuthorisationBeanLocal;
import fi.insomnia.bortal.facade.BillFacade; import fi.insomnia.bortal.facade.BillFacade;
import fi.insomnia.bortal.facade.BillLineFacade;
import fi.insomnia.bortal.facade.EventFacade;
import flash.utils.IDataInput; import flash.utils.IDataInput;
import flash.utils.IDataOutput; import flash.utils.IDataOutput;
import flash.utils.IExternalizable; import flash.utils.IExternalizable;
...@@ -18,14 +20,18 @@ package fi.insomnia.bortal.beans { ...@@ -18,14 +20,18 @@ package fi.insomnia.bortal.beans {
private var _authbean:AuthorisationBeanLocal; private var _authbean:AuthorisationBeanLocal;
private var _billFacade:BillFacade; private var _billFacade:BillFacade;
private var _billLineFacade:BillLineFacade;
private var _eventbean:EventBeanLocal; private var _eventbean:EventBeanLocal;
private var _eventfacade:EventFacade;
private var _secubean:SecurityBeanLocal; private var _secubean:SecurityBeanLocal;
private var _userBean:UserBeanLocal; private var _userBean:UserBeanLocal;
public function readExternal(input:IDataInput):void { public function readExternal(input:IDataInput):void {
_authbean = input.readObject() as AuthorisationBeanLocal; _authbean = input.readObject() as AuthorisationBeanLocal;
_billFacade = input.readObject() as BillFacade; _billFacade = input.readObject() as BillFacade;
_billLineFacade = input.readObject() as BillLineFacade;
_eventbean = input.readObject() as EventBeanLocal; _eventbean = input.readObject() as EventBeanLocal;
_eventfacade = input.readObject() as EventFacade;
_secubean = input.readObject() as SecurityBeanLocal; _secubean = input.readObject() as SecurityBeanLocal;
_userBean = input.readObject() as UserBeanLocal; _userBean = input.readObject() as UserBeanLocal;
} }
...@@ -33,7 +39,9 @@ package fi.insomnia.bortal.beans { ...@@ -33,7 +39,9 @@ package fi.insomnia.bortal.beans {
public function writeExternal(output:IDataOutput):void { public function writeExternal(output:IDataOutput):void {
output.writeObject(_authbean); output.writeObject(_authbean);
output.writeObject(_billFacade); output.writeObject(_billFacade);
output.writeObject(_billLineFacade);
output.writeObject(_eventbean); output.writeObject(_eventbean);
output.writeObject(_eventfacade);
output.writeObject(_secubean); output.writeObject(_secubean);
output.writeObject(_userBean); output.writeObject(_userBean);
} }
......
...@@ -15,13 +15,16 @@ package fi.insomnia.bortal.beans { ...@@ -15,13 +15,16 @@ package fi.insomnia.bortal.beans {
[Bindable] [Bindable]
public class ProductBeanBase implements IExternalizable { public class ProductBeanBase implements IExternalizable {
protected var _productFacade:ProductFacade; private var _eventBean:EventBeanLocal;
private var _productFacade:ProductFacade;
public function readExternal(input:IDataInput):void { public function readExternal(input:IDataInput):void {
_eventBean = input.readObject() as EventBeanLocal;
_productFacade = input.readObject() as ProductFacade; _productFacade = input.readObject() as ProductFacade;
} }
public function writeExternal(output:IDataOutput):void { public function writeExternal(output:IDataOutput):void {
output.writeObject(_eventBean);
output.writeObject(_productFacade); output.writeObject(_productFacade);
} }
} }
......
...@@ -10,20 +10,24 @@ package fi.insomnia.bortal.facade { ...@@ -10,20 +10,24 @@ package fi.insomnia.bortal.facade {
import flash.utils.IDataInput; import flash.utils.IDataInput;
import flash.utils.IDataOutput; import flash.utils.IDataOutput;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
[Bindable] [Bindable]
public class EventFacadeBase extends GenericFacade { public class EventFacadeBase extends GenericFacade {
private var _em:EntityManager; private var _em:EntityManager;
private var _emf:EntityManagerFactory;
override public function readExternal(input:IDataInput):void { override public function readExternal(input:IDataInput):void {
super.readExternal(input); super.readExternal(input);
_em = input.readObject() as EntityManager; _em = input.readObject() as EntityManager;
_emf = input.readObject() as EntityManagerFactory;
} }
override public function writeExternal(output:IDataOutput):void { override public function writeExternal(output:IDataOutput):void {
super.writeExternal(output); super.writeExternal(output);
output.writeObject(_em); output.writeObject(_em);
output.writeObject(_emf);
} }
} }
} }
\ No newline at end of file
package fi.insomnia.bortal.beans; package fi.insomnia.bortal.beans;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.math.BigDecimal;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.ejb.Stateless; import javax.ejb.Stateless;
...@@ -9,9 +10,16 @@ import fi.insomnia.bortal.beanutil.AuthorisationBeanLocal; ...@@ -9,9 +10,16 @@ import fi.insomnia.bortal.beanutil.AuthorisationBeanLocal;
import fi.insomnia.bortal.beanutil.AuthorisationBeanLocal.Right; import fi.insomnia.bortal.beanutil.AuthorisationBeanLocal.Right;
import fi.insomnia.bortal.beanutil.AuthorisationBeanLocal.RightType; import fi.insomnia.bortal.beanutil.AuthorisationBeanLocal.RightType;
import fi.insomnia.bortal.beanutil.PdfPrinter; import fi.insomnia.bortal.beanutil.PdfPrinter;
import fi.insomnia.bortal.enums.Permission;
import fi.insomnia.bortal.enums.RolePermission;
import fi.insomnia.bortal.exceptions.EjbPermissionDeniedException;
import fi.insomnia.bortal.facade.BillFacade; import fi.insomnia.bortal.facade.BillFacade;
import fi.insomnia.bortal.facade.BillLineFacade;
import fi.insomnia.bortal.facade.EventFacade;
import fi.insomnia.bortal.model.Bill; import fi.insomnia.bortal.model.Bill;
import fi.insomnia.bortal.model.BillLine;
import fi.insomnia.bortal.model.LanEvent; import fi.insomnia.bortal.model.LanEvent;
import fi.insomnia.bortal.model.Product;
import fi.insomnia.bortal.model.User; import fi.insomnia.bortal.model.User;
/** /**
...@@ -33,6 +41,10 @@ public class BillBean implements BillBeanLocal { ...@@ -33,6 +41,10 @@ public class BillBean implements BillBeanLocal {
private AuthorisationBeanLocal authbean; private AuthorisationBeanLocal authbean;
@EJB @EJB
private EventBeanLocal eventbean; private EventBeanLocal eventbean;
@EJB
private EventFacade eventfacade;
@EJB
private BillLineFacade billLineFacade;
/** /**
* Default constructor. * Default constructor.
...@@ -67,7 +79,53 @@ public class BillBean implements BillBeanLocal { ...@@ -67,7 +79,53 @@ public class BillBean implements BillBeanLocal {
if (bill == null) { if (bill == null) {
return null; return null;
} }
if (bill.getBillNumber() == null || bill.getBillNumber() <= 0) {
generateBillNumber(bill);
}
return new PdfPrinter(bill).output(); return new PdfPrinter(bill).output();
} }
private void generateBillNumber(Bill bill) {
if (bill.getBillNumber() == null || bill.getBillNumber() == 0) {
LanEvent currEvent = eventbean.getCurrentEvent();
Integer billnr = billFacade.getBiggestBillNumber(currEvent);
if (billnr == null || billnr < currEvent.getNextBillNumber()) {
billnr = currEvent.getNextBillNumber();
} else {
++billnr;
}
bill.setBillNumber(billnr);
billFacade.merge(bill);
}
}
@Override
public Bill createEmptyBill(User shoppingUser) throws EjbPermissionDeniedException {
if (shoppingUser != null && userBean.hasCurrentUserPermission(Permission.USER_MANAGEMENT, RolePermission.EXECUTE)) {
String msg = new StringBuilder("User tried to shop to ").append(shoppingUser.getId()).append(" another without sufficient rights").toString();
throw new EjbPermissionDeniedException(secubean, userBean.getCurrentUser(), msg);
}
if (shoppingUser == null) {
shoppingUser = userBean.getCurrentUser();
}
LanEvent event = eventbean.getCurrentEvent();
Bill ret = new Bill(event, shoppingUser);
billFacade.create(ret);
return ret;
}
@Override
public BillLine addProductToBill(Bill bill, Product product, BigDecimal count) {
// TODO: Lähetettyä laskua ei saa kaikki muokata!
// TODO: Jos ei olla tekemässä omaa laskua tarkistetaan onko riittävät
// oikeudet.
BillLine line = new BillLine(bill, product.getName(), product.getUnitName(), count, product.getPrice(), product.getVat());
billLineFacade.create(line);
return line;
}
} }
package fi.insomnia.bortal.beans; package fi.insomnia.bortal.beans;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import javax.ejb.EJB; import javax.ejb.EJB;
...@@ -15,7 +16,10 @@ import fi.insomnia.bortal.model.Product; ...@@ -15,7 +16,10 @@ import fi.insomnia.bortal.model.Product;
public class ProductBean implements ProductBeanLocal { public class ProductBean implements ProductBeanLocal {
@EJB @EJB
ProductFacade productFacade; private ProductFacade productFacade;
@EJB
private EventBeanLocal eventBean;
/** /**
* Default constructor. * Default constructor.
...@@ -30,4 +34,21 @@ public class ProductBean implements ProductBeanLocal { ...@@ -30,4 +34,21 @@ public class ProductBean implements ProductBeanLocal {
return productFacade.findAll(); return productFacade.findAll();
} }
@Override
public Product createProduct(String name, BigDecimal price) {
Product entity = new Product(eventBean.getCurrentEvent(), name, price);
productFacade.create(entity);
return entity;
}
@Override
public List<Product> getProducts() {
return productFacade.findAll();
}
@Override
public void mergeChanges(Product product) {
productFacade.merge(product);
}
} }
...@@ -167,7 +167,6 @@ public class TestDataBean implements TestDataBeanLocal { ...@@ -167,7 +167,6 @@ public class TestDataBean implements TestDataBeanLocal {
b.setDeliveryTerms("Toimitetaan, ehkä..."); b.setDeliveryTerms("Toimitetaan, ehkä...");
Calendar duedate = Calendar.getInstance(); Calendar duedate = Calendar.getInstance();
duedate.add(Calendar.DATE, 14); duedate.add(Calendar.DATE, 14);
b.setDueDate(duedate);
b.setNotes("Some notes..."); b.setNotes("Some notes...");
b.setNoticetime("14 vrk"); b.setNoticetime("14 vrk");
b.setOurReference("Meitin viite ( Insomnia XII )"); b.setOurReference("Meitin viite ( Insomnia XII )");
......
...@@ -99,8 +99,6 @@ public class UserBean implements UserBeanLocal { ...@@ -99,8 +99,6 @@ public class UserBean implements UserBeanLocal {
return (context.getCallerPrincipal() == null || user == null) ? false : context.getCallerPrincipal().getName().equals(user.getNick()); return (context.getCallerPrincipal() == null || user == null) ? false : context.getCallerPrincipal().getName().equals(user.getNick());
} }
@Override @Override
public User getCurrentUser() { public User getCurrentUser() {
Principal principal = context.getCallerPrincipal(); Principal principal = context.getCallerPrincipal();
...@@ -134,10 +132,6 @@ public class UserBean implements UserBeanLocal { ...@@ -134,10 +132,6 @@ public class UserBean implements UserBeanLocal {
} }
// TODO: FIX THIS!! really bad idea.... // TODO: FIX THIS!! really bad idea....
if (user.isSuperadmin()) {
logger.debug("Returning true for superadmin for {} perm {}", target.name(), permission);
return true;
}
AccessRight expectedRight = accessRightBeanLocal.findOrCreate(target); AccessRight expectedRight = accessRightBeanLocal.findOrCreate(target);
...@@ -150,6 +144,10 @@ public class UserBean implements UserBeanLocal { ...@@ -150,6 +144,10 @@ public class UserBean implements UserBeanLocal {
} }
} }
} }
if (user.isSuperadmin()) {
logger.debug("Returning true for superadmin for {} perm {}", target.name(), permission);
return true;
}
return false; return false;
} }
...@@ -191,4 +189,9 @@ public class UserBean implements UserBeanLocal { ...@@ -191,4 +189,9 @@ public class UserBean implements UserBeanLocal {
} }
@Override
public boolean hasCurrentUserPermission(Permission permission, RolePermission rolePermission) {
return this.hasPermission(permission, getCurrentUser(), rolePermission);
}
} }
...@@ -356,9 +356,9 @@ public class PdfPrinter { ...@@ -356,9 +356,9 @@ public class PdfPrinter {
drawText(70, 156, bill.getAddr3(), addrfont); drawText(70, 156, bill.getAddr3(), addrfont);
drawText(70, 144, bill.getAddr4(), addrfont); drawText(70, 144, bill.getAddr4(), addrfont);
drawText(70, 132, bill.getAddr5(), addrfont); drawText(70, 132, bill.getAddr5(), addrfont);
drawText(355, 110, "Laskun ID", addrfont); drawText(355, 110, BillUtils.createReferenceNumber(bill.getReferenceNumberBase()).toString(), addrfont);
drawText(465, 86, decRound(bill.totalPrice()), addrfont); drawText(465, 86, decRound(bill.totalPrice()), addrfont);
drawText(355, 86, "Erapaiva", addrfont); drawText(355, 86, DATE_FORMAT.format(bill.getDueDate().getTime()), addrfont);
} }
......
...@@ -4,7 +4,10 @@ import javax.ejb.LocalBean; ...@@ -4,7 +4,10 @@ import javax.ejb.LocalBean;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import fi.insomnia.bortal.model.Bill; import fi.insomnia.bortal.model.Bill;
import fi.insomnia.bortal.model.LanEvent;
@Stateless @Stateless
@LocalBean @LocalBean
...@@ -21,4 +24,10 @@ public class BillFacade extends EventChildGenericFacade<Bill> { ...@@ -21,4 +24,10 @@ public class BillFacade extends EventChildGenericFacade<Bill> {
return em; return em;
} }
public int getBiggestBillNumber(LanEvent e) {
TypedQuery<Integer> q = getEm().createNamedQuery("Bill.findbiggestBillNumber", Integer.class);
q.setParameter("event", e);
return q.getSingleResult();
}
} }
...@@ -3,7 +3,10 @@ package fi.insomnia.bortal.facade; ...@@ -3,7 +3,10 @@ package fi.insomnia.bortal.facade;
import javax.ejb.LocalBean; import javax.ejb.LocalBean;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.LockModeType;
import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceUnit;
import javax.persistence.TypedQuery; import javax.persistence.TypedQuery;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -19,6 +22,9 @@ public class EventFacade extends GenericFacade<Integer, LanEvent> { ...@@ -19,6 +22,9 @@ public class EventFacade extends GenericFacade<Integer, LanEvent> {
@PersistenceContext @PersistenceContext
private EntityManager em; private EntityManager em;
@PersistenceUnit
private EntityManagerFactory emf;
public EventFacade() { public EventFacade() {
super(LanEvent.class); super(LanEvent.class);
} }
...@@ -40,4 +46,6 @@ public class EventFacade extends GenericFacade<Integer, LanEvent> { ...@@ -40,4 +46,6 @@ public class EventFacade extends GenericFacade<Integer, LanEvent> {
q.setParameter("name", name); q.setParameter("name", name);
return this.getSingleNullableResult(q); return this.getSingleNullableResult(q);
} }
} }
package fi.insomnia.bortal.beans; package fi.insomnia.bortal.beans;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.math.BigDecimal;
import javax.ejb.Local; import javax.ejb.Local;
import fi.insomnia.bortal.exceptions.EjbPermissionDeniedException;
import fi.insomnia.bortal.model.Bill; import fi.insomnia.bortal.model.Bill;
import fi.insomnia.bortal.model.BillLine;
import fi.insomnia.bortal.model.Product;
import fi.insomnia.bortal.model.User;
@Local @Local
public interface BillBeanLocal { public interface BillBeanLocal {
...@@ -12,6 +17,10 @@ public interface BillBeanLocal { ...@@ -12,6 +17,10 @@ public interface BillBeanLocal {
ByteArrayOutputStream getPdfBillStream(Bill bill); ByteArrayOutputStream getPdfBillStream(Bill bill);
Bill createEmptyBill(User shoppingUser) throws EjbPermissionDeniedException;
BillLine addProductToBill(Bill bill, Product product, BigDecimal count);
......
package fi.insomnia.bortal.beans; package fi.insomnia.bortal.beans;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import javax.ejb.Local; import javax.ejb.Local;
...@@ -10,4 +12,10 @@ public interface ProductBeanLocal { ...@@ -10,4 +12,10 @@ public interface ProductBeanLocal {
List<Product> listUserShoppableProducts(); List<Product> listUserShoppableProducts();
Product createProduct(String name, BigDecimal price);
List<Product> getProducts();
void mergeChanges(Product product);
} }
...@@ -29,6 +29,8 @@ public interface UserBeanLocal { ...@@ -29,6 +29,8 @@ public interface UserBeanLocal {
boolean isCurrentUser(User thisuser); boolean isCurrentUser(User thisuser);
boolean hasCurrentUserPermission(Permission userManagement, RolePermission execute);
......
...@@ -12,9 +12,12 @@ public enum Permission { ...@@ -12,9 +12,12 @@ public enum Permission {
PERMISSION("Description"), PERMISSION("Description"),
LOGIN("User can see loginbutton. (only defaultuser should have permission to that one)"), LOGIN("User can see loginbutton. (only defaultuser should have permission to that one)"),
USER_MANAGEMENT("User has right to view all users(r), modify users(w) "), USER_MANAGEMENT("User has right to view all users(r), modify users(w), execute actions for user(x), Eg shop! "),
TICKET_SALES("User has right to view, and/or buy tickets"), TICKET_SALES("User has right to view, and/or buy tickets"),
ROLE_MANAGEMENT("User has right to view(r), modify(w) and assign(x) roles"); ROLE_MANAGEMENT("User has right to view(r), modify(w) and assign(x) roles"),
PRODUCT("View(r), modify(w), and shop(x) products"),
;
private String description; private String description;
public static Permission getPermission(String name) { public static Permission getPermission(String name) {
......
...@@ -3,12 +3,14 @@ package fi.insomnia.bortal.exceptions; ...@@ -3,12 +3,14 @@ package fi.insomnia.bortal.exceptions;
import fi.insomnia.bortal.beans.SecurityBeanLocal; import fi.insomnia.bortal.beans.SecurityBeanLocal;
import fi.insomnia.bortal.model.User; import fi.insomnia.bortal.model.User;
public class EjbPermissionDeniedException extends Exception{ public class EjbPermissionDeniedException extends Exception {
public EjbPermissionDeniedException(SecurityBeanLocal bean, User user, String message) { public EjbPermissionDeniedException(SecurityBeanLocal bean, User user, String message) {
super(message); super(message);
bean.logPermissionDenied(user, this); bean.logPermissionDenied(user, this);
} }
/** /**
* *
*/ */
......
...@@ -23,6 +23,7 @@ import javax.persistence.Table; ...@@ -23,6 +23,7 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.Version; import javax.persistence.Version;
import javax.persistence.UniqueConstraint;
import static javax.persistence.TemporalType.DATE; import static javax.persistence.TemporalType.DATE;
/** /**
...@@ -31,13 +32,15 @@ import static javax.persistence.TemporalType.DATE; ...@@ -31,13 +32,15 @@ import static javax.persistence.TemporalType.DATE;
* not null. * not null.
*/ */
@Entity @Entity
@Table(name = "bills") @Table(name = "bills", uniqueConstraints = { @UniqueConstraint(columnNames = { "event_id", "bill_number" }) })
@NamedQueries({ @NamedQueries({
@NamedQuery(name = "Bill.findAll", query = "SELECT b FROM Bill b"), @NamedQuery(name = "Bill.findAll", query = "SELECT b FROM Bill b"),
@NamedQuery(name = "Bill.findByDueDate", query = "SELECT b FROM Bill b WHERE b.dueDate = :dueDate"), // @NamedQuery(name = "Bill.findByDueDate", query =
// "SELECT b FROM Bill b WHERE b.dueDate = :dueDate"),
@NamedQuery(name = "Bill.findByPaidDate", query = "SELECT b FROM Bill b WHERE b.paidDate = :paidDate"), @NamedQuery(name = "Bill.findByPaidDate", query = "SELECT b FROM Bill b WHERE b.paidDate = :paidDate"),
@NamedQuery(name = "Bill.findByNotes", query = "SELECT b FROM Bill b WHERE b.notes = :notes") }) @NamedQuery(name = "Bill.findByNotes", query = "SELECT b FROM Bill b WHERE b.notes = :notes"),
@NamedQuery(name = "Bill.findbiggestBillNumber", query = "SELECT max(b.billNumber) from Bill b where b.event = :event") })
public class Bill implements EventChildInterface { public class Bill implements EventChildInterface {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -48,9 +51,10 @@ public class Bill implements EventChildInterface { ...@@ -48,9 +51,10 @@ public class Bill implements EventChildInterface {
/** /**
* When the bill is due to be paid. * When the bill is due to be paid.
*/ */
@Column(name = "due_date") // Can be calculated from SentDate + paymentTime
@Temporal(TemporalType.TIMESTAMP) // @Column(name = "due_date")
private Calendar dueDate; // @Temporal(TemporalType.TIMESTAMP)
// private Calendar dueDate;
/** /**
* When the money has appeared on the bank account. * When the money has appeared on the bank account.
...@@ -189,14 +193,22 @@ public class Bill implements EventChildInterface { ...@@ -189,14 +193,22 @@ public class Bill implements EventChildInterface {
public Bill(LanEvent event) { public Bill(LanEvent event) {
this.id = new EventPk(event); this.id = new EventPk(event);
} }
public Calendar getDueDate() { public Bill(LanEvent event, User user) {
return dueDate; this.id = new EventPk(event);
this.setUser(user);
this.setAddr1(user.getFirstnames() + user.getLastname());
this.setAddr2(user.getAddress());
this.setAddr3(user.getZip() + user.getPostalTown());
} }
public void setDueDate(Calendar dueDate) { public Calendar getDueDate() {
this.dueDate = dueDate;
Calendar dueDate = (Calendar) this.getSentDate().clone();
dueDate.add(Calendar.DATE, this.getPaymentTime());
return dueDate;
} }
public Calendar getPaidDate() { public Calendar getPaidDate() {
......
...@@ -30,7 +30,7 @@ import javax.persistence.Version; ...@@ -30,7 +30,7 @@ import javax.persistence.Version;
*/ */
@Entity @Entity
@Table(name = "events") @Table(name = "events")
@NamedQueries( { @NamedQueries({
@NamedQuery(name = "LanEvent.findAll", query = "SELECT e FROM LanEvent e"), @NamedQuery(name = "LanEvent.findAll", query = "SELECT e FROM LanEvent e"),
@NamedQuery(name = "LanEvent.findByStartTime", query = "SELECT e FROM LanEvent e WHERE e.startTime = :startTime"), @NamedQuery(name = "LanEvent.findByStartTime", query = "SELECT e FROM LanEvent e WHERE e.startTime = :startTime"),
@NamedQuery(name = "LanEvent.findByEndTime", query = "SELECT e FROM LanEvent e WHERE e.endTime = :endTime"), @NamedQuery(name = "LanEvent.findByEndTime", query = "SELECT e FROM LanEvent e WHERE e.endTime = :endTime"),
...@@ -52,8 +52,6 @@ public class LanEvent implements ModelInterface { ...@@ -52,8 +52,6 @@ public class LanEvent implements ModelInterface {
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Calendar startTime; private Calendar startTime;
@Column(name = "end_time") @Column(name = "end_time")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Calendar endTime; private Calendar endTime;
...@@ -65,13 +63,13 @@ public class LanEvent implements ModelInterface { ...@@ -65,13 +63,13 @@ public class LanEvent implements ModelInterface {
private String referer; private String referer;
/** /**
* Bill's reference number will be formed by adding * Bill's reference number will be formed by adding this number to the bill
* this number to the bill number and adding the * number and adding the checksum of that number as the last digit
* checksum of that number as the last digit
*/ */
private Integer referenceNumberBase = 54321; private Integer referenceNumberBase = 54321;
@Column(nullable = false)
private int nextBillNumber = 1;
@JoinColumn(name = "event_organiser_id", referencedColumnName = "event_organiser_id", nullable = false, updatable = false) @JoinColumn(name = "event_organiser_id", referencedColumnName = "event_organiser_id", nullable = false, updatable = false)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private EventOrganiser organiser; private EventOrganiser organiser;
...@@ -80,11 +78,10 @@ public class LanEvent implements ModelInterface { ...@@ -80,11 +78,10 @@ public class LanEvent implements ModelInterface {
@ManyToOne(optional = false) @ManyToOne(optional = false)
private EventStatus status; private EventStatus status;
@OneToMany(mappedBy = "parentEvent")
@OneToMany(mappedBy="parentEvent")
private List<LogEntry> logEntries; private List<LogEntry> logEntries;
@JoinColumns( { @JoinColumns({
@JoinColumn(name = "default_role_id", referencedColumnName = "id"), @JoinColumn(name = "default_role_id", referencedColumnName = "id"),
@JoinColumn(name = "event_id", referencedColumnName = "event_id", nullable = false, updatable = false, insertable = false) }) @JoinColumn(name = "event_id", referencedColumnName = "event_id", nullable = false, updatable = false, insertable = false) })
@OneToOne @OneToOne
...@@ -115,7 +112,6 @@ public class LanEvent implements ModelInterface { ...@@ -115,7 +112,6 @@ public class LanEvent implements ModelInterface {
public LanEvent() { public LanEvent() {
} }
public Calendar getStartTime() { public Calendar getStartTime() {
return startTime; return startTime;
} }
...@@ -295,26 +291,27 @@ public class LanEvent implements ModelInterface { ...@@ -295,26 +291,27 @@ public class LanEvent implements ModelInterface {
return organiser; return organiser;
} }
public void setReferenceNumberBase(Integer referenceNumberBase) { public void setReferenceNumberBase(Integer referenceNumberBase) {
this.referenceNumberBase = referenceNumberBase; this.referenceNumberBase = referenceNumberBase;
} }
public Integer getReferenceNumberBase() { public Integer getReferenceNumberBase() {
return referenceNumberBase; return referenceNumberBase;
} }
public void setLogEntries(List<LogEntry> logEntries) { public void setLogEntries(List<LogEntry> logEntries) {
this.logEntries = logEntries; this.logEntries = logEntries;
} }
public List<LogEntry> getLogEntries() { public List<LogEntry> getLogEntries() {
return logEntries; return logEntries;
} }
public void setNextBillNumber(int nextBillNumber) {
this.nextBillNumber = nextBillNumber;
}
public int getNextBillNumber() {
return nextBillNumber;
}
} }
...@@ -64,12 +64,16 @@ public class Product implements EventChildInterface { ...@@ -64,12 +64,16 @@ public class Product implements EventChildInterface {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "product") @OneToMany(cascade = CascadeType.ALL, mappedBy = "product")
private List<Discount> discounts; private List<Discount> discounts;
private BigDecimal vat = BigDecimal.ZERO;
private String unitName = "";
@ManyToMany() @ManyToMany()
@JoinTable(name = "product_foodwavetemplate", joinColumns = { @JoinTable(name = "product_foodwavetemplate", joinColumns = {
@JoinColumn(name = "product_id", referencedColumnName = "id"), @JoinColumn(name = "product_id", referencedColumnName = "id"),
@JoinColumn(name = "event_id", referencedColumnName = "event_id") }, inverseJoinColumns = { @JoinColumn(name = "event_id", referencedColumnName = "event_id") }, inverseJoinColumns = {
@JoinColumn(name = "food_wave_template_id", referencedColumnName = "id"), @JoinColumn(name = "food_wave_template_id", referencedColumnName = "id"),
@JoinColumn(name = "event_id", referencedColumnName = "event_id") }, uniqueConstraints = { @UniqueConstraint(columnNames = { "product_id", "food_wave_template_id", "event_id" }) }) @JoinColumn(name = "event_id", referencedColumnName = "event_id") },
uniqueConstraints = { @UniqueConstraint(columnNames = { "product_id", "food_wave_template_id", "event_id" }) })
private List<FoodWaveTemplate> foodWaveTemplates; private List<FoodWaveTemplate> foodWaveTemplates;
@Version @Version
...@@ -83,10 +87,11 @@ public class Product implements EventChildInterface { ...@@ -83,10 +87,11 @@ public class Product implements EventChildInterface {
this.id = new EventPk(event); this.id = new EventPk(event);
} }
public Product(LanEvent event, BigDecimal price, int sort) { public Product(LanEvent event, String name, BigDecimal price) {
this(event); this(event);
this.price = price; this.price = price;
this.sort = sort; this.name = name;
} }
public String getName() { public String getName() {
...@@ -227,5 +232,21 @@ public class Product implements EventChildInterface { ...@@ -227,5 +232,21 @@ public class Product implements EventChildInterface {
public void setPrepaid(boolean prepaid) { public void setPrepaid(boolean prepaid) {
this.prepaid = prepaid; this.prepaid = prepaid;
} }
public void setVat(BigDecimal vat) {
this.vat = vat;
}
public BigDecimal getVat() {
return vat;
}
public void setUnitName(String unitName) {
this.unitName = unitName;
}
public String getUnitName() {
return unitName;
}
} }
<?xml version="1.0"?> <?xml version="1.0"?>
<faces-config <faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0" version="2.0">
> <application>
<application> <resource-bundle>
<resource-bundle> <base-name>resources.i18n</base-name>
<base-name>resources.i18n</base-name> <var>i18n</var>
<var>i18n</var> </resource-bundle>
</resource-bundle> <message-bundle>resources.i18n</message-bundle>
<message-bundle>resources.i18n</message-bundle> <!-- Legal Country codes: http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm -->
<!-- Legal Country codes: http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm --> <!-- Assigned Country codes: -->
<!-- Assigned Country codes: --> <!-- Insomnia: IN (INDIA) -->
<!-- Insomnia: IN (INDIA) --> <!-- Stream: ST (SAO TOME AND PRINCIPE ) -->
<!-- Stream: ST (SAO TOME AND PRINCIPE ) --> <!-- Vector VE (VENEZUELA, BOLIVARIAN REPUBLIC OF) -->
<!-- Vector VE (VENEZUELA, BOLIVARIAN REPUBLIC OF) --> <locale-config>
<locale-config> <default-locale>fi_FI</default-locale>
<default-locale>fi_FI</default-locale> <supported-locale>fi_IN_XII</supported-locale>
<supported-locale>fi_IN_XII</supported-locale> <supported-locale>en_ST_v7</supported-locale>
<supported-locale>en_ST_v7</supported-locale>
</locale-config>
</application>
<navigation-rule>
<from-view-id>/role/create.xhtml</from-view-id>
<navigation-case>
<from-outcome>roleCreated</from-outcome>
<to-view-id>/role/edit.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/user/list.xhtml</from-view-id>
<navigation-case>
<from-outcome>userEdit</from-outcome>
<to-view-id>/user/edit.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/user/edit.xhtml</from-view-id>
<navigation-case>
<from-outcome>userSave</from-outcome>
<to-view-id>/user/edit.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/role/list.xhtml</from-view-id>
<navigation-case>
<from-outcome>roleEdit</from-outcome>
<to-view-id>/role/edit.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule> </locale-config>
<from-view-id>*</from-view-id> </application>
<navigation-case>
<from-outcome>permissionDenied</from-outcome> <navigation-rule>
<to-view-id>/permissionDenied.xhtml</to-view-id> <from-view-id>/role/create.xhtml</from-view-id>
</navigation-case> <navigation-case>
<navigation-case> <from-outcome>roleCreated</from-outcome>
<from-outcome>viewExpired</from-outcome> <to-view-id>/role/edit.xhtml</to-view-id>
<to-view-id>/viewExpired.xhtml</to-view-id> </navigation-case>
</navigation-case> </navigation-rule>
<navigation-case> <navigation-rule>
<from-outcome>logout</from-outcome> <from-view-id>/user/list.xhtml</from-view-id>
<to-view-id>/auth/logout.xhtml</to-view-id> <navigation-case>
</navigation-case> <from-outcome>userEdit</from-outcome>
<navigation-case> <to-view-id>/user/edit.xhtml</to-view-id>
<from-outcome>loginSuccess</from-outcome> </navigation-case>
<to-view-id>/NotImplementedYet.xhtml</to-view-id> </navigation-rule>
</navigation-case> <navigation-rule>
<navigation-case> <from-view-id>/user/edit.xhtml</from-view-id>
<from-outcome>loginFailed</from-outcome> <navigation-case>
<to-view-id>/NotImplementedYet.xhtml</to-view-id> <from-outcome>userSave</from-outcome>
</navigation-case> <to-view-id>/user/edit.xhtml</to-view-id>
</navigation-rule> </navigation-case>
<navigation-rule> </navigation-rule>
<from-view-id>/role/edit.xhtml</from-view-id> <navigation-rule>
<navigation-case> <from-view-id>/role/list.xhtml</from-view-id>
<from-outcome>roleSaved</from-outcome> <navigation-case>
<to-view-id>/role/edit.xhtml</to-view-id> <from-outcome>roleEdit</from-outcome>
</navigation-case> <to-view-id>/role/edit.xhtml</to-view-id>
</navigation-rule> </navigation-case>
<factory> </navigation-rule>
<exception-handler-factory>fi.insomnia.bortal.exceptions.BortalExceptionHandlerFactory</exception-handler-factory>
</factory> <navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>frontpage</from-outcome>
<to-view-id>/news/frontpage.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>userprefs</from-outcome>
<to-view-id>/news/edit.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>shopfrontpage</from-outcome>
<to-view-id>/product/createBill.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>adminfront</from-outcome>
<to-view-id>/admin/frontpage.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>permissionDenied</from-outcome>
<to-view-id>/permissionDenied.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>viewExpired</from-outcome>
<to-view-id>/viewExpired.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>logout</from-outcome>
<to-view-id>/auth/logout.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>loginSuccess</from-outcome>
<to-view-id>/NotImplementedYet.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>loginFailed</from-outcome>
<to-view-id>/NotImplementedYet.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/role/edit.xhtml</from-view-id>
<navigation-case>
<from-outcome>roleSaved</from-outcome>
<to-view-id>/role/edit.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<factory>
<exception-handler-factory>fi.insomnia.bortal.exceptions.BortalExceptionHandlerFactory</exception-handler-factory>
</factory>
</faces-config> </faces-config>
......
...@@ -14,11 +14,15 @@ ...@@ -14,11 +14,15 @@
<role-name>USER_BASE</role-name> <role-name>USER_BASE</role-name>
<group-name>USER_BASE</group-name> <group-name>USER_BASE</group-name>
</security-role-mapping> </security-role-mapping>
<class-loader delegate="true" /> <class-loader delegate="true"/>
<jsp-config> <jsp-config>
<property name="keepgenerated" value="true"> <property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class java code.</description> <description>Keep a copy of the generated servlet class java code.</description>
</property> </property>
</jsp-config> </jsp-config>
<locale-charset-info default-locale="">
<locale-charset-map locale="" charset=""/>
<parameter-encoding default-charset="UTF-8"/>
</locale-charset-info>
</sun-web-app> </sun-web-app>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
MOI!
</body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <html
xmlns:h="http://java.sun.com/jsf/html" xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
xmlns:tools="http://java.sun.com/jsf/composite/tools" xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"> xmlns:tools="http://java.sun.com/jsf/composite/tools"
<f:view locale="#{userView.locale}">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><ui:insert name="title">Default title</ui:insert></title>
<!-- **** layout stylesheet **** -->
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/style/style.css" />
<!-- **** colour scheme stylesheet **** --> xmlns:layout="http://java.sun.com/jsf/composite/tools/layout"
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/style/green.css" /> xmlns:ui="http://java.sun.com/jsf/facelets">
</h:head>
<h:body>
<div id="main">
<div id="links">
<!-- **** INSERT LINKS HERE **** -->
<ui:insert name="somelinks">
<a href="http://www.insomnia.fi">www.insomnia.fi</a> <tools:loginLogout />
</ui:insert>
</div>
<div id="logo"><h1><ui:insert name="globaltitle">Lan Bortal</ui:insert></h1></div>
<div id="menu">
<ui:insert name="toplinks"><ui:include src="/layout/toplinks.xhtml" /></ui:insert>
</div>
<div id="content">
<div id="column1">
<div class="sidebaritem">
<div class="sbihead">
<h1>additional links</h1>
</div>
<div class="sbilinks">
<!-- **** INSERT ADDITIONAL LINKS HERE **** -->
<ui:insert name="sidelinks">
<ul>
<li><a href="http://www.openwebdesign.org">open web design</a></li>
<li><a href="http://www.w3schools.com/xhtml/default.asp">learn XHTML</a></li>
<li><a href="http://www.w3schools.com/css/default.asp">learn CSS</a></li>
<li><a href="http://www.mozilla.com/firefox">get firefox</a></li>
</ul>
</ui:insert>
</div>
</div>
<div class="sidebaritem">
<div class="sbihead">
<h1>latest news</h1>
</div>
<div class="sbicontent">
<!-- **** INSERT NEWS ITEMS HERE **** -->
<h2>01.09.2006</h2>
<p>This is where you can put your latest news.</p>
<p><a href="#">read more ...</a></p>
<p></p>
<p></p>
<h2>01.09.2006</h2>
<p>This is where you can put your latest news.</p>
<p><a href="#">read more ...</a></p>
</div>
</div>
<div class="sidebaritem">
<div class="sbihead">
<h1>other information</h1>
</div>
<div class="sbicontent">
<!-- **** INSERT OTHER INFORMATION HERE **** -->
<p>
This space can be used for additional information such as a contact phone number, address
or maybe even a graphic.
</p>
</div>
</div>
</div>
<div id="column2">
<h:messages globalOnly="true"/>
<h:body>
<ui:insert name="content"> <ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml" >
Default content.. <ui:define name="title"><ui:insert name="title" /></ui:define>
</ui:insert> <ui:define name="topmenu"><layout:toplinks selected="frontpage" /></ui:define>
</div> <ui:define name="content"><ui:insert name="content" /></ui:define>
</div> </ui:composition>
<div id="footer">
copyright &copy; Insomnia Ry, Stream Ry, Vector Ry | <a href="#">email@emailaddress</a> | <a href="http://validator.w3.org/check?uri=referer">XHTML 1.1</a> | <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> | <a href="http://www.dcarter.co.uk">design by dcarter</a>
</div>
</div>
</h:body> </h:body>
</f:view>
</html> </html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:ui="http://java.sun.com/jsf/facelets" >
<h:head>
</h:head>
<h:body>
<ui:component><div class="link#{ isSelected ?'a': ''}" ><ui:insert name="link" /></div></ui:component>
</h:body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view locale="#{sessionHandler.locale}">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Omnia <ui:insert name="title"></ui:insert></title>
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/style/insomnia1/style.css" />
</h:head>
<h:body>
<div id="wrapper">
<div id="navigation">
<img id="head" src="#{request.contextPath}/resources/style/insomnia1/img/header.gif" alt="" />
<div style="float: left" >
<div id="headerbox"><tools:loginLogout /></div>
<div><ui:insert name="topmenu" /></div>
</div>
</div>
<div id="content">
<div id="cwrap">
<h:messages globalOnly="true" />
<h:messages />
<ui:insert name="content" />
</div>
</div>
<div id="footer">#{i18n['copyright']}</div>
</div>
</h:body>
</f:view>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view locale="#{userView.locale}">
<h:head>
<meta
http-equiv="Content-Type"
content="text/html; charset=UTF-8" />
<title><ui:insert name="title">Default title</ui:insert></title>
<!-- **** layout stylesheet **** -->
<link
rel="stylesheet"
type="text/css"
href="#{request.contextPath}/resources/style/style.css" />
<!-- **** colour scheme stylesheet **** -->
<link
rel="stylesheet"
type="text/css"
href="#{request.contextPath}/resources/style/green.css" />
</h:head>
<h:body>
<div id="main">
<div id="links"><!-- **** INSERT LINKS HERE **** --> <ui:insert name="somelinks">
<a href="http://www.insomnia.fi">www.insomnia.fi</a>
<tools:loginLogout />
</ui:insert></div>
<div id="logo">
<h1><ui:insert name="globaltitle">Lan Bortal</ui:insert></h1>
</div>
<div id="menu"><ui:insert name="toplinks">
<ui:include src="/layout/toplinks.xhtml" />
</ui:insert></div>
<div id="content">
<div id="column1">
<div class="sidebaritem">
<div class="sbihead">
<h1>additional links</h1>
</div>
<div class="sbilinks"><!-- **** INSERT ADDITIONAL LINKS HERE **** --> <ui:insert name="sidelinks">
<ul>
<li><a href="http://www.openwebdesign.org">open web design</a></li>
<li><a href="http://www.w3schools.com/xhtml/default.asp">learn XHTML</a></li>
<li><a href="http://www.w3schools.com/css/default.asp">learn CSS</a></li>
<li><a href="http://www.mozilla.com/firefox">get firefox</a></li>
</ul>
</ui:insert></div>
</div>
<div class="sidebaritem">
<div class="sbihead">
<h1>latest news</h1>
</div>
<div class="sbicontent"><!-- **** INSERT NEWS ITEMS HERE **** -->
<h2>01.09.2006</h2>
<p>This is where you can put your latest news.</p>
<p><a href="#">read more ...</a></p>
<p></p>
<p></p>
<h2>01.09.2006</h2>
<p>This is where you can put your latest news.</p>
<p><a href="#">read more ...</a></p>
</div>
</div>
<div class="sidebaritem">
<div class="sbihead">
<h1>other information</h1>
</div>
<div class="sbicontent"><!-- **** INSERT OTHER INFORMATION HERE **** -->
<p>This space can be used for additional information such as a contact phone number, address or maybe even a graphic.</p>
</div>
</div>
</div>
<div id="column2"><h:messages globalOnly="true" />
<h:messages />
<ui:insert name="content">
Default content..
</ui:insert></div>
</div>
<div id="footer"><h:outputText value="#{i18n[copyright]}" /><a href="#">email@emailaddress</a> | <a href="http://validator.w3.org/check?uri=referer">XHTML 1.1</a> | <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> | <a href="http://www.dcarter.co.uk">design by dcarter</a></div>
</div>
</h:body>
</f:view>
</html>
\ No newline at end of file
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ul>
<!-- **** INSERT NAVIGATION ITEMS HERE (use id="selected" to identify the page you're on **** -->
<li><a id="selected" href="#">home</a></li>
<li><a href="#">page 1</a></li>
<li><a href="#">page 2</a></li>
<li><a href="#">page 3</a></li>
<li><a href="#">contact</a></li>
</ul>
</ui:composition>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:products="http://java.sun.com/jsf/composite/tools/products">
<h:body>
<ui:composition template="/layout/default-template.xhtml">
<ui:define name="title">CreateUser</ui:define>
<ui:define name="header">Add new user</ui:define>
<ui:define name="content">
<products:create />
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:products="http://java.sun.com/jsf/composite/tools/products"
xmlns:f="http://java.sun.com/jsf/core">
<h:body>
<ui:composition template="/layout/default-template.xhtml">
<ui:define name="title">Users</ui:define>
<ui:define name="header">Edit user</ui:define>
<ui:define name="content">
<h:outputScript target="head" library="script" name="jquery.min.js" />
<h:outputScript target="head" library="script" name="shopscript.js" />
<tools:canRead id ="authcont" target="PRODUCT">
<products:shop items="#{productShopView.billCart}" commitValue="#{i18n['productshop.commit']}" >
<f:actionListener for="commitbutton" binding="#{productShopView.commitBillCart()}" />
</products:shop>
</tools:canRead>
</ui:define>
<ui:define name="footer">footer</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html <html
xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core" xmlns:f="http://java.sun.com/jsf/core"
xmlns:shop="http://java.sun.com/jsf/composite/tools/shop" xmlns:c="http://java.sun.com/jsp/jstl/core"
> xmlns:products="http://java.sun.com/jsf/composite/tools/products">
<h:head> <h:head>
<title></title> <title></title>
</h:head> </h:head>
<h:body> <h:body>
<ui:composition template="/layout/default-template.xhtml"> <ui:composition template="/layout/default-template.xhtml">
<ui:define name="title">Omnia</ui:define> <ui:define name="title">CreateUser</ui:define>
<ui:define name="header">Lippukauppa</ui:define> <ui:define name="header">Add new user</ui:define>
<ui:define name="content"> <ui:define name="content">
<shop:productlist /> <products:edit />
</ui:define> </ui:define>
<ui:define name="footer">Osta liput</ui:define> </ui:composition>
</ui:composition> </h:body>
</h:body>
</html> </html>
\ No newline at end of file
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:products="http://java.sun.com/jsf/composite/tools/products"
xmlns:f="http://java.sun.com/jsf/core">
<h:body>
<ui:composition template="/layout/default-template.xhtml">
<ui:define name="title">Users</ui:define>
<ui:define name="header">Edit user</ui:define>
<ui:define name="content">
<products:list />
</ui:define>
<ui:define name="footer">footer</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
function setCartCount(elem, newVal)
{
var chfield = elem;
if(newVal < 0)
{
newVal = 0;
}
chfield.val(newVal);
// parseTotal();
return false;
}
function changeCartCount(elem,val)
{
var chfield = elem;
var oldcount = parseInt(chfield.val());
var newVal = oldcount+val;
return setCartCount(elem,newVal);
}
\ No newline at end of file
.linka A:link {color:#133E51; text-decoration:none}
.linka A:active {color:#133E51; text-decoration:none}
.linka A:visited {color:#133E51; text-decoration:none}
.linka A:hover {color:#133E51; text-decoration:underline;}
.link A:link {color:#FFF; text-decoration:none}
.link A:active {color:#FFF; text-decoration:none}
.link A:visited {color:#FFF; text-decoration:none}
.link A:hover {color:#FFF; text-decoration:underline;}
body {
background-color: #133e51;
margin: 0 auto 0 auto;
font-family: helvetica, arial;
font-size: 10pt;
}
#wrapper {
margin: 0 auto 0 auto;
width: 900px;
height: auto;
}
#navigation {
width: 900px;
height: 80px;
}
#content {
width: 100%;
background-image:url('img/top.gif');
background-repeat: no-repeat;
background-color: #FFF;
padding-top: 3px;
}
#headerbox {
height: 33px;
text-align: right;
margin: 15px 30px 5px 30px;
color: #FFFFFF;
}
.linka {
background-image:url('img/linka2.gif');
width: 117px;
height: 27px;
color: #133E51;
float: left;
vertical-align: bottom;
line-height: 30px;
text-align: center;
font-weight: bold;
margin-right: 3px;
}
.link {
background-image:url('img/link2.gif');
width: 117px;
height: 27px;
color: #FFF;
float: left;
vertical-align: bottom;
line-height: 30px;
text-align: center;
font-weight: bold;
margin-right: 3px;
}
#head {
padding-top: 5px;
margin-right: 10px;
float: left;
}
#cwrap {
padding: 3px 3px 3px 3px;
}
#footer {
background-image:url('img/bottom.gif');
height: 21px;
text-align:center;
}
\ No newline at end of file
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools">
<composite:interface>
<composite:attribute name="value" required="true" />
<composite:attribute name="outcome" required="true" />
<composite:attribute name="selected" required="true" />
</composite:interface>
<composite:implementation>
<ui:decorate template="/layout/#{sessionHandler.layout}/level1link.xhtml" >
<ui:define name="link">
<h:link outcome="#{cc.attrs.outcome}" value="#{i18n[cc.attrs.value]}" />
</ui:define>
<ui:param name="isSelected" value="#{cc.attrs.selected}" />
</ui:decorate>
</composite:implementation>
</html>
\ No newline at end of file
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:layout="http://java.sun.com/jsf/composite/tools/layout">
<composite:interface>
<composite:attribute name="selected" required="true" />
</composite:interface>
<composite:implementation>
<layout:level1link value="topmenu.frontpage" outcome="frontpage" selected="#{cc.attrs.selected == 'frontpage'}" />
<layout:level1link value="topmenu.usersPreferences" outcome="userprefs" selected="#{cc.attrs.selected == 'userprefs'} " />
<layout:level1link value="topmenu.shoppings" outcome="shopfrontpage" selected="#{cc.attrs.selected == 'shopfrontpage'}" />
<layout:level1link value="topmenu.adminfront" outcome="adminfront" selected="#{cc.attrs.selected == 'adminfront'}" />
</composite:implementation>
</html>
\ No newline at end of file
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools">
<composite:interface>
</composite:interface>
<composite:implementation>
<h:form>
<h:panelGrid columns="2">
<h:outputLabel value="#{i18n['product.name']}:" /><h:inputText value="#{productView.productname}" />
<h:outputLabel value="#{i18n['product.price']}:" /><h:inputText value="#{productView.productprice}" />
<h:commandButton action="#{productView.createProduct()}" value="#{i18n['create']}" />
</h:panelGrid>
</h:form>
</composite:implementation>
</html>
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools">
<composite:interface>
</composite:interface>
<composite:implementation>
<h:form>
<h:panelGrid columns="2">
<h:outputLabel value="#{i18n['product.name']}:" /><h:inputText value="#{productView.product.name}" />
<h:outputLabel value="#{i18n['product.price']}:" /><h:inputText value="#{productView.product.price}" />
<h:outputLabel value="#{i18n['product.unitName']}:" /><h:inputText value="#{productView.product.unitName}" />
<h:outputLabel value="#{i18n['product.vat']}:" /><h:inputText value="#{productView.product.vat}" />
<h:outputLabel value="#{i18n['product.sort']}:" /><h:inputText value="#{productView.product.sort}" />
<h:outputLabel value="#{i18n['product.barcode']}:" /><h:inputText value="#{productView.product.barcode}" />
<h:outputLabel value="#{i18n['product.prepaid']}" /><h:selectBooleanCheckbox value="#{productView.product.prepaid}" />
<h:commandButton action="#{productView.saveProduct()}" value="#{i18n['save']}" />
</h:panelGrid>
</h:form>
</composite:implementation>
</html>
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools">
<composite:interface>
</composite:interface>
<composite:implementation>
<tools:canRead target="PRODUCT" >
<h:form>
<h:dataTable border="1" id="product" value="#{productView.products}" var="product">
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.name']}" />
</f:facet>
<h:outputText value="#{product.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.price']}" />
</f:facet>
<h:outputText value="#{product.price}" />
</h:column>
<h:column rendered="#{sessionHandler.canWrite('PRODUCT') }">
<f:facet name="header">
<h:outputText value="Edit" />
</f:facet>
<h:commandButton action="#{productView.edit()}" value="Edit" />
</h:column>
</h:dataTable>
</h:form>
</tools:canRead>
</composite:implementation>
</html>
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:tools="http://java.sun.com/jsf/composite/tools">
<composite:interface>
<composite:attribute name="items" required="true" />
<composite:attribute name="commitValue" required="true" />
<composite:actionSource name="commitbutton" targets="shopform:commitbutton" />
</composite:interface>
<composite:implementation>
<h:form id="shopform">
<h:dataTable
border="1"
id="billcart"
value="#{cc.attrs.items}"
var="cart">
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.name']}" />
</f:facet>
<h:outputText value="#{cart.product.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.price']}" />
</f:facet>
<h:outputText value="#{cart.product.price}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.cart.count']}" />
</f:facet>
<a href="#" onclick="return changeCartCount($(this).next().next(), -1)" >-1</a>
<a href="#" onclick="return changeCartCount($(this).next(), -10)" >-10</a>
<h:inputText size="4" id="cartcount" value="#{cart.count}"></h:inputText>
<a href="#" onclick="return changeCartCount($(this).prev(), +1)" >+1</a>
<a href="#" onclick="return changeCartCount($(this).prev().prev(), +10)" >+10</a>
</h:column>
</h:dataTable>
<h:commandButton id="commitbutton" value="#{cc.attrs.commitValue}" />
</h:form>
</composite:implementation>
</html>
...@@ -37,24 +37,24 @@ ...@@ -37,24 +37,24 @@
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['role.read'}" /> <h:outputText value="#{i18n['role.read']}" />
</f:facet> </f:facet>
<h:selectBooleanCheckbox value="#{rr.read}" /> <h:selectBooleanCheckbox value="#{rr.read}" />
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['role.write']" /> <h:outputText value="#{i18n['role.write']}" />
</f:facet> </f:facet>
<h:selectBooleanCheckbox value="#{rr.write}" /> <h:selectBooleanCheckbox value="#{rr.write}" />
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['role.execute']" /> <h:outputText value="#{i18n['role.execute']}" />
</f:facet> </f:facet>
<h:selectBooleanCheckbox value="#{rr.execute}" /> <h:selectBooleanCheckbox value="#{rr.execute}" />
</h:column> </h:column>
<h:column> <h:column>
<h:commandButton value="#{i18n['role.edit.save']" action="#{roleView.editRoleRight}" /> <h:commandButton value="#{i18n['role.edit.save']}" action="#{roleView.editRoleRight}" />
</h:column> </h:column>
</h:dataTable> </h:dataTable>
</h:form> </h:form>
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<h:panelGrid columns="2"> <h:panelGrid columns="2">
<h:outputLabel value="#{i18n['user.login']}:" /><h:inputText value="#{userView.user.login}" /> <h:outputLabel value="#{i18n['user.login']}:" /><h:inputText value="#{userView.user.login}" />
<h:outputLabel value="#{i18n['user.nick']}:" /><h:inputText value="#{userView.user.nick}" /> <h:outputLabel value="#{i18n['user.nick']}:" /><h:inputText value="#{userView.user.nick}" />
<h:outputLabel value="#{i18n['user.email']}:" /><h:inputText value="#{userView.user.email}" />
<h:outputLabel value="#{i18n['user.firstNames']}:" /><h:inputText value="#{userView.user.firstnames}" /> <h:outputLabel value="#{i18n['user.firstNames']}:" /><h:inputText value="#{userView.user.firstnames}" />
<h:outputLabel value="#{i18n['user.lastName']}:" /><h:inputText value="#{userView.user.lastname}" /> <h:outputLabel value="#{i18n['user.lastName']}:" /><h:inputText value="#{userView.user.lastname}" />
<h:outputLabel value="#{i18n['user.address']}:" /><h:inputText value="#{userView.user.address}" /> <h:outputLabel value="#{i18n['user.address']}:" /><h:inputText value="#{userView.user.address}" />
......
...@@ -27,39 +27,28 @@ ...@@ -27,39 +27,28 @@
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="Real name" /> <h:outputText value="#{i18n['user.nick']}" />
</f:facet> </f:facet>
<h:outputText value="#{user.firstnames}" /> <h:outputText value="#{user.nick}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Address" />
</f:facet>
<h:outputText value="#{user.address}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Town" />
</f:facet>
<h:outputText value="#{user.town}" />
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="Zip" /> <h:outputText value="#{i18n['user.firstnames']}" />
</f:facet> </f:facet>
<h:outputText value="#{user.zip}" /> <h:outputText value="#{user.firstnames}" />
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="Phone number" /> <h:outputText value="#{i18n['user.lastname']}" />
</f:facet> </f:facet>
<h:outputText value="#{user.phone}" /> <h:outputText value="#{user.lastname}" />
</h:column> </h:column>
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="Sex" /> <h:outputText value="#{i18n['user.email']}" />
</f:facet> </f:facet>
<h:outputText value="#{i18n[concat['user.gender.,#user.gender']]}" /> <h:outputText value="#{user.email}" />
</h:column> </h:column>
<h:column rendered="#{sessionHandler.canWrite('USER_MANAGEMENT') }"> <h:column rendered="#{sessionHandler.canWrite('USER_MANAGEMENT') }">
......
...@@ -32,7 +32,6 @@ package fi.insomnia.bortal.model { ...@@ -32,7 +32,6 @@ package fi.insomnia.bortal.model {
private var _billNumber:Number; private var _billNumber:Number;
private var _delayIntrest:Number; private var _delayIntrest:Number;
private var _deliveryTerms:String; private var _deliveryTerms:String;
private var _dueDate:Date;
private var _event:LanEvent; private var _event:LanEvent;
private var _id:EventPk; private var _id:EventPk;
private var _jpaVersionField:int; private var _jpaVersionField:int;
...@@ -126,13 +125,6 @@ package fi.insomnia.bortal.model { ...@@ -126,13 +125,6 @@ package fi.insomnia.bortal.model {
return _deliveryTerms; return _deliveryTerms;
} }
public function set dueDate(value:Date):void {
_dueDate = value;
}
public function get dueDate():Date {
return _dueDate;
}
[Bindable(event="unused")] [Bindable(event="unused")]
public function get event():LanEvent { public function get event():LanEvent {
return _event; return _event;
...@@ -222,7 +214,6 @@ package fi.insomnia.bortal.model { ...@@ -222,7 +214,6 @@ package fi.insomnia.bortal.model {
_billNumber = function(o:*):Number { return (o is Number ? o as Number : Number.NaN) } (input.readObject()); _billNumber = function(o:*):Number { return (o is Number ? o as Number : Number.NaN) } (input.readObject());
_delayIntrest = function(o:*):Number { return (o is Number ? o as Number : Number.NaN) } (input.readObject()); _delayIntrest = function(o:*):Number { return (o is Number ? o as Number : Number.NaN) } (input.readObject());
_deliveryTerms = input.readObject() as String; _deliveryTerms = input.readObject() as String;
_dueDate = input.readObject() as Date;
_event = input.readObject() as LanEvent; _event = input.readObject() as LanEvent;
_id = input.readObject() as EventPk; _id = input.readObject() as EventPk;
_jpaVersionField = input.readObject() as int; _jpaVersionField = input.readObject() as int;
...@@ -254,7 +245,6 @@ package fi.insomnia.bortal.model { ...@@ -254,7 +245,6 @@ package fi.insomnia.bortal.model {
output.writeObject(_billNumber); output.writeObject(_billNumber);
output.writeObject(_delayIntrest); output.writeObject(_delayIntrest);
output.writeObject(_deliveryTerms); output.writeObject(_deliveryTerms);
output.writeObject(_dueDate);
output.writeObject(_event); output.writeObject(_event);
output.writeObject(_id); output.writeObject(_id);
output.writeObject(_jpaVersionField); output.writeObject(_jpaVersionField);
......
...@@ -32,6 +32,7 @@ package fi.insomnia.bortal.model { ...@@ -32,6 +32,7 @@ package fi.insomnia.bortal.model {
private var _jpaVersionField:int; private var _jpaVersionField:int;
private var _logEntries:ListCollectionView; private var _logEntries:ListCollectionView;
private var _name:String; private var _name:String;
private var _nextBillNumber:int;
private var _organiser:EventOrganiser; private var _organiser:EventOrganiser;
private var _readers:ListCollectionView; private var _readers:ListCollectionView;
private var _referenceNumberBase:Number; private var _referenceNumberBase:Number;
...@@ -121,6 +122,13 @@ package fi.insomnia.bortal.model { ...@@ -121,6 +122,13 @@ package fi.insomnia.bortal.model {
return _name; return _name;
} }
public function set nextBillNumber(value:int):void {
_nextBillNumber = value;
}
public function get nextBillNumber():int {
return _nextBillNumber;
}
public function set organiser(value:EventOrganiser):void { public function set organiser(value:EventOrganiser):void {
_organiser = value; _organiser = value;
} }
...@@ -184,6 +192,7 @@ package fi.insomnia.bortal.model { ...@@ -184,6 +192,7 @@ package fi.insomnia.bortal.model {
_jpaVersionField = input.readObject() as int; _jpaVersionField = input.readObject() as int;
_logEntries = input.readObject() as ListCollectionView; _logEntries = input.readObject() as ListCollectionView;
_name = input.readObject() as String; _name = input.readObject() as String;
_nextBillNumber = input.readObject() as int;
_organiser = input.readObject() as EventOrganiser; _organiser = input.readObject() as EventOrganiser;
_readers = input.readObject() as ListCollectionView; _readers = input.readObject() as ListCollectionView;
_referenceNumberBase = function(o:*):Number { return (o is Number ? o as Number : Number.NaN) } (input.readObject()); _referenceNumberBase = function(o:*):Number { return (o is Number ? o as Number : Number.NaN) } (input.readObject());
...@@ -211,6 +220,7 @@ package fi.insomnia.bortal.model { ...@@ -211,6 +220,7 @@ package fi.insomnia.bortal.model {
output.writeObject(_jpaVersionField); output.writeObject(_jpaVersionField);
output.writeObject(_logEntries); output.writeObject(_logEntries);
output.writeObject(_name); output.writeObject(_name);
output.writeObject(_nextBillNumber);
output.writeObject(_organiser); output.writeObject(_organiser);
output.writeObject(_readers); output.writeObject(_readers);
output.writeObject(_referenceNumberBase); output.writeObject(_referenceNumberBase);
......
...@@ -33,6 +33,8 @@ package fi.insomnia.bortal.model { ...@@ -33,6 +33,8 @@ package fi.insomnia.bortal.model {
private var _prepaid:Boolean; private var _prepaid:Boolean;
private var _price:Number; private var _price:Number;
private var _sort:int; private var _sort:int;
private var _unitName:String;
private var _vat:Number;
meta function isInitialized(name:String = null):Boolean { meta function isInitialized(name:String = null):Boolean {
if (!name) if (!name)
...@@ -122,6 +124,20 @@ package fi.insomnia.bortal.model { ...@@ -122,6 +124,20 @@ package fi.insomnia.bortal.model {
return _sort; return _sort;
} }
public function set unitName(value:String):void {
_unitName = value;
}
public function get unitName():String {
return _unitName;
}
public function set vat(value:Number):void {
_vat = value;
}
public function get vat():Number {
return _vat;
}
public function readExternal(input:IDataInput):void { public function readExternal(input:IDataInput):void {
__initialized = input.readObject() as Boolean; __initialized = input.readObject() as Boolean;
__detachedState = input.readObject() as String; __detachedState = input.readObject() as String;
...@@ -137,6 +153,8 @@ package fi.insomnia.bortal.model { ...@@ -137,6 +153,8 @@ package fi.insomnia.bortal.model {
_prepaid = input.readObject() as Boolean; _prepaid = input.readObject() as Boolean;
_price = function(o:*):Number { return (o is Number ? o as Number : Number.NaN) } (input.readObject()); _price = function(o:*):Number { return (o is Number ? o as Number : Number.NaN) } (input.readObject());
_sort = input.readObject() as int; _sort = input.readObject() as int;
_unitName = input.readObject() as String;
_vat = function(o:*):Number { return (o is Number ? o as Number : Number.NaN) } (input.readObject());
} }
else { else {
_id = input.readObject() as EventPk; _id = input.readObject() as EventPk;
...@@ -158,6 +176,8 @@ package fi.insomnia.bortal.model { ...@@ -158,6 +176,8 @@ package fi.insomnia.bortal.model {
output.writeObject(_prepaid); output.writeObject(_prepaid);
output.writeObject(_price); output.writeObject(_price);
output.writeObject(_sort); output.writeObject(_sort);
output.writeObject(_unitName);
output.writeObject(_vat);
} }
else { else {
output.writeObject(_id); output.writeObject(_id);
......
...@@ -12,7 +12,8 @@ public class PermissionDeniedException extends RuntimeException { ...@@ -12,7 +12,8 @@ public class PermissionDeniedException extends RuntimeException {
public PermissionDeniedException(EjbPermissionDeniedException e) public PermissionDeniedException(EjbPermissionDeniedException e)
{ {
super(e.getMessage());
// Let's not log. EJB already logged...
} }
/** /**
* *
......
...@@ -43,6 +43,16 @@ public class SessionHandler { ...@@ -43,6 +43,16 @@ public class SessionHandler {
public SessionHandler() { public SessionHandler() {
} }
public String getLocale() {
//TODO: Locale selection code missing
return "en_ST_v7";
}
public String getLayout() {
//TODO: layout selection code missing!!
return "insomnia1";
}
public boolean hasPermission(String target, String permission) { public boolean hasPermission(String target, String permission) {
RolePermission perm = null; RolePermission perm = null;
if (permission.equalsIgnoreCase("read")) { if (permission.equalsIgnoreCase("read")) {
...@@ -62,8 +72,6 @@ public class SessionHandler { ...@@ -62,8 +72,6 @@ public class SessionHandler {
return sess; return sess;
} }
public boolean hasPermission(Permission target, RolePermission permission) { public boolean hasPermission(Permission target, RolePermission permission) {
if (target == null) { if (target == null) {
throw new RuntimeException("Empty target"); throw new RuntimeException("Empty target");
......
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.view;
import java.math.BigDecimal;
import java.util.Iterator;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import javax.faces.event.ActionListener;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.beans.BillBeanLocal;
import fi.insomnia.bortal.beans.EventBeanLocal;
import fi.insomnia.bortal.beans.ProductBeanLocal;
import fi.insomnia.bortal.beans.UserBeanLocal;
import fi.insomnia.bortal.exceptions.EjbPermissionDeniedException;
import fi.insomnia.bortal.exceptions.PermissionDeniedException;
import fi.insomnia.bortal.model.Bill;
import fi.insomnia.bortal.model.Product;
import fi.insomnia.bortal.model.User;
import fi.insomnia.bortal.view.helpers.ProductShopItem;
@ManagedBean(name = "productShopView")
@SessionScoped
public class ProductShopView {
private static final Logger logger = LoggerFactory.getLogger(ProductShopView.class);
@EJB
private ProductBeanLocal productBean;
@EJB
private BillBeanLocal billBean;
@EJB
private EventBeanLocal eventBean;
@EJB
private UserBeanLocal userBean;
private ListDataModel<ProductShopItem> billCart;
private User shoppingUser;
public DataModel<Product> getUserShoppableProducts() {
ListDataModel<Product> items = new ListDataModel<Product>(productBean.listUserShoppableProducts());
logger.info("Fetching products. Found {}", items.getRowCount());
return items;
}
public ActionListener getBillCommitAL()
{
logger.info("Fetching billCommitAl()");
return new ActionListener(){
@Override
public void processAction(ActionEvent event) throws AbortProcessingException {
logger.info("Executing BillCommit AL");
}};
}
public void commitBillCart() {
logger.debug("Committing billCart");
Iterator<ProductShopItem> cartIter = billCart.iterator();
Bill bill = null;
try {
bill = billBean.createEmptyBill(getShoppingUser());
} catch (EjbPermissionDeniedException e) {
throw new PermissionDeniedException(e);
}
bill.setOurReference(eventBean.getCurrentEvent().getName());
while (cartIter.hasNext()) {
ProductShopItem shopitem = cartIter.next();
if (shopitem.getCount().compareTo(BigDecimal.ZERO) > 0) {
billBean.addProductToBill(bill, shopitem.getProduct(), shopitem.getCount());
}
}
}
public DataModel<ProductShopItem> getBillCart() {
billCart = new ListDataModel<ProductShopItem>(ProductShopItem.productList(productBean.listUserShoppableProducts()));
return billCart;
}
public void setShoppingUser(User shoppingUser) {
this.shoppingUser = shoppingUser;
}
public User getShoppingUser() {
if (shoppingUser == null) {
userBean.getCurrentUser();
}
return shoppingUser;
}
}
...@@ -4,21 +4,26 @@ ...@@ -4,21 +4,26 @@
*/ */
package fi.insomnia.bortal.view; package fi.insomnia.bortal.view;
import fi.insomnia.bortal.beans.ProductBeanLocal; import java.math.BigDecimal;
import fi.insomnia.bortal.beans.SecurityBeanLocal; import java.util.Iterator;
import fi.insomnia.bortal.model.EventMap;
import fi.insomnia.bortal.model.Product;
import java.util.Map;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped; import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.model.DataModel; import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel; import javax.faces.model.ListDataModel;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.beans.BillBeanLocal;
import fi.insomnia.bortal.beans.ProductBeanLocal;
import fi.insomnia.bortal.model.Bill;
import fi.insomnia.bortal.model.BillLine;
import fi.insomnia.bortal.model.EventMap;
import fi.insomnia.bortal.model.Product;
import fi.insomnia.bortal.view.helpers.ProductShopItem;
/** /**
* *
* @author jkj * @author jkj
...@@ -26,22 +31,44 @@ import org.slf4j.LoggerFactory; ...@@ -26,22 +31,44 @@ import org.slf4j.LoggerFactory;
@ManagedBean(name = "productView") @ManagedBean(name = "productView")
@SessionScoped @SessionScoped
public class ProductView { public class ProductView {
private static final Logger logger = LoggerFactory.getLogger(ProductView.class);
@EJB @EJB
private ProductBeanLocal productBean; private ProductBeanLocal productBean;
private static final Logger logger = LoggerFactory.getLogger(ProductView.class);
@EJB @EJB
private SecurityBeanLocal securitybean; private BillBeanLocal billBean;
private String productname = "";
private BigDecimal productprice = BigDecimal.ZERO;
private EventMap activeMap = null; private EventMap activeMap = null;
private ListDataModel<ProductShopItem> billCart;
private Product product;
private ListDataModel<Product> products;
public DataModel<Product> getProducts() {
products = new ListDataModel<Product>(productBean.getProducts());
return products;
}
public String createProduct() {
setProduct(productBean.createProduct(productname, productprice));
productprice = BigDecimal.ZERO;
productname = "";
public DataModel<Product> getUserShoppableProducts() { return "edit";
ListDataModel<Product> items = new ListDataModel<Product>(productBean.listUserShoppableProducts()); }
logger.info("Fetching products. Found {}", items.getRowCount());
public String edit() {
product = products.getRowData();
return "edit";
}
return items; public String saveProduct() {
productBean.mergeChanges(product);
return "list";
} }
/** /**
...@@ -52,32 +79,56 @@ public class ProductView { ...@@ -52,32 +79,56 @@ public class ProductView {
} }
/** /**
* @param activeMap the activeMap to set * @param activeMap
* the activeMap to set
*/ */
public void setActiveMap(EventMap activeMap) { public void setActiveMap(EventMap activeMap) {
this.activeMap = activeMap; this.activeMap = activeMap;
} }
public void setProductname(String productname) {
this.productname = productname;
}
/* public String getProductname() {
public String placeMapActionListener(ActionEvent e) { return productname;
}
if(activeMap == null)
throw new UnsupportedOperationException("TODO error message");
public void setProductprice(BigDecimal productprice) {
this.productprice = productprice;
}
public BigDecimal getProductprice() {
return productprice;
}
FacesContext context = FacesContext.getCurrentInstance(); public void setProduct(Product product) {
String clientId = e.getComponent().getClientId(context); this.product = product;
Map requestParams = context.getExternalContext().getRequestParameterMap(); }
int x = new Integer((String) requestParams.get(clientId + ".x")).intValue();
int y = new Integer((String) requestParams.get(clientId + ".y")).intValue();
System.out.println("x: " + x + ", y:" + y); public Product getProduct() {
return product;
}
throw new UnsupportedOperationException(); /*
}*/ * public String placeMapActionListener(ActionEvent e) {
*
* if(activeMap == null) throw new
* UnsupportedOperationException("TODO error message");
*
*
*
*
*
*
* FacesContext context = FacesContext.getCurrentInstance(); String clientId
* = e.getComponent().getClientId(context); Map requestParams =
* context.getExternalContext().getRequestParameterMap(); int x = new
* Integer((String) requestParams.get(clientId + ".x")).intValue(); int y =
* new Integer((String) requestParams.get(clientId + ".y")).intValue();
*
* System.out.println("x: " + x + ", y:" + y);
*
* throw new UnsupportedOperationException(); }
*/
} }
...@@ -49,9 +49,7 @@ public class UserView { ...@@ -49,9 +49,7 @@ public class UserView {
return "userEdit"; return "userEdit";
} }
public String getLocale() {
return "en_ST_v7";
}
public String createUser() { public String createUser() {
if (!getSessionhandler().canWrite(Permission.USER_MANAGEMENT)) { if (!getSessionhandler().canWrite(Permission.USER_MANAGEMENT)) {
......
package fi.insomnia.bortal.view.helpers;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import fi.insomnia.bortal.model.Product;
public class ProductShopItem {
private Product product;
private BigDecimal count = BigDecimal.ZERO;
public ProductShopItem(Product prod) {
this.product = prod;
}
public static List<ProductShopItem> productList(List<Product> products) {
List<ProductShopItem> ret = new ArrayList<ProductShopItem>();
for (Product prod : products) {
ret.add(new ProductShopItem(prod));
}
return ret;
}
public Product getProduct() {
return this.product;
}
public void setCount(BigDecimal count) {
this.count = count;
}
public BigDecimal getCount() {
return count;
}
}
user.username=K\u00E4ytt\u00E4j\u00E4tunnus user.username=K\u00E4ytt\u00E4j\u00E4tunnus
user.realname=Nimi user.realname=Name
user.password=Salasana user.password=Password
user.email=S\u00E4hk\u00E4postiosoite user.email=Email address
user.phone=Puhelinnumero user.phone=Phone
user.bankaccount=Tilinumero user.bankaccount=Bank account
user.bank=Pankki user.bank=Bank
save=Tallenna save=Save
cancel=Peruuta cancel=Cancel
login.username=K\u00E4ytt\u00E4j\u00E4tunnus: login.username=User
login.password=Salasana: login.password=Password
login.submit=Kirjaudu sis\u00E4\u00E4n login.submit=Login
user.validate.notUniqueUsername=i18n K\u00E4ytt\u00E4j\u00E4tunnus on jo olemassa. Ole hyv\u00E4 ja valitse toinen tunnus. topmenu.frontpage=Frontpage
topmenu.usersPreferences=Preferences
topmenu.shoppings=Shop
topmenu.adminfront=Adminstuff
user.validate.notUniqueUsername=Username already exists. Please select another.
fallbackstr="fallback default" fallbackstr="fallback default"
teststr=default locale test teststr=default local
defaultstr="Something default..." defaultstr="Something default..."
logout=H\u00E4ivy logout=Logout
nasty.user=paha k\u00E4ytt\u00E4j\u00E4 ei yrit\u00E4 haxoroida meid\u00E4n softaa. Kts. nasty.user=Hax attempt! Go away!
global.sex.UNDEFINED=Undefined global.sex.UNDEFINED=Undefined
......
user.username=K\u00E4ytt\u00E4j\u00E4tunnus global.infomail=info@streamparty.org
user.realname=Nimi global.webpage=http://www.streamparty.org
user.password=Salasana \ No newline at end of file
user.email=S\u00E4hk\u00F6postiosoite
user.phone=Puhelinnumero
user.bankaccount=Tilinumero
user.bank=Pankki
save=Tallenna
cancel=Peruuta
login.username=K\u00E4ytt\u00E4j\u00E4tunnus:
login.password=Salasana:
login.submit=Kirjaudu sis\u00E4\u00E4n
user.validate.notUniqueUsername=i18n K\u00E4ytt\u00E4j\u00E4tunnus on jo olemassa. Ole hyv\u00E4 ja valitse toinen tunnus.
fallbackstr="fallback default"
teststr=default locale test
defaultstr="Something default..."
logout=H\u00E4ivy
nasty.user=paha k\u00E4ytt\u00E4j\u00E4 ei yrit\u00E4 haxoroida meid\u00E4n softaa. Kts.
user.username=K\u00E4ytt\u00E4j\u00E4tunnus global.eventname=Stream seven
user.realname=Nimi
user.password=Salasana
user.email=S\u00E4hk\u00F6postiosoite
user.phone=Puhelinnumero
user.bankaccount=Tilinumero
user.bank=Pankki
save=Tallenna
cancel=Peruuta
login.username=K\u00E4ytt\u00E4j\u00E4tunnus:
login.password=Salasana:
login.submit=Kirjaudu sis\u00E4\u00E4n
user.validate.notUniqueUsername=i18n K\u00E4ytt\u00E4j\u00E4tunnus on jo olemassa. Ole hyv\u00E4 ja valitse toinen tunnus.
fallbackstr="fallback default"
teststr=default locale test
defaultstr="Something default..."
logout=H\u00E4ivy
nasty.user=paha k\u00E4ytt\u00E4j\u00E4 ei yrit\u00E4 haxoroida meid\u00E4n softaa. Kts.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!