Commit 96dcf4f7 by Tuomas Riihimäki

Jaha.. ja taas vähän iso commit.

 - ProductLimit ( uusi käsite.. )
 - Checkout.fi juttuja
  - Sekalaista muuta.....
1 parent 63fbadf0
Showing with 1710 additions and 272 deletions
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd" version="3.1">
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" <display-name>LanBortalBeans</display-name>
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd" <ejb-client-jar>LanBortalBeansClient.jar</ejb-client-jar>
version="3.1">
<display-name>LanBortalBeans</display-name>
<ejb-client-jar>LanBortalBeansClient.jar</ejb-client-jar>
</ejb-jar> </ejb-jar>
\ No newline at end of file
...@@ -281,7 +281,4 @@ public class BillBean implements BillBeanLocal { ...@@ -281,7 +281,4 @@ public class BillBean implements BillBeanLocal {
return billFacade.find(user); return billFacade.find(user);
} }
public void findByOrdernumber() {
}
} }
...@@ -87,7 +87,7 @@ public class LoggingBean implements LoggingBeanLocal { ...@@ -87,7 +87,7 @@ public class LoggingBean implements LoggingBeanLocal {
@Override @Override
public LogEntry logMessage(SecurityLogType paramType, User user, public LogEntry logMessage(SecurityLogType paramType, User user,
String... description) { Object... description) {
LogEntry entry = null; LogEntry entry = null;
try { try {
String desc = toString(description); String desc = toString(description);
...@@ -114,13 +114,13 @@ public class LoggingBean implements LoggingBeanLocal { ...@@ -114,13 +114,13 @@ public class LoggingBean implements LoggingBeanLocal {
@Override @Override
public LogEntry logMessage(SecurityLogType paramType, EventUser user, public LogEntry logMessage(SecurityLogType paramType, EventUser user,
String... description) { Object... description) {
return logMessage(paramType, user.getUser(), description); return logMessage(paramType, user.getUser(), description);
} }
private static final String toString(String... desc) { private static final String toString(Object... desc) {
StringBuilder msg = new StringBuilder(); StringBuilder msg = new StringBuilder();
for (String msgpart : desc) { for (Object msgpart : desc) {
msg.append(msgpart); msg.append(msgpart);
} }
return msg.toString(); return msg.toString();
......
...@@ -104,6 +104,10 @@ public class Menubean implements MenubeanLocal { ...@@ -104,6 +104,10 @@ public class Menubean implements MenubeanLocal {
shopTopmenu.addPage(menuitemfacade.findOrCreate("/svm/notification"), null).setVisible(false); shopTopmenu.addPage(menuitemfacade.findOrCreate("/svm/notification"), null).setVisible(false);
shopTopmenu.addPage(menuitemfacade.findOrCreate("/svm/pending"), null).setVisible(false); shopTopmenu.addPage(menuitemfacade.findOrCreate("/svm/pending"), null).setVisible(false);
shopTopmenu.addPage(menuitemfacade.findOrCreate("/svm/success"), null).setVisible(false); shopTopmenu.addPage(menuitemfacade.findOrCreate("/svm/success"), null).setVisible(false);
shopTopmenu.addPage(menuitemfacade.findOrCreate("/checkout/cancel"), null).setVisible(false);
shopTopmenu.addPage(menuitemfacade.findOrCreate("/checkout/delayed"), null).setVisible(false);
shopTopmenu.addPage(menuitemfacade.findOrCreate("/checkout/reject"), null).setVisible(false);
shopTopmenu.addPage(menuitemfacade.findOrCreate("/checkout/return"), null).setVisible(false);
MenuNavigation pollTopmenu = usernavi.addPage(null, null); MenuNavigation pollTopmenu = usernavi.addPage(null, null);
pollTopmenu.setKey("topnavi.poll"); pollTopmenu.setKey("topnavi.poll");
...@@ -140,9 +144,9 @@ public class Menubean implements MenubeanLocal { ...@@ -140,9 +144,9 @@ public class Menubean implements MenubeanLocal {
adminuser.addPage(menuitemfacade.findOrCreate("/place/adminInsertToken"), UserPermission.VIEW_ALL).setVisible(false); adminuser.addPage(menuitemfacade.findOrCreate("/place/adminInsertToken"), UserPermission.VIEW_ALL).setVisible(false);
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/sendPicture"), UserPermission.VIEW_ALL).setVisible(false); adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/sendPicture"), UserPermission.VIEW_ALL).setVisible(false);
MenuNavigation initUser = adminnavi.addPage(null, null); // MenuNavigation initUser = adminnavi.addPage(null, null);
initUser.setKey("topnavi.userinit"); // initUser.setKey("topnavi.userinit");
initUser.addPage(menuitemfacade.findOrCreate("/useradmin/validateUser"), UserPermission.VIEW_ALL); adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/validateUser"), UserPermission.VIEW_ALL);
MenuNavigation usershop = adminnavi.addPage(null, null); MenuNavigation usershop = adminnavi.addPage(null, null);
usershop.setKey("topnavi.adminshop"); usershop.setKey("topnavi.adminshop");
......
...@@ -4,7 +4,10 @@ import java.math.BigDecimal; ...@@ -4,7 +4,10 @@ import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.annotation.security.DeclareRoles; import javax.annotation.security.DeclareRoles;
import javax.annotation.security.RolesAllowed; import javax.annotation.security.RolesAllowed;
...@@ -12,8 +15,13 @@ import javax.ejb.EJB; ...@@ -12,8 +15,13 @@ import javax.ejb.EJB;
import javax.ejb.LocalBean; import javax.ejb.LocalBean;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.bortal.views.BillSummary;
import fi.insomnia.bortal.enums.apps.ShopPermission; import fi.insomnia.bortal.enums.apps.ShopPermission;
import fi.insomnia.bortal.facade.AccountEventFacade; import fi.insomnia.bortal.facade.AccountEventFacade;
import fi.insomnia.bortal.facade.BillLineFacade;
import fi.insomnia.bortal.facade.DiscountFacade; import fi.insomnia.bortal.facade.DiscountFacade;
import fi.insomnia.bortal.facade.EventUserFacade; import fi.insomnia.bortal.facade.EventUserFacade;
import fi.insomnia.bortal.facade.ProductFacade; import fi.insomnia.bortal.facade.ProductFacade;
...@@ -25,6 +33,8 @@ import fi.insomnia.bortal.model.EventUser; ...@@ -25,6 +33,8 @@ import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.model.LanEvent; import fi.insomnia.bortal.model.LanEvent;
import fi.insomnia.bortal.model.Product; import fi.insomnia.bortal.model.Product;
import fi.insomnia.bortal.model.ProductFlag; import fi.insomnia.bortal.model.ProductFlag;
import fi.insomnia.bortal.model.ProductLimitation;
import fi.insomnia.bortal.model.Role;
/** /**
* Session Bean implementation class ProductBean * Session Bean implementation class ProductBean
...@@ -59,6 +69,17 @@ public class ProductBean implements ProductBeanLocal { ...@@ -59,6 +69,17 @@ public class ProductBean implements ProductBeanLocal {
private PermissionBeanLocal permbean; private PermissionBeanLocal permbean;
@EJB @EJB
private EventUserFacade eventUserFacade; private EventUserFacade eventUserFacade;
@EJB
private UserBeanLocal userbean;
@EJB
private BillBeanLocal billbean;
@EJB
private EventBeanLocal eventbean;
@EJB
private BillLineFacade billLineFacade;
private static final Logger logger = LoggerFactory.getLogger(ProductBean.class);
/** /**
* Default constructor. * Default constructor.
...@@ -109,6 +130,139 @@ public class ProductBean implements ProductBeanLocal { ...@@ -109,6 +130,139 @@ public class ProductBean implements ProductBeanLocal {
return retProd; return retProd;
} }
/**
* TODO: This is not enforced!!!
*
* @param product
* Product to find limits for
* @return How many products can still be bought. NULL if no limit.
*/
@Override
public HashMap<Integer, BigDecimal> getProductLimit(Map<Integer, BigDecimal> prodCounts, EventUser user)
{
HashMap<Integer, BigDecimal> ret = new HashMap<Integer, BigDecimal>();
for (Entry<Integer, BigDecimal> pc : prodCounts.entrySet())
{
Product prod = productFacade.find(pc.getKey());
BigDecimal lim = getProductLimit(prod, user, prodCounts);
ret.put(prod.getId(), lim);
// logger.info("Added product limit {} to {}", lim, prod);
}
System.out.println(ret);
return ret;
}
@Override
public BigDecimal getProductLimit(Product product, EventUser user, Map<Integer, BigDecimal> prodCounts)
{
product = productFacade.reload(product);
List<Role> userroles = userbean.findUsersRoles(user);
BigDecimal ret = null;
if (product != null && product.getProductLimits() != null)
{
for (ProductLimitation limit : product.getProductLimits())
{
BigDecimal currentCount = BigDecimal.ZERO;
for (Product p : limit.getProducts())
{
currentCount = currentCount.add(prodCounts.get(p.getId()));
}
// logger.info("Got limit {} for product {}", limit, product);
if (limit.getMatchingRoles() != null && !limit.getMatchingRoles().isEmpty())
{
boolean roleMatched = false;
for (Role mr : limit.getMatchingRoles()) {
if (userroles.contains(mr)) {
roleMatched = true;
break;
}
}
if (!roleMatched) {
continue;
}
}
BigDecimal count = currentCount;
switch (limit.getType())
{
case GLOBAL_BILLED:
BigDecimal globBillTot = BigDecimal.ZERO;
for (Product p : limit.getProducts())
{
BillSummary globBilledSummary = billLineFacade.getLineSummary(p, eventbean.getCurrentEvent());
globBillTot = globBillTot.add(globBilledSummary.getTotal());
}
count = count.add(globBillTot);
ret = limit.getUpperLimit().subtract(count);
break;
case GLOBAL_BILL_PAID:
BigDecimal globBillPaid = BigDecimal.ZERO;
for (Product p : limit.getProducts())
{
BillSummary billPaidSummary = billLineFacade.getLineSummary(p, eventbean.getCurrentEvent());
globBillPaid = globBillPaid.add(billPaidSummary.getPaid());
}
count = count.add(globBillPaid);
ret = limit.getUpperLimit().subtract(count);
break;
case GLOBAL_ACCOUNTEVENTS:
BigDecimal globalProductCount = accounteventfacade.getProductCount(limit.getProducts());
if (globalProductCount != null) {
count = count.add(globalProductCount);
}
ret = limit.getUpperLimit().subtract(count);
break;
case USER_ACCOUNTEVENTS:
BigDecimal userProductCount = accounteventfacade.getProductCount(limit.getProducts(), user);
if (userProductCount != null)
{
count = count.add(userProductCount);
}
ret = limit.getUpperLimit().subtract(count);
break;
case USER_BILLED:
BigDecimal userBillTot = BigDecimal.ZERO;
for (Product p : limit.getProducts())
{
BillSummary userBilledSummary = billLineFacade.getLineSummary(p, eventbean.getCurrentEvent(), user);
userBillTot = userBillTot.add(userBilledSummary.getTotal());
}
count = count.add(userBillTot);
ret = limit.getUpperLimit().subtract(count);
break;
case USER_BILL_PAID:
BigDecimal userBillPaid = BigDecimal.ZERO;
for (Product p : limit.getProducts())
{
BillSummary userPaidSummary = billLineFacade.getLineSummary(p, eventbean.getCurrentEvent(), user);
userBillPaid = userBillPaid.add(userPaidSummary.getPaid());
}
count = count.add(userBillPaid);
ret = limit.getUpperLimit().subtract(count);
break;
default:
break;
}
if (ret != null)
{
// logger.warn("breaking for value {}, product {}", ret,
// product);
break;
}
}
}
return ret;
}
@Override @Override
public BigDecimal calculateTotal(Product product, BigDecimal quantity, Calendar date) { public BigDecimal calculateTotal(Product product, BigDecimal quantity, Calendar date) {
if (product == null || quantity == null) { if (product == null || quantity == null) {
......
...@@ -131,4 +131,11 @@ public class SitePageBean implements SitePageBeanLocal { ...@@ -131,4 +131,11 @@ public class SitePageBean implements SitePageBeanLocal {
SitePage page = sitepagefacade.find(name); SitePage page = sitepagefacade.find(name);
return getContentsForPage(page); return getContentsForPage(page);
} }
@Override
@RolesAllowed(ContentPermission.S_MANAGE_PAGES)
public SitePage findSitename(String managedPage) {
return sitepagefacade.find(managedPage);
}
} }
...@@ -4,8 +4,6 @@ import java.io.IOException; ...@@ -4,8 +4,6 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.StringWriter; import java.io.StringWriter;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
...@@ -22,14 +20,12 @@ import javax.xml.parsers.DocumentBuilder; ...@@ -22,14 +20,12 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.codec.binary.Hex;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope; import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.auth.params.AuthPNames; import org.apache.http.auth.params.AuthPNames;
import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.params.AuthPolicy; import org.apache.http.client.params.AuthPolicy;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultHttpClient;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -47,6 +43,7 @@ import fi.insomnia.bortal.model.LanEventPrivateProperty; ...@@ -47,6 +43,7 @@ import fi.insomnia.bortal.model.LanEventPrivateProperty;
import fi.insomnia.bortal.model.LanEventPrivatePropertyKey; import fi.insomnia.bortal.model.LanEventPrivatePropertyKey;
import fi.insomnia.bortal.util.SvmReturnType; import fi.insomnia.bortal.util.SvmReturnType;
import fi.insomnia.bortal.util.VerkkomaksutReturnEntry; import fi.insomnia.bortal.util.VerkkomaksutReturnEntry;
import fi.insomnia.bortal.utilities.PasswordFunctions;
import fi.insomnia.bortal.verkkomaksutfi.PaymentEntry; import fi.insomnia.bortal.verkkomaksutfi.PaymentEntry;
/** /**
...@@ -58,7 +55,7 @@ import fi.insomnia.bortal.verkkomaksutfi.PaymentEntry; ...@@ -58,7 +55,7 @@ import fi.insomnia.bortal.verkkomaksutfi.PaymentEntry;
public class VerkkomaksutFiBean implements VerkkomaksutFiBeanLocal { public class VerkkomaksutFiBean implements VerkkomaksutFiBeanLocal {
private static final Logger logger = LoggerFactory.getLogger(VerkkomaksutFiBean.class); private static final Logger logger = LoggerFactory.getLogger(VerkkomaksutFiBean.class);
private static final char CHECKSUM_SEP = '|'; private static final String CHECKSUM_SEP = "|";
@EJB @EJB
private EventBean eventbean; private EventBean eventbean;
@EJB @EJB
...@@ -92,45 +89,40 @@ public class VerkkomaksutFiBean implements VerkkomaksutFiBeanLocal { ...@@ -92,45 +89,40 @@ public class VerkkomaksutFiBean implements VerkkomaksutFiBeanLocal {
} }
String merchantPassword = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.VERKKOMAKSU_MERCHANT_PASSWORD); String merchantPassword = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.VERKKOMAKSU_MERCHANT_PASSWORD);
StringBuilder sumSource = new StringBuilder().append(orderNumber).append(CHECKSUM_SEP)
.append(timestamp).append(CHECKSUM_SEP)
.append(paid).append(CHECKSUM_SEP)
.append(method).append(CHECKSUM_SEP)
.append(merchantPassword);
boolean ret = false; boolean ret = false;
try {
MessageDigest algo = MessageDigest.getInstance("MD5"); String calculatedHash = PasswordFunctions.calculateMd5(CHECKSUM_SEP,
orderNumber,
final byte[] resultByte = algo.digest(sumSource.toString().getBytes()); timestamp,
final String calculatedHash = new String(Hex.encodeHex(resultByte)); paid,
logger.info("calculated checksum for svv message: {}, comparing to {}", calculatedHash, authcode); method,
if (authcode.toUpperCase().equals(calculatedHash.toUpperCase())) { merchantPassword);
Bill bill = billFacade.find(Integer.parseInt(orderNumber)); logger.info("calculated checksum for svv message: {}, comparing to {}", calculatedHash, authcode);
if (bill != null) if (authcode.toUpperCase().equals(calculatedHash)) {
{ Bill bill = billFacade.find(Integer.parseInt(orderNumber));
// If bill is unpaid, mark it paid... if (bill != null)
if (SvmReturnType.PENDING.equals(type) || paid.equals("0000000000")) { {
logbean.logMessage(SecurityLogType.verkkomaksu, permbean.getCurrentUser(), "Received pending message ", orderNumber, " bill ", bill == null ? "null" : bill.toString(), " with authcode: ", authcode); // If bill is unpaid, mark it paid...
} else if (bill.getAccountEvent() == null if (SvmReturnType.PENDING.equals(type) || paid.equals("0000000000")) {
&& bill.getPaidDate() == null logbean.logMessage(SecurityLogType.verkkomaksu, permbean.getCurrentUser(), "Received pending message ", orderNumber, " bill ", bill == null ? "null" : bill.toString(), " with authcode: ", authcode);
&& (SvmReturnType.NOTIFICATION.equals(type) || SvmReturnType.SUCCESS.equals(type))) { } else if (bill.getAccountEvent() == null
vmrunner.markPaid(bill, Calendar.getInstance()); && bill.getPaidDate() == null
logbean.logMessage(SecurityLogType.verkkomaksu, permbean.getCurrentUser(), "Validated order number ", orderNumber, " bill ", bill == null ? "null" : bill.toString(), " with authcode: ", authcode); && (SvmReturnType.NOTIFICATION.equals(type) || SvmReturnType.SUCCESS.equals(type))) {
ret = true; vmrunner.markPaid(bill, Calendar.getInstance());
} else { logbean.logMessage(SecurityLogType.verkkomaksu, permbean.getCurrentUser(), "Validated order number ", orderNumber, " bill ", bill == null ? "null" : bill.toString(), " with authcode: ", authcode);
logbean.logMessage(SecurityLogType.verkkomaksu, permbean.getCurrentUser(), "Bill already marked paid or other error. ", orderNumber, " bill ", bill == null ? "null" : bill.toString(), " with authcode: ", authcode); ret = true;
ret = true;
}
} else { } else {
logbean.logMessage(SecurityLogType.verkkomaksu, permbean.getCurrentUser(), "Unable to find bill for order number ", orderNumber); logbean.logMessage(SecurityLogType.verkkomaksu, permbean.getCurrentUser(), "Bill already marked paid or other error. ", orderNumber, " bill ", bill.toString(), " with authcode: ", authcode);
ret = true;
} }
} else { } else {
logbean.logMessage(SecurityLogType.verkkomaksu, permbean.getCurrentUser(), "Unable to validate order number: ", orderNumber, " calculated checksum: ", calculatedHash, " authcode ", authcode, " paid ", paid, " method ", method); logbean.logMessage(SecurityLogType.verkkomaksu, permbean.getCurrentUser(), "Mac validated, but unable to find bill for order number ", orderNumber);
} }
} catch (NoSuchAlgorithmException e) { } else {
logger.warn("THIS SHOULD NEVER HAPPEN! (md5 hashfunction should always exist)", e); logbean.logMessage(SecurityLogType.verkkomaksu, permbean.getCurrentUser(), "Unable to validate order number: ", orderNumber, " calculated checksum: ", calculatedHash, " authcode ", authcode, " paid ", paid, " method ", method);
} }
return ret; return ret;
} }
...@@ -206,7 +198,8 @@ public class VerkkomaksutFiBean implements VerkkomaksutFiBeanLocal { ...@@ -206,7 +198,8 @@ public class VerkkomaksutFiBean implements VerkkomaksutFiBeanLocal {
postRequest.setHeader("Content-Type", "application/xml"); postRequest.setHeader("Content-Type", "application/xml");
postRequest.setHeader("X-Verkkomaksut-Api-Version", "1"); postRequest.setHeader("X-Verkkomaksut-Api-Version", "1");
postRequest.setEntity(new StringEntity(outputPayment(paymentMsg))); // postRequest.setEntity(new
// StringEntity(outputPayment(paymentMsg)));
HttpResponse response = client.execute(postRequest); HttpResponse response = client.execute(postRequest);
......
<?xml version="1.0" encoding="utf-8"?>
<trade>
<id>3821058</id>
<description/>
<status>1</status>
<returnURL>http://localhost/LanBortalWeb/checkout/return.jsf</returnURL>
<returnMAC/>
<cancelURL>http://localhost/LanBortalWeb/checkout/cancel.jsf</cancelURL>
<cancelMAC>8B97471C27317150BEC42B6948334584</cancelMAC>
<rejectURL>http://localhost/LanBortalWeb/checkout/reject.jsf</rejectURL>
<delayedURL>http://localhost/LanBortalWeb/checkout/delayed.jsf</delayedURL>
<delayedMAC>00CF8456F8DF896B3FD6B4B42B45F8B3</delayedMAC>
<stamp>512</stamp>
<version>0001</version>
<reference>543761</reference>
<language>FI</language>
<content>1</content>
<deliveryDate>20120825</deliveryDate>
<firstname/>
<familyname/>
<address/>
<postcode/>
<postoffice/>
<country>FIN</country>
<device>10</device>
<algorithm>2</algorithm>
<paymentURL>https://payment.checkout.fi/p/3821058/DD086BF4-242DEF54-E0D72CE6-5D86580C</paymentURL>
<merchant>
<id>375917</id>
<company>Testi Oy</company>
<name>Testi Henkilö</name>
<email>testi@checkout.fi</email>
<address>Testikuja 1&#13;
12345 Testilä</address>
<vatId>123456-7</vatId>
<helpdeskNumber>012-345 678</helpdeskNumber>
</merchant>
<payments>
<payment>
<id>4358863</id>
<amount>6500</amount>
<stamp>512</stamp>
<banks>
<nordea url="https://solo3.nordea.fi/cgi-bin/SOLOPM01" icon="https://payment.checkout.fi/static/img/nordea.png" name="Nordea">
<SOLOPMT_VERSION>0003</SOLOPMT_VERSION>
<SOLOPMT_RCV_ID>12345678</SOLOPMT_RCV_ID>
<SOLOPMT_CUR>EUR</SOLOPMT_CUR>
<SOLOPMT_LANGUAGE>1</SOLOPMT_LANGUAGE>
<SOLOPMT_RCV_ACCOUNT/>
<SOLOPMT_REJECT>https://payment.checkout.fi/3xCDj1snWL/fi/reject</SOLOPMT_REJECT>
<SOLOPMT_CONFIRM>YES</SOLOPMT_CONFIRM>
<SOLOPMT_CANCEL>https://payment.checkout.fi/3xCDj1snWL/fi/back</SOLOPMT_CANCEL>
<SOLOPMT_RCV_NAME>Checkout Oy</SOLOPMT_RCV_NAME>
<SOLOPMT_DATE>EXPRESS</SOLOPMT_DATE>
<SOLOPMT_AMOUNT>65.00</SOLOPMT_AMOUNT>
<SOLOPMT_REF>43588631</SOLOPMT_REF>
<SOLOPMT_MSG>Testi Henkilö</SOLOPMT_MSG>
<SOLOPMT_MAC>9EE2A23AF88918BFCAA50DE88880280C</SOLOPMT_MAC>
<SOLOPMT_STAMP>3821058</SOLOPMT_STAMP>
<SOLOPMT_RETURN>https://payment.checkout.fi/3xCDj1snWL/fi/confirm</SOLOPMT_RETURN>
<SOLOPMT_KEYVERS>0001</SOLOPMT_KEYVERS>
</nordea>
<osuuspankki url="https://kultaraha.op.fi/cgi-bin/krcgi" icon="https://payment.checkout.fi/static/img/osuuspankki.png" name="Osuuspankki">
<VALUUTTALAJI>EUR</VALUUTTALAJI>
<VIITE>43588631</VIITE>
<MAKSUTUNNUS>3821058</MAKSUTUNNUS>
<action_id>701</action_id>
<MYYJA>Esittelymyyja</MYYJA>
<SUMMA>65.00</SUMMA>
<VIESTI>Testi Henkilö</VIESTI>
<TARKISTE>B6951EC4B7CC3F31C693351E08868545</TARKISTE>
<PALUU-LINKKI>https://payment.checkout.fi/3xCDj1snWL/fi/confirm</PALUU-LINKKI>
<VERSIO>1</VERSIO>
<TARKISTE-VERSIO>1</TARKISTE-VERSIO>
<VAHVISTUS>K</VAHVISTUS>
<PERUUTUS-LINKKI>https://payment.checkout.fi/3xCDj1snWL/fi/back</PERUUTUS-LINKKI>
</osuuspankki>
<samlink url="https://verkkomaksu.inetpankki.samlink.fi/vm/login.html" icon="https://payment.checkout.fi/static/img/sppopmaksu.gif" name="SP, Nooa, POP, Aktia">
<NET_VERSION>002</NET_VERSION>
<NET_SELLER_ID>0000000000</NET_SELLER_ID>
<NET_CUR>EUR</NET_CUR>
<NET_REJECT>https://payment.checkout.fi/3xCDj1snWL/fi/reject</NET_REJECT>
<NET_CONFIRM>YES</NET_CONFIRM>
<NET_CANCEL>https://payment.checkout.fi/3xCDj1snWL/fi/back</NET_CANCEL>
<NET_DATE>EXPRESS</NET_DATE>
<NET_AMOUNT>65,00</NET_AMOUNT>
<NET_REF>43588631</NET_REF>
<NET_MSG>Testi Henkilö</NET_MSG>
<NET_MAC>293305EFADD49443F9D3DF688237AF93</NET_MAC>
<NET_STAMP>3821058</NET_STAMP>
<NET_RETURN>https://payment.checkout.fi/3xCDj1snWL/fi/confirm</NET_RETURN>
</samlink>
<sampo url="https://verkkopankki.sampopankki.fi/SP/vemaha/VemahaApp" icon="https://payment.checkout.fi/static/img/sammon_verkkomaksu.gif" name="Sampo Pankki">
<SUMMA>65.00</SUMMA>
<VIITE>43588631</VIITE>
<KNRO>000000000000</KNRO>
<VALUUTTA>EUR</VALUUTTA>
<VERSIO>3</VERSIO>
<OKURL>https://payment.checkout.fi/3xCDj1snWL/fi/confirm?ORDER=3821058&amp;ORDERMAC=2662642DF9C2981C19106D1C3302BFAD</OKURL>
<VIRHEURL>https://payment.checkout.fi/3xCDj1snWL/fi/back</VIRHEURL>
<TARKISTE>efc9f89cccfd53506b8f317bb8e1ae79</TARKISTE>
<lng>1</lng>
</sampo>
<handelsbanken url="https://verkkomaksu.inetpankki.samlink.fi/vm/SHBlogin.html" icon="https://payment.checkout.fi/static/img/handelsbanken.gif" name="Handelsbanken">
<NET_VERSION>002</NET_VERSION>
<NET_SELLER_ID>0000000000</NET_SELLER_ID>
<NET_CUR>EUR</NET_CUR>
<NET_REJECT>https://payment.checkout.fi/3xCDj1snWL/fi/reject</NET_REJECT>
<NET_CONFIRM>YES</NET_CONFIRM>
<NET_CANCEL>https://payment.checkout.fi/3xCDj1snWL/fi/back</NET_CANCEL>
<NET_DATE>EXPRESS</NET_DATE>
<NET_AMOUNT>65,00</NET_AMOUNT>
<NET_REF>43588631</NET_REF>
<NET_MSG>Testi Henkilö</NET_MSG>
<NET_MAC>293305EFADD49443F9D3DF688237AF93</NET_MAC>
<NET_STAMP>3821058</NET_STAMP>
<NET_RETURN>https://payment.checkout.fi/3xCDj1snWL/fi/confirm</NET_RETURN>
</handelsbanken>
<spankki url="https://online.s-pankki.fi/service/paybutton" icon="https://payment.checkout.fi/static/img/S_Pankki_Green_78.gif" name="S-Pankki">
<AAB_VERSION>0002</AAB_VERSION>
<AAB_STAMP>3821058</AAB_STAMP>
<AAB_RCV_ID>SPANKKIESHOPID</AAB_RCV_ID>
<AAB_RCV_ACCOUNT>393900-01002369</AAB_RCV_ACCOUNT>
<AAB_RCV_NAME>CHECKOUT FINLAND OY</AAB_RCV_NAME>
<AAB_LANGUAGE>1</AAB_LANGUAGE>
<AAB_AMOUNT>65,00</AAB_AMOUNT>
<AAB_REF>43588631</AAB_REF>
<AAB_DATE>EXPRESS</AAB_DATE>
<AAB_MSG>Testi Henkilö</AAB_MSG>
<AAB_RETURN>https://payment.checkout.fi/3xCDj1snWL/fi/confirm</AAB_RETURN>
<AAB_CANCEL>https://payment.checkout.fi/3xCDj1snWL/fi/back</AAB_CANCEL>
<AAB_REJECT>https://payment.checkout.fi/3xCDj1snWL/fi/reject</AAB_REJECT>
<AAB_MAC>1CC537271ACF6FBBCAAECF871696F1C4</AAB_MAC>
<AAB_CONFIRM>YES</AAB_CONFIRM>
<AAB_KEYVERS>0001</AAB_KEYVERS>
<AAB_CUR>EUR</AAB_CUR>
</spankki>
<alandsbanken url="https://online.alandsbanken.fi/aab/ebank/auth/initLogin.do?BV_UseBVCookie=no" icon="https://payment.checkout.fi/static/img/alandsbanken.gif" name="Ålandsbanken">
<AAB_VERSION>0002</AAB_VERSION>
<AAB_STAMP>3821058</AAB_STAMP>
<AAB_RCV_ID>AABESHOPID</AAB_RCV_ID>
<AAB_RCV_ACCOUNT>660100-1130855</AAB_RCV_ACCOUNT>
<AAB_RCV_NAME>Checkout</AAB_RCV_NAME>
<AAB_LANGUAGE>1</AAB_LANGUAGE>
<AAB_AMOUNT>65,00</AAB_AMOUNT>
<AAB_REF>43588631</AAB_REF>
<AAB_DATE>EXPRESS</AAB_DATE>
<AAB_MSG>Testi Henkilö</AAB_MSG>
<AAB_RETURN>https://payment.checkout.fi/3xCDj1snWL/fi/confirm</AAB_RETURN>
<AAB_CANCEL>https://payment.checkout.fi/3xCDj1snWL/fi/back</AAB_CANCEL>
<AAB_REJECT>https://payment.checkout.fi/3xCDj1snWL/fi/reject</AAB_REJECT>
<AAB_MAC>61DE453D9346503E3298295A4E8717F0</AAB_MAC>
<AAB_CONFIRM>YES</AAB_CONFIRM>
<AAB_KEYVERS>0001</AAB_KEYVERS>
<AAB_CUR>EUR</AAB_CUR>
<BV_UseBVCookie>no</BV_UseBVCookie>
</alandsbanken>
<tapiola url="https://pankki.tapiola.fi/tap_bv/ebank/auth/initLogin.do" icon="https://payment.checkout.fi/static/img/tapiolan_verkkomaksu.gif" name="Tapiola Pankki">
<AAB_VERSION>0002</AAB_VERSION>
<AAB_STAMP>3821058</AAB_STAMP>
<AAB_RCV_ID>TAPESHOPID</AAB_RCV_ID>
<AAB_RCV_ACCOUNT>363630-01652643</AAB_RCV_ACCOUNT>
<AAB_RCV_NAME>Checkout</AAB_RCV_NAME>
<AAB_LANGUAGE>1</AAB_LANGUAGE>
<AAB_AMOUNT>65,00</AAB_AMOUNT>
<AAB_REF>43588631</AAB_REF>
<AAB_DATE>EXPRESS</AAB_DATE>
<AAB_MSG>Testi Henkilö</AAB_MSG>
<AAB_RETURN>https://payment.checkout.fi/3xCDj1snWL/fi/confirm</AAB_RETURN>
<AAB_CANCEL>https://payment.checkout.fi/3xCDj1snWL/fi/back</AAB_CANCEL>
<AAB_REJECT>https://payment.checkout.fi/3xCDj1snWL/fi/reject</AAB_REJECT>
<AAB_MAC>9EF87EB6D0DC0328519B7AA9B29DADC4</AAB_MAC>
<AAB_CONFIRM>YES</AAB_CONFIRM>
<AAB_KEYVERS>0001</AAB_KEYVERS>
<AAB_CUR>EUR</AAB_CUR>
<BV_UseBVCookie>NO</BV_UseBVCookie>
</tapiola>
<neopay url="https://www.neocard.fi/neopay11/" icon="https://payment.checkout.fi/static/img/logo_neo_maksuominaisuus.gif" name="Neocard">
<terminal_identifier>999</terminal_identifier>
<business_code>1234567-4</business_code>
<timestamp>20120825040836</timestamp>
<amount_to_debit>6500</amount_to_debit>
<order_info>Testi Henkilö</order_info>
<success_url>https://payment.checkout.fi/3xCDj1snWL/fi/confirm?p=4358863&amp;t=3821058&amp;amount=6500</success_url>
<failure_url>https://payment.checkout.fi/3xCDj1snWL/fi/back</failure_url>
<cancel_url>https://payment.checkout.fi/3xCDj1snWL/fi/reject</cancel_url>
<checksum>cef67d792662f5a95a766a6b259f181f</checksum>
</neopay>
<tilisiirto url="https://payment.checkout.fi/3xCDj1snWL/fi/tilisiirto" icon="https://payment.checkout.fi/static/img/tilisiirto.gif" name="Tilisiirto">
<bank>Nordea</bank>
<iban>FI06 1146 3001 1145 34</iban>
<bic>NDEAFIHH</bic>
<reference>43588631</reference>
<amount>6500</amount>
<receiver>Checkout Finland Oy</receiver>
</tilisiirto>
<ape url="https://payment.checkout.fi/3xCDj1snWL/fi/wallet" icon="https://payment.checkout.fi/static/img/ape_logo_64x64.png" name="APE Kukkaro">
<merchant>checkout</merchant>
<item>43588631</item>
<price>65.00</price>
<mac>2043fd7d763519a0badd05dad4b0a639</mac>
</ape>
</banks>
</payment>
</payments>
</trade>
\ No newline at end of file
package fi.insomnia.bortal.checkoutfi;
public enum CheckoutFiParam {
// DO NOT CHANGE THE ORDER OF THESE!
// The md5 checksum is calculated from
// these values...
VERSION("0001"),
STAMP(null),
AMOUNT(null),
REFERENCE(null),
MESSAGE(null),
LANGUAGE("FI"),
MERCHANT(null),
RETURN(null),
CANCEL(null),
REJECT(null),
DELAYED(null),
COUNTRY("FIN"),
CURRENCY("EUR"),
DEVICE("10"),
CONTENT("1"),
TYPE("0"),
ALGORITHM("2"),
DELIVERY_DATE(null),
FIRSTNAME(null),
FAMILYNAME(null),
ADDRESS(null),
POSTCODE(null),
POSTOFFICE(null), ;
private final String defaultValue;
private CheckoutFiParam(String def) {
defaultValue = def;
}
public String getDefaultValue() {
return defaultValue;
}
}
package fi.insomnia.bortal.facade; package fi.insomnia.bortal.facade;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.ejb.EJB; import javax.ejb.EJB;
...@@ -14,6 +16,7 @@ import fi.insomnia.bortal.model.AccountEvent; ...@@ -14,6 +16,7 @@ import fi.insomnia.bortal.model.AccountEvent;
import fi.insomnia.bortal.model.AccountEvent_; import fi.insomnia.bortal.model.AccountEvent_;
import fi.insomnia.bortal.model.EventUser; import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.model.LanEvent; import fi.insomnia.bortal.model.LanEvent;
import fi.insomnia.bortal.model.Product;
import fi.insomnia.bortal.model.Product_; import fi.insomnia.bortal.model.Product_;
import fi.insomnia.bortal.model.Role; import fi.insomnia.bortal.model.Role;
import fi.insomnia.bortal.model.Role_; import fi.insomnia.bortal.model.Role_;
...@@ -59,4 +62,33 @@ public class AccountEventFacade extends IntegerPkGenericFacade<AccountEvent> { ...@@ -59,4 +62,33 @@ public class AccountEventFacade extends IntegerPkGenericFacade<AccountEvent> {
); );
return getEm().createQuery(cq).getResultList(); return getEm().createQuery(cq).getResultList();
} }
public BigDecimal getProductCount(List<Product> list) {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<BigDecimal> cq = cb.createQuery(BigDecimal.class);
Root<AccountEvent> root = cq.from(AccountEvent.class);
List<Integer> ids = new ArrayList<Integer>();
for (Product l : list) {
ids.add(l.getId());
}
cq.where(root.get(AccountEvent_.product).get(Product_.id).in(ids));
cq.select(cb.sum(root.get(AccountEvent_.quantity)));
return super.getSingleNullableResult(getEm().createQuery(cq));
}
public BigDecimal getProductCount(List<Product> list, EventUser eventuser) {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<BigDecimal> cq = cb.createQuery(BigDecimal.class);
Root<AccountEvent> root = cq.from(AccountEvent.class);
List<Integer> ids = new ArrayList<Integer>();
for (Product l : list) {
ids.add(l.getId());
}
cq.where(root.get(AccountEvent_.product).get(Product_.id).in(ids),
cb.equal(root.get(AccountEvent_.user), eventuser));
cq.select(cb.sum(root.get(AccountEvent_.quantity)));
return super.getSingleNullableResult(getEm().createQuery(cq));
}
} }
...@@ -64,4 +64,5 @@ public class BillFacade extends IntegerPkGenericFacade<Bill> { ...@@ -64,4 +64,5 @@ public class BillFacade extends IntegerPkGenericFacade<Bill> {
return getEm().createQuery(cq).getResultList(); return getEm().createQuery(cq).getResultList();
} }
} }
...@@ -18,7 +18,9 @@ import fi.insomnia.bortal.bortal.views.BillSummary; ...@@ -18,7 +18,9 @@ import fi.insomnia.bortal.bortal.views.BillSummary;
import fi.insomnia.bortal.model.BillLine; import fi.insomnia.bortal.model.BillLine;
import fi.insomnia.bortal.model.BillLine_; import fi.insomnia.bortal.model.BillLine_;
import fi.insomnia.bortal.model.Bill_; import fi.insomnia.bortal.model.Bill_;
import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.model.LanEvent; import fi.insomnia.bortal.model.LanEvent;
import fi.insomnia.bortal.model.Product;
@Stateless @Stateless
@LocalBean @LocalBean
...@@ -53,4 +55,39 @@ public class BillLineFacade extends IntegerPkGenericFacade<BillLine> { ...@@ -53,4 +55,39 @@ public class BillLineFacade extends IntegerPkGenericFacade<BillLine> {
} }
return retmap.values(); return retmap.values();
} }
public BillSummary getLineSummary(Product list, LanEvent event) {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<BillLine> cq = cb.createQuery(BillLine.class);
Root<BillLine> root = cq.from(BillLine.class);
cq.where(cb.equal(root.get(BillLine_.bill).get(Bill_.event), event),
cb.equal(root.get(BillLine_.lineProduct), list));
List<BillLine> lines = getEm().createQuery(cq).getResultList();
BillSummary ret = new BillSummary(list.getName());
for (BillLine bl : lines) {
ret.addLine(bl);
}
return ret;
}
public BillSummary getLineSummary(Product list, LanEvent event, EventUser user) {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<BillLine> cq = cb.createQuery(BillLine.class);
Root<BillLine> root = cq.from(BillLine.class);
cq.where(cb.equal(root.get(BillLine_.bill).get(Bill_.event), event),
cb.equal(root.get(BillLine_.lineProduct), list),
cb.equal(root.get(BillLine_.bill).get(Bill_.user), user)
);
List<BillLine> lines = getEm().createQuery(cq).getResultList();
BillSummary ret = new BillSummary(list.getName());
for (BillLine bl : lines) {
ret.addLine(bl);
}
return ret;
}
} }
...@@ -54,13 +54,13 @@ public class SitePageFacade extends IntegerPkGenericFacade<SitePage> { ...@@ -54,13 +54,13 @@ public class SitePageFacade extends IntegerPkGenericFacade<SitePage> {
Path<SitePage> parentpath = root.get(SitePage_.parent); Path<SitePage> parentpath = root.get(SitePage_.parent);
Predicate rootpred = null; Predicate rootpred = null;
if (parentpath == null) if (siteroot == null)
{ {
rootpred = cb.isNull(parentpath); rootpred = cb.isNull(parentpath);
} }
else else
{ {
rootpred = cb.equal(parentpath, parentpath); rootpred = cb.equal(parentpath, siteroot);
} }
cq.where( cq.where(
......
package fi.insomnia.bortal.beans;
import java.util.List;
import javax.ejb.Local;
import fi.insomnia.bortal.model.Bill;
import fi.insomnia.bortal.util.CheckoutBank;
import fi.insomnia.bortal.util.CheckoutReturnType;
@Local
public interface CheckoutFiBeanLocal {
boolean isPaymentEnabled();
List<CheckoutBank> getToken(Bill bill);
// List<CheckoutBank> testXml();
boolean validateReturn(CheckoutReturnType returnType, String version, String stamp, String reference, String payment, String status, String algorithm, String mac);
}
...@@ -9,8 +9,8 @@ import fi.insomnia.bortal.model.User; ...@@ -9,8 +9,8 @@ import fi.insomnia.bortal.model.User;
@Local @Local
public interface LoggingBeanLocal { public interface LoggingBeanLocal {
LogEntry logMessage(SecurityLogType paramType, User user, String... description); LogEntry logMessage(SecurityLogType paramType, User user, Object... description);
LogEntry logMessage(SecurityLogType paramType, EventUser user, String... description); LogEntry logMessage(SecurityLogType paramType, EventUser user, Object... description);
} }
...@@ -2,7 +2,9 @@ package fi.insomnia.bortal.beans; ...@@ -2,7 +2,9 @@ package fi.insomnia.bortal.beans;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.ejb.Local; import javax.ejb.Local;
...@@ -11,14 +13,13 @@ import fi.insomnia.bortal.model.Discount; ...@@ -11,14 +13,13 @@ import fi.insomnia.bortal.model.Discount;
import fi.insomnia.bortal.model.EventUser; import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.model.Product; import fi.insomnia.bortal.model.Product;
import fi.insomnia.bortal.model.ProductFlag; import fi.insomnia.bortal.model.ProductFlag;
import fi.insomnia.bortal.model.Role;
@Local @Local
public interface ProductBeanLocal { public interface ProductBeanLocal {
List<Product> listUserShoppableProducts(); List<Product> listUserShoppableProducts();
List<Product> findProductsByFlag(ProductFlag ... productFlags); List<Product> findProductsByFlag(ProductFlag... productFlags);
void create(Product prod); void create(Product prod);
...@@ -43,5 +44,9 @@ public interface ProductBeanLocal { ...@@ -43,5 +44,9 @@ public interface ProductBeanLocal {
Discount save(Discount discount); Discount save(Discount discount);
BigDecimal calculateTotal(Product product, BigDecimal quantity, Calendar date); 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);
} }
...@@ -28,4 +28,6 @@ public interface SitePageBeanLocal { ...@@ -28,4 +28,6 @@ public interface SitePageBeanLocal {
List<PageContent> findContentsForUser(String name); List<PageContent> findContentsForUser(String name);
SitePage findSitename(String managedPage);
} }
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;
public class Valuepair {
private String key;
private String value;
public String toString()
{
return new StringBuilder("Valuepair ").append(key).append(" ").append(value).toString();
}
public Valuepair(String paramName, String paramValue) {
key = paramName;
value = paramValue;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
...@@ -5,6 +5,9 @@ public enum LanEventPrivatePropertyKey { ...@@ -5,6 +5,9 @@ public enum LanEventPrivatePropertyKey {
VERKKOMAKSU_KEY_EXPIRE(Type.DATE, null), VERKKOMAKSU_KEY_EXPIRE(Type.DATE, null),
VERKKOMAKSU_MERCHANT_ID(Type.TEXT, null), VERKKOMAKSU_MERCHANT_ID(Type.TEXT, null),
VERKKOMAKSU_MERCHANT_PASSWORD(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 { private enum Type {
......
...@@ -6,7 +6,7 @@ import javax.annotation.Generated; ...@@ -6,7 +6,7 @@ import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel; import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2012-08-23T03:32:15.378+0300") @Generated(value="Dali", date="2012-08-25T03:50:15.426+0300")
@StaticMetamodel(LanEventPrivateProperty.class) @StaticMetamodel(LanEventPrivateProperty.class)
public class LanEventPrivateProperty_ extends GenericEntity_ { public class LanEventPrivateProperty_ extends GenericEntity_ {
public static volatile SingularAttribute<LanEventPrivateProperty, EventOrganiser> eventorg; public static volatile SingularAttribute<LanEventPrivateProperty, EventOrganiser> eventorg;
......
...@@ -76,6 +76,9 @@ public class Product extends GenericEntity { ...@@ -76,6 +76,9 @@ public class Product extends GenericEntity {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "product") @OneToMany(cascade = CascadeType.ALL, mappedBy = "product")
private List<Place> places; private List<Place> places;
@ManyToMany()
private List<ProductLimitation> productLimits;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "product") @OneToMany(cascade = CascadeType.ALL, mappedBy = "product")
private List<AccountEvent> accountEvents; private List<AccountEvent> accountEvents;
...@@ -262,4 +265,12 @@ public class Product extends GenericEntity { ...@@ -262,4 +265,12 @@ public class Product extends GenericEntity {
this.productFlags = productFlags; this.productFlags = productFlags;
} }
public List<ProductLimitation> getProductLimits() {
return productLimits;
}
public void setProductLimits(List<ProductLimitation> productLimits) {
this.productLimits = productLimits;
}
} }
package fi.insomnia.bortal.model;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
@Entity
@Table(name = "product_limitations")
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class ProductLimitation extends GenericEntity {
/**
*
*/
private static final long serialVersionUID = 1373535658851118597L;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private ProductLimitationType type;
@Column(nullable = false)
private boolean last = false;
private String name;
@Lob
private String description;
@Column(nullable = false)
private Integer sort = 100;
@ManyToMany(mappedBy = "productLimits")
private List<Product> products;
@Column(nullable = true, precision = 24, scale = 4)
private BigDecimal upperLimit;
@Column(nullable = true, precision = 24, scale = 4)
private BigDecimal lowerLimit;
@ManyToMany()
private List<Role> matchingRoles;
public ProductLimitationType getType() {
return type;
}
public void setType(ProductLimitationType type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public List<Product> getProducts() {
return products;
}
public void setProducts(List<Product> products) {
this.products = products;
}
public BigDecimal getUpperLimit() {
return upperLimit;
}
public void setUpperLimit(BigDecimal upperLimit) {
this.upperLimit = upperLimit;
}
public BigDecimal getLowerLimit() {
return lowerLimit;
}
public void setLowerLimit(BigDecimal lowerLimit) {
this.lowerLimit = lowerLimit;
}
public List<Role> getMatchingRoles() {
return matchingRoles;
}
public void setMatchingRoles(List<Role> matchingRoles) {
this.matchingRoles = matchingRoles;
}
}
package fi.insomnia.bortal.model;
public enum ProductLimitationType {
GLOBAL_BILLED, GLOBAL_BILL_PAID, GLOBAL_ACCOUNTEVENTS, USER_BILLED, USER_BILL_PAID, USER_ACCOUNTEVENTS,
}
package fi.insomnia.bortal.model;
import java.math.BigDecimal;
import javax.annotation.Generated;
import javax.persistence.metamodel.ListAttribute;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2012-09-05T23:16:12.829+0300")
@StaticMetamodel(ProductLimitation.class)
public class ProductLimitation_ extends GenericEntity_ {
public static volatile SingularAttribute<ProductLimitation, ProductLimitationType> type;
public static volatile SingularAttribute<ProductLimitation, Boolean> last;
public static volatile SingularAttribute<ProductLimitation, String> name;
public static volatile SingularAttribute<ProductLimitation, String> description;
public static volatile SingularAttribute<ProductLimitation, Integer> sort;
public static volatile ListAttribute<ProductLimitation, Product> products;
public static volatile SingularAttribute<ProductLimitation, BigDecimal> upperLimit;
public static volatile SingularAttribute<ProductLimitation, BigDecimal> lowerLimit;
public static volatile ListAttribute<ProductLimitation, Role> matchingRoles;
}
...@@ -7,7 +7,7 @@ import javax.persistence.metamodel.SetAttribute; ...@@ -7,7 +7,7 @@ import javax.persistence.metamodel.SetAttribute;
import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel; import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2012-08-24T01:13:32.136+0300") @Generated(value="Dali", date="2012-09-05T21:51:25.846+0300")
@StaticMetamodel(Product.class) @StaticMetamodel(Product.class)
public class Product_ extends GenericEntity_ { public class Product_ extends GenericEntity_ {
public static volatile SingularAttribute<Product, LanEvent> event; public static volatile SingularAttribute<Product, LanEvent> event;
...@@ -19,6 +19,7 @@ public class Product_ extends GenericEntity_ { ...@@ -19,6 +19,7 @@ public class Product_ extends GenericEntity_ {
public static volatile SetAttribute<Product, ProductFlag> productFlags; public static volatile SetAttribute<Product, ProductFlag> productFlags;
public static volatile SingularAttribute<Product, Role> provides; public static volatile SingularAttribute<Product, Role> provides;
public static volatile ListAttribute<Product, Place> places; public static volatile ListAttribute<Product, Place> places;
public static volatile ListAttribute<Product, ProductLimitation> productLimits;
public static volatile ListAttribute<Product, AccountEvent> accountEvents; public static volatile ListAttribute<Product, AccountEvent> accountEvents;
public static volatile ListAttribute<Product, Discount> discounts; public static volatile ListAttribute<Product, Discount> discounts;
public static volatile SingularAttribute<Product, BigDecimal> vat; public static volatile SingularAttribute<Product, BigDecimal> vat;
......
...@@ -7,7 +7,6 @@ import javax.inject.Named; ...@@ -7,7 +7,6 @@ import javax.inject.Named;
import javax.resource.spi.IllegalStateException; import javax.resource.spi.IllegalStateException;
import fi.insomnia.bortal.beans.SalesEntitySessionBeanLocal; import fi.insomnia.bortal.beans.SalesEntitySessionBeanLocal;
import fi.insomnia.bortal.beans.SalespointContainerBeanLocal;
import fi.insomnia.bortal.salespoint.CartItem; import fi.insomnia.bortal.salespoint.CartItem;
import fi.insomnia.bortal.salespoint.SalespointSessionManager; import fi.insomnia.bortal.salespoint.SalespointSessionManager;
...@@ -15,24 +14,24 @@ import fi.insomnia.bortal.salespoint.SalespointSessionManager; ...@@ -15,24 +14,24 @@ import fi.insomnia.bortal.salespoint.SalespointSessionManager;
public class CartView extends AbstractView { public class CartView extends AbstractView {
private static final long serialVersionUID = 9041477262092320847L; private static final long serialVersionUID = 9041477262092320847L;
@EJB @EJB
SalesEntitySessionBeanLocal sessionBean; private transient SalesEntitySessionBeanLocal sessionBean;
public CartItem[] getItems() throws IllegalStateException { public CartItem[] getItems() throws IllegalStateException {
SalespointSessionManager sessionManager = sessionBean.getSessionManager(); SalespointSessionManager sessionManager = sessionBean.getSessionManager();
return new CartItem[] { new CartItem(), new CartItem() }; return new CartItem[] { new CartItem(), new CartItem() };
} }
public BigDecimal getTotal() throws IllegalStateException { public BigDecimal getTotal() throws IllegalStateException {
CartItem[] cartItems = getItems(); CartItem[] cartItems = getItems();
BigDecimal result = new BigDecimal(0); BigDecimal result = new BigDecimal(0);
for (int i = 0; i < cartItems.length; i++) { for (int i = 0; i < cartItems.length; i++) {
result = result.add(cartItems[i].getTotal()); result = result.add(cartItems[i].getTotal());
} }
return result; return result;
} }
} }
...@@ -14,14 +14,14 @@ import fi.insomnia.bortal.beans.PermissionBeanLocal; ...@@ -14,14 +14,14 @@ import fi.insomnia.bortal.beans.PermissionBeanLocal;
@Named @Named
@RequestScoped @RequestScoped
public class TestView implements Serializable { public class TestView implements Serializable {
private static final long serialVersionUID = -2872232867536069020L; private static final long serialVersionUID = -2872232867536069020L;
private static final Logger logger = LoggerFactory.getLogger(TestView.class); private static final Logger logger = LoggerFactory.getLogger(TestView.class);
@EJB @EJB
private PermissionBeanLocal permissionBean; private transient PermissionBeanLocal permissionBean;
public String getPrincipal() { public String getPrincipal() {
logger.debug("PermissionBean: {}", permissionBean); logger.debug("PermissionBean: {}", permissionBean);
return permissionBean.getPrincipal(); return permissionBean.getPrincipal();
......
...@@ -6,6 +6,7 @@ import java.security.NoSuchAlgorithmException; ...@@ -6,6 +6,7 @@ import java.security.NoSuchAlgorithmException;
import java.util.Random; import java.util.Random;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.Hex;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -18,6 +19,47 @@ public class PasswordFunctions { ...@@ -18,6 +19,47 @@ public class PasswordFunctions {
private static final boolean UGLY_FIX = true; private static final boolean UGLY_FIX = true;
/**
* Returns the MD5 sum of the @param fields separated by @param separator e
* eg separator = "+" fields {"ONE", "TWO", "THREE"} return value
* ONE+TWO+THREE
*
* @param separator
* @param fields
* @return
*/
public static String calculateMd5(String separator, String... fields)
{
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String field : fields)
{
if (first) {
first = false;
} else {
sb.append(separator);
}
sb.append(field);
}
logger.info("Calculating md5 from {}", sb.toString());
return calculateMd5(sb.toString());
}
public static String calculateMd5(String str)
{
String ret = null;
try {
final MessageDigest algo = MessageDigest.getInstance("MD5");
final byte[] resultByte = algo.digest(str.getBytes());
ret = new String(Hex.encodeHex(resultByte)).toUpperCase();
} catch (NoSuchAlgorithmException e) {
logger.warn("THIS SHOULD NEVER HAPPEN! (md5 hashfunction should always exist)", e);
}
return ret;
}
public static String getEncryptedPassword(String password) { public static String getEncryptedPassword(String password) {
byte[] salt = new byte[SALT_LENGTH]; byte[] salt = new byte[SALT_LENGTH];
Random random = new Random(); Random random = new Random();
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
</session-config> </session-config>
<context-param> <context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name> <param-name>javax.faces.PROJECT_STAGE</param-name>
<!-- <param-value>Production</param-value> --> <param-value>Production</param-value>
<param-value>Development</param-value> <!-- <param-value>Development</param-value> -->
</context-param> </context-param>
<context-param> <context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name> <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
......
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
<bill:showBill bill="#{billEditView.bill}" /> <bill:showBill bill="#{billEditView.bill}" />
<ui:fragment rendered="#{!billEditView.bill.paid and billEditView.verkkomaksuAvailable}"> <ui:fragment rendered="#{!billEditView.bill.paid and billEditView.verkkomaksuFiAvailable}">
<div id="svm-payment"> <div id="svm-payment">
<a href="#{billEditView.verkkomaksuToken.url}"> </a> <a href="#{billEditView.verkkomaksuFiToken.url}"> </a>
</div> </div>
<script type="text/javascript" src="//payment.verkkomaksut.fi/js/sv-widget.min.js"></script> <script type="text/javascript" src="//payment.verkkomaksut.fi/js/sv-widget.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
......
<!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:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:f="http://java.sun.com/jsf/core">
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata>
<f:viewParam name="VERSION" value="#{checkoutView.version}" />
<f:viewParam name="STAMP" value="#{checkoutView.stamp}" />
<f:viewParam name="REFERENCE" value="#{checkoutView.reference}" />
<f:viewParam name="PAYMENT" value="#{checkoutView.payment}" />
<f:viewParam name="STATUS" value="#{checkoutView.status}" />
<f:viewParam name="ALGORITHM" value="#{checkoutView.algorithm}" />
<f:viewParam name="MAC" value="#{checkoutView.mac}" />
<f:event type="preRenderView" listener="#{checkoutView.validateCancel}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['page.checkout.cancel.header']}</h1>
</ui:define>
<ui:define name="content">
<p>
<h:outputText rendered="#{checkoutView.validationResult}" value="#{i18n['checkout.cancel.successMessage']}" />
<h:outputText rendered="#{!checkoutView.validationResult}" value="#{i18n['checkout.cancel.errorMessage']}" />
</p>
</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:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:f="http://java.sun.com/jsf/core">
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata>
<f:viewParam name="VERSION" value="#{checkoutView.version}" />
<f:viewParam name="STAMP" value="#{checkoutView.stamp}" />
<f:viewParam name="PAYMENT" value="#{checkoutView.payment}" />
<f:viewParam name="STATUS" value="#{checkoutView.status}" />
<f:viewParam name="MAC" value="#{checkoutView.mac}" />
<f:event type="preRenderView" listener="#{checkoutView.validateDelayed}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['page.checkout.delayed.header']}</h1>
</ui:define>
<ui:define name="content">
<p>
<h:outputText rendered="#{checkoutView.validationResult}" value="#{i18n['checkout.return.successDelayed']}" />
<h:outputText rendered="#{!checkoutView.validationResult}" value="#{i18n['checkout.return.errorDelayed']}" />
</p>
</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:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:f="http://java.sun.com/jsf/core">
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata>
<f:viewParam name="VERSION" value="#{checkoutView.version}" />
<f:viewParam name="STAMP" value="#{checkoutView.stamp}" />
<f:viewParam name="PAYMENT" value="#{checkoutView.payment}" />
<f:viewParam name="STATUS" value="#{checkoutView.status}" />
<f:viewParam name="MAC" value="#{checkoutView.mac}" />
<f:event type="preRenderView" listener="#{checkoutView.validateReject}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['page.checkout.reject.header']}</h1>
</ui:define>
<ui:define name="content">
<p>
<h:outputText rendered="#{checkoutView.validationResult}" value="#{i18n['checkout.reject.successMessage']}" />
<h:outputText rendered="#{!checkoutView.validationResult}" value="#{i18n['checkout.reject.errorMessage']}" />
</p>
</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:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:f="http://java.sun.com/jsf/core">
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata>
<f:viewParam name="VERSION" value="#{checkoutView.version}" />
<f:viewParam name="STAMP" value="#{checkoutView.stamp}" />
<f:viewParam name="PAYMENT" value="#{checkoutView.payment}" />
<f:viewParam name="STATUS" value="#{checkoutView.status}" />
<f:viewParam name="REFERENCE" value="#{checkoutView.reference}" />
<f:viewParam name="ALGORITHM" value="#{checkoutView.algorithm}" />
<f:viewParam name="MAC" value="#{checkoutView.mac}" />
<f:event type="preRenderView" listener="#{checkoutView.validateReturn}" />
</f:metadata>
<ui:define name="title">
<h1>#{i18n['page.checkout.return.header']}</h1>
</ui:define>
<ui:define name="content">
<p>
<h:outputText rendered="#{checkoutView.validationResult}" value="#{i18n['checkout.return.successMessage']}" />
<h:outputText rendered="#{!checkoutView.validationResult}" value="#{i18n['checkout.return.errorMessage']}" />
</p>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
<h:message for="propval" /> <h:message for="propval" />
</h:form> </h:form>
<h:form rendered="#{!empty eventPropertyView.property}"> <h:form rendered="#{!empty eventPropertyView.property}" enctype="multipart/form-data">
<h:panelGrid columns="3"> <h:panelGrid columns="3">
<h:outputLabel for="key" value="#{i18n['lanEventProperty.key']}" /> <h:outputLabel for="key" value="#{i18n['lanEventProperty.key']}" />
<h:outputText value="#{eventPropertyView.property.key}" id="key" /> <h:outputText value="#{eventPropertyView.property.key}" id="key" />
...@@ -111,9 +111,14 @@ ...@@ -111,9 +111,14 @@
<h:outputText id="defaultval" value="#{eventPropertyView.property.key.defaultvalue}" /> <h:outputText id="defaultval" value="#{eventPropertyView.property.key.defaultvalue}" />
<h:message for="defaultval" /> <h:message for="defaultval" />
<h:outputLabel rendered="#{eventPropertyView.property.key.text}" for="textval" value="#{i18n['lanEventProperty.textValue']}" /> <h:outputLabel rendered="#{eventPropertyView.property.key.text or eventPropertyView.property.key.data }" for="textval" value="#{i18n['lanEventProperty.textValue']}" />
<h:inputText rendered="#{eventPropertyView.property.key.text}" id="textval" value="#{eventPropertyView.property.textvalue}" /> <h:inputText rendered="#{eventPropertyView.property.key.text or eventPropertyView.property.key.data}" id="textval" value="#{eventPropertyView.property.textvalue}" />
<h:message rendered="#{eventPropertyView.property.key.text}" for="textval" /> <h:message rendered="#{eventPropertyView.property.key.text or eventPropertyView.property.key.data}" for="textval" />
<h:outputLabel rendered="#{eventPropertyView.property.key.data}" for="dataval" value="#{i18n['lanEventProperty.textValue']}" />
<p:fileUpload rendered="#{ eventPropertyView.property.key.data}" mode="simple" value="#{eventPropertyView.file}" id="dataval" />
<h:message rendered="#{eventPropertyView.property.key.data}" for="dataval" />
<h:outputLabel rendered="#{eventPropertyView.property.key.date}" for="textval" value="#{i18n['lanEventProperty.textValue']}" /> <h:outputLabel rendered="#{eventPropertyView.property.key.date}" for="textval" value="#{i18n['lanEventProperty.textValue']}" />
<p:calendar rendered="#{eventPropertyView.property.key.date}" value="#{eventPropertyView.property.dateValue}" pattern="#{sessionHandler.datetimeFormat}" /> <p:calendar rendered="#{eventPropertyView.property.key.date}" value="#{eventPropertyView.property.dateValue}" pattern="#{sessionHandler.datetimeFormat}" />
......
...@@ -13,6 +13,13 @@ ...@@ -13,6 +13,13 @@
Development-tilassa. Development-tilassa.
Vaihda web.xml-tiedostosta ohjelman tila (javax.faces.PROJECT_STAGE) Productioniksi ennen kuin julkaiset ohjelman tuotantoon. Vaihda web.xml-tiedostosta ohjelman tila (javax.faces.PROJECT_STAGE) Productioniksi ennen kuin julkaiset ohjelman tuotantoon.
</h:outputLabel> </h:outputLabel>
<ui:fragment rendered="#{layoutView.manageContent}">
<h:link value="#{i18n['layout.editContent']}" outcome="/pages/manage">
<f:param name="pagename" value="#{layoutView.pagepath}" />
</h:link>
<br />
</ui:fragment>
<ui:repeat var="cont1" value="#{pageOutputView.contents}"> <ui:repeat var="cont1" value="#{pageOutputView.contents}">
<h:outputText value="#{cont1.content}" escape="false" /> <h:outputText value="#{cont1.content}" escape="false" />
</ui:repeat> </ui:repeat>
......
<?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" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:tools="http://java.sun.com/jsf/composite/cditools" <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/cditools"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core"> xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html" locale="#{sessionHandler.locale}"> <f:view contentType="text/html" locale="#{sessionHandler.locale}">
<h:head> <h:head>
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/style/insomnia2/css/tyyli.css" /> <link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/style/insomnia2/css/tyyli.css" />
<ui:insert name="headerdata" /> <ui:insert name="headerdata" />
</h:head> </h:head>
<h:body> <h:body>
...@@ -25,8 +25,14 @@ ...@@ -25,8 +25,14 @@
<img src="#{request.contextPath}/resources/style/insomnia2/img/devel_logo.png" /> <img src="#{request.contextPath}/resources/style/insomnia2/img/devel_logo.png" />
</c:when> </c:when>
<c:otherwise> <c:otherwise>
<!-- <img src="#{request.contextPath}/resources/style/insomnia2/img/logo.png" /> --> <p:graphicImage rendered="#{!empty layoutView.headerimage}" value="#{layoutView.headerimage}" />
<h1>STREAM INTRA</h1> <ui:fragment rendered="#{empty layoutView.headerimage}">
<h1>
<h:outputText value="#{layoutView.headertext}" />
</h1>
</ui:fragment>
<!-- <img src="#{request.contextPath}/resources/style/insomnia2/img/logo.png" />
<h1>STREAM INTRA</h1> -->
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
</h:link> </h:link>
...@@ -55,6 +61,9 @@ ...@@ -55,6 +61,9 @@
styleClass="#{menuitem.selected?'active':''}" /></li> styleClass="#{menuitem.selected?'active':''}" /></li>
</ul> </ul>
</div> </div>
<h:link rendered="#{layoutView.manageContent}" styleClass="editorlink" value="#{i18n['layout.editTop']}" outcome="/pages/manage">
<f:param name="pagename" value="#{layoutView.pagepath}:top" />
</h:link>
<div id="container" class="top" /> <div id="container" class="top" />
<div id="container" class="clearfix"> <div id="container" class="clearfix">
<ui:fragment rendered="#{menuView.getMenu(2).size() > 1}"> <ui:fragment rendered="#{menuView.getMenu(2).size() > 1}">
...@@ -81,6 +90,9 @@ ...@@ -81,6 +90,9 @@
</div> </div>
</div> </div>
<h:link rendered="#{layoutView.manageContent}" styleClass="editorlink" value="#{i18n['layout.editBottom']}" outcome="/pages/manage">
<f:param name="pagename" value="#{layoutView.pagepath}:bottom" />
</h:link>
<div id="container" class="bottom"></div> <div id="container" class="bottom"></div>
</div> </div>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</f:metadata> </f:metadata>
<ui:param name="thispage" value="page.role.edit" /> <ui:param name="thispage" value="page.role.edit" />
<ui:define name="content"> <ui:define name="content">
<map:edit commitaction="#{mapManageView.saveMap()}" commitvalue="#{i18n['mapEdit.save']}" /> <map:edit commitaction="#{mapManageView.saveMap()}" commitvalue="#{i18n['mapedit.save']}" />
<map:setBuyable /> <map:setBuyable />
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</f:metadata> </f:metadata>
<ui:define name="content"> <ui:define name="content">
<pages:edit commitaction="#{sitePageView.createSite()}" commitvalue="#{i18n['sitepage.create']}" /> <pages:edit commitaction="#{sitePageView.saveSite()}" commitvalue="#{i18n['sitepage.create']}" />
</ui:define> </ui:define>
......
<!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:pages="http://java.sun.com/jsf/composite/cditools/pages" xmlns:c="http://java.sun.com/jsp/jstl/core"
>
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata>
<f:viewParam name="pagename" value="#{sitePageView.managedPage}" />
<f:event type="preRenderView" listener="#{sitePageView.initManage}" />
</f:metadata>
<ui:define name="content">
<pages:edit commitaction="#{sitePageView.saveSite()}" commitvalue="#{i18n['sitepage.save']}" />
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
<p><input type="hidden" name="id" value="#{mapManageView.map.id}" /></p> <p><input type="hidden" name="id" value="#{mapManageView.map.id}" /></p>
<h:panelGrid columns="2"> <h:panelGrid columns="2">
<h:outputLabel value="#{i18n['setBuyable.like']}" /> <h:outputLabel value="#{i18n['eventmap.buyable.like']}" />
<h:inputText value="#{mapManageView.buyableLike}" /> <h:inputText value="#{mapManageView.buyableLike}" />
<h:commandButton id="lockbtn" action="#{mapManageView.lockBuyable}" value="#{i18n['setBuyable.lock']}" /> <h:commandButton id="lockbtn" action="#{mapManageView.lockBuyable}" value="#{i18n['eventmap.buyable.lock']}" />
<h:commandButton id="releasebtn" action="#{mapManageView.releaseBuyable}" value="#{i18n['setBuyable.release']}" /> <h:commandButton id="releasebtn" action="#{mapManageView.releaseBuyable}" value="#{i18n['eventmap.buyable.release']}" />
</h:panelGrid> </h:panelGrid>
</h:form> </h:form>
......
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
<div style="margin-top: 5px;"> <div style="margin-top: 5px;">
<h:commandButton action="#{cc.attrs.commitaction}" id="commitbutton-top" value="#{cc.attrs.commitValue}" /> <h:commandButton action="#{cc.attrs.commitaction}" id="commitbutton-top" value="#{cc.attrs.commitValue}" />
</div> </div>
<h:dataTable styleClass="bordertable" id="billcart" value="#{cc.attrs.items}" var="cart"> <h:dataTable columnClasses=",numalign,numalign,,numalign" styleClass="bordertable" id="billcart" value="#{cc.attrs.items}" var="cart">
<h:column> <h:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText id="name" value="${i18n['product.name']}" /> <h:outputText id="name" value="${i18n['product.name']}" />
</f:facet> </f:facet>
<h:outputText value="#{cart.product.name}" /> <h:outputText value="#{cart.product.name}" />
</h:column> </h:column>
<h:column> <h:column >
<f:facet name="header"> <f:facet name="header">
<h:outputText value="${i18n['product.price']}" /> <h:outputText value="${i18n['product.price']}" />
</f:facet> </f:facet>
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<f:ajax render="@form" /> <f:ajax render="@form" />
</h:commandButton> </h:commandButton>
<h:inputText size="4" id="cartcount" value="#{cart.count}"> <h:inputText size="4" id="cartcount" value="#{cart.count}">
<f:ajax render="@form" event="valueChange" /> <f:ajax render="@form" event="valueChange" listener="#{productShopView.updateCartLimits}"/>
</h:inputText> </h:inputText>
<h:commandButton action="#{productShopView.add(1)}" value="#{i18n['productshop.plusOne']}"> <h:commandButton action="#{productShopView.add(1)}" value="#{i18n['productshop.plusOne']}">
<f:ajax render="@form" /> <f:ajax render="@form" />
...@@ -61,6 +61,14 @@ ...@@ -61,6 +61,14 @@
<f:ajax render="@form" /> <f:ajax render="@form" />
</h:commandButton> </h:commandButton>
</h:column> </h:column>
<h:column rendered="#{productShopView.hasLimits}">
<f:facet name="header">
<h:outputText value="#{i18n['productshop.limits']}" />
</f:facet>
<h:outputText value="#{cart.limit}" >
<f:convertNumber maxIntegerDigits="2" minFractionDigits="0"/>
</h:outputText>
</h:column>
<h:column> <h:column>
<h:dataTable border="0" var="disc" value="#{cart.discounts}"> <h:dataTable border="0" var="disc" value="#{cart.discounts}">
<h:column> <h:column>
......
...@@ -211,4 +211,14 @@ td ul { ...@@ -211,4 +211,14 @@ td ul {
.topalign { .topalign {
vertical-align: top; vertical-align: top;
}
.numalign {
text-align: right;
}
.editorlink {
font-size: 9px;
float: left;
margin: 4px;
} }
\ No newline at end of file
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:tools="http://java.sun.com/jsf/composite/tools" <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:bill="http://java.sun.com/jsf/composite/cditools/bills" xmlns:f="http://java.sun.com/jsf/core"> xmlns:bill="http://java.sun.com/jsf/composite/cditools/bills" xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body> <h:body>
...@@ -13,15 +14,34 @@ ...@@ -13,15 +14,34 @@
<ui:define name="content"> <ui:define name="content">
<bill:showBill bill="#{billEditView.bill}" /> <bill:showBill bill="#{billEditView.bill}" />
<ui:fragment rendered="#{billEditView.verkkomaksuAvailable}"> <ui:fragment rendered="#{billEditView.verkkomaksuFiAvailable}">
<div id="svm-payment"> <div id="svm-payment">
<a href="#{billEditView.verkkomaksuToken.url}"> </a> <a href="#{billEditView.verkkomaksuFiToken.url}"> </a>
</div> </div>
<script type="text/javascript" src="//payment.verkkomaksut.fi/js/sv-widget.min.js"></script> <script type="text/javascript" src="//payment.verkkomaksut.fi/js/sv-widget.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
SV.widget.initWithToken('svm-payment', '#{billEditView.verkkomaksuToken.token}', {width: '800'}); SV.widget.initWithToken('svm-payment', '#{billEditView.verkkomaksuToken.token}', {width: '800'});
</script> </script>
</ui:fragment> </ui:fragment>
<ui:fragment rendered="#{billEditView.checkoutFiAvailable}">
<table border="0">
<tr>
<ui:repeat varStatus="idx" value="#{billEditView.checkoutFiToken}" var="bank">
<td>
<form action="#{bank.url}" method="post">
<ui:repeat value="#{bank.postParams}" var="valp" >
<input type="hidden" name="#{valp.key}" value="#{valp.value}" />
</ui:repeat>
<input type='image' src='#{bank.icon}' />
</form>
</td>
<h:outputText escape="false" value="&lt;/tr>&lt;tr>" rendered="#{idx.index % 4 == 3}"/>
</ui:repeat>
</tr>
</table>
</ui:fragment>
</ui:define> </ui:define>
......
<!DOCTYPE html <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
...@@ -43,20 +42,6 @@ ...@@ -43,20 +42,6 @@
<h:message for="uploadfile" /> <h:message for="uploadfile" />
<h:commandButton action="#{userView.sendImage}" value="#{i18n['user.imagesubmit']}" /> <h:commandButton action="#{userView.sendImage}" value="#{i18n['user.imagesubmit']}" />
</h:form> </h:form>
<h2>asdasd</h2>
<h:dataTable value="#{userView.user.userImageList}" var="img">
<h:column>
<h:outputText value="#{img.name}" />
</h:column>
<h:column>
<h:outputText value="#{img.uploaded.time}">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
</h:outputText>
</h:column>
<h:column>
<h:outputText value="#{(empty img.defaultImage) ? i18n['user.isNotDefaultImage'] : i18n['user.isDefaultImage']}" />
</h:column>
</h:dataTable>
<h2>#{i18n['user.thisIsCurrentImage']}</h2> <h2>#{i18n['user.thisIsCurrentImage']}</h2>
...@@ -72,73 +57,26 @@ ...@@ -72,73 +57,26 @@
</div> </div>
</ui:fragment> </ui:fragment>
<!--
<h2>asdasd</h2>
<h:dataTable value="#{userView.user.userImageList}" var="img">
<h:column>
<ui:fragment rendered="#{userView.canManage()}"> <h:outputText value="#{img.name}" />
<h2>Ylläpito</h2> </h:column>
<h:form> <h:column>
<h:commandButton action="#{userView.makeCard()}" value="#{i18n['user.makeCard']}" /> <h:outputText value="#{img.uploaded.time}">
<h:dataTable var="card" value="#{userCardView.printedCards}"> <f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
<h:column> </h:outputText>
<h:outputText value="#{card.enabled}" /> </h:column>
</h:column> <h:column>
<h:column> <h:outputText value="#{(empty img.defaultImage) ? i18n['user.isNotDefaultImage'] : i18n['user.isDefaultImage']}" />
<h:outputText value="#{card.enabled}" /> </h:column>
</h:column> <h:column>
</h:column>
<h:column> </h:dataTable>
<a href="#{request.contextPath}/UserCard?cardid=#{card.id}">View Card</a> -->
<a href="#{request.contextPath}/UserCard?cardid=#{card.id}&amp;download=1">Print Card</a>
</h:column>
</h:dataTable>
</h:form>
<h3>RFID</h3>
<h:form rendered="#{empty readerNameContainer.readerId}">
<h:dataTable border="1" id="reader" value="#{readerListDataView.readers}" var="rr">
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['reader.name']}" />
</f:facet>
<h:outputText value="#{rr}" />
</h:column>
<h:column>
<h:commandButton action="#{readerListDataView.selectReader}" />
</h:column>
</h:dataTable>
</h:form>
<shop:readerevents rendered="#{!empty readerNameContainer.readerId}" />
</ui:fragment>
<!-- <h:dataTable var="image" value="#{userView.user.userImageList}"> -->
<!-- <h:column> -->
<!-- <h:outputText value="#{image.id}" /> -->
<!-- </h:column> -->
<!-- <h:column> -->
<!-- <h:outputText value="#{image.name}" /> -->
<!-- </h:column> -->
<!-- <h:column> -->
<!-- <h:outputText value="#{image.description}" /> -->
<!-- </h:column> -->
<!-- </h:dataTable> -->
</ui:define> </ui:define>
</ui:composition> </ui:composition>
</h:body> </h:body>
</html> </html>
\ No newline at end of file
...@@ -71,7 +71,7 @@ navi.auth.logout = frontpage ...@@ -71,7 +71,7 @@ navi.auth.logout = frontpage
pagegroup.auth.login = frontpage pagegroup.auth.login = frontpage
placegroupview.toptext = \ placegroupview.toptext = \
poll.edit = edit poll.edit = edit
......
...@@ -78,6 +78,15 @@ cardTemplate.name = Card template ...@@ -78,6 +78,15 @@ cardTemplate.name = Card template
cardTemplate.power = Card power cardTemplate.power = Card power
cardTemplate.roles = Associated roles cardTemplate.roles = Associated roles
checkout.cancel.errorMessage = Error confirming the cancel\u2026 Please report this to code@codecrew.fi
checkout.cancel.successMessage = You can retry payment at your own bills.
checkout.reject.errorMessage = Error while processing rejected payment. Please report this error to code@codecrew.fi
checkout.reject.successMessage = Payment rejected. You can retry payment from your own bills.
checkout.return.errorDelayed = Error confirming delayed payment. Please contact code@codecrew.fi
checkout.return.errorMessage = Error confirming the successfull return message. Please report this error to code@codecrew.fi
checkout.return.successDelayed = Delayed payment successfull. Payment will be confirmed at a later time, usually within a hour.
checkout.return.successMessage = Payment confirmed. Your products have been paid. You can now move to possible reservation of places.
compo.edit = Edit compo compo.edit = Edit compo
compo.saveVotes = Save votes compo.saveVotes = Save votes
compo.votesSaved = Votes saved compo.votesSaved = Votes saved
...@@ -121,6 +130,14 @@ event.startTime = Start time ...@@ -121,6 +130,14 @@ event.startTime = Start time
eventdomain.domainname = Domain eventdomain.domainname = Domain
eventdomain.remove = Remove eventdomain.remove = Remove
eventmap.active = Active
eventmap.buyable.like = Place name match
eventmap.buyable.lock = Lock places
eventmap.buyable.release = Release places
eventmap.name = Map name
eventmap.notes = Notes
eventmap.save = Save
eventorg.bankName1 = Bank name 2 eventorg.bankName1 = Bank name 2
eventorg.bankName2 = Bank name 2 eventorg.bankName2 = Bank name 2
eventorg.bankNumber1 = Bank account nr. 1 eventorg.bankNumber1 = Bank account nr. 1
...@@ -171,6 +188,10 @@ javax.validation.constraints.Past.message = must be in the past ...@@ -171,6 +188,10 @@ javax.validation.constraints.Past.message = must be in the past
javax.validation.constraints.Pattern.message = must match "{regexp}" javax.validation.constraints.Pattern.message = must match "{regexp}"
javax.validation.constraints.Size.message = size must be between {min} and {max} javax.validation.constraints.Size.message = size must be between {min} and {max}
layout.editBottom = Edit bottom content
layout.editContent = Edit center
layout.editTop = Edit topcontent
login.login = Login login.login = Login
login.logout = Logout login.logout = Logout
login.logoutmessage = You have logged out of the system login.logoutmessage = You have logged out of the system
...@@ -183,7 +204,23 @@ loginerror.message = Username of password incorrect. ...@@ -183,7 +204,23 @@ loginerror.message = Username of password incorrect.
loginerror.resetpassword = Reset password loginerror.resetpassword = Reset password
map.edit = Edit map.edit = Edit
map.generate = Generate places
map.height = Place height (px)
map.name = Name map.name = Name
map.namebase = Semicolon separated table prefixes
map.oneRowTable = One row tables
map.placesInRow = Places in row
map.product = Place product
map.startX = Place start X-coordinate
map.startY = Place start Y-coordinate\n
map.submitMap = Send map image
map.tableCount = Place count
map.tableXdiff = Table X difference
map.tableYdiff = Table Y difference
map.tablesHorizontal = Generate horizontal tables
map.width = Place width (px)
mapEdit.removePlaces = Remove ALL places
mapManage.lockedPlaces = Locked {0} places. mapManage.lockedPlaces = Locked {0} places.
mapManage.releasedPlaces = Released {0} places mapManage.releasedPlaces = Released {0} places
...@@ -221,6 +258,10 @@ page.bill.edit.header = Edit bill ...@@ -221,6 +258,10 @@ page.bill.edit.header = Edit bill
page.bill.listAll.header = Bills page.bill.listAll.header = Bills
page.bill.placemap.header = Place map page.bill.placemap.header = Place map
page.bill.show.header = Bill info page.bill.show.header = Bill info
page.checkout.cancel.header = Payment cancelled!
page.checkout.delayed.header = Delayed payment
page.checkout.reject.header = Payment rejected!
page.checkout.return.header = Payment confirmed
page.game.list.header = Insomnia Game page.game.list.header = Insomnia Game
page.game.start.header = Insomnia Game page.game.start.header = Insomnia Game
page.index.header = Frontpage page.index.header = Frontpage
...@@ -363,6 +404,7 @@ products.save = Save ...@@ -363,6 +404,7 @@ products.save = Save
productshop.billCreated = Bill created productshop.billCreated = Bill created
productshop.commit = Buy productshop.commit = Buy
productshop.limits = Available
productshop.noItemsInCart = There are no products in shopping cart productshop.noItemsInCart = There are no products in shopping cart
productshop.total = Total productshop.total = Total
......
...@@ -76,6 +76,15 @@ cardTemplate.name = Korttipohja ...@@ -76,6 +76,15 @@ cardTemplate.name = Korttipohja
cardTemplate.power = Teho cardTemplate.power = Teho
cardTemplate.roles = Yhdistetyt roolit cardTemplate.roles = Yhdistetyt roolit
checkout.cancel.errorMessage = Virhe peruutuksen vahvistuksessa\u2026 Ilmoita t\u00E4st\u00E4 osoitteeseen code@codecrew.fi
checkout.cancel.successMessage = Voit yritt\u00E4\u00E4 maksua uudelleen omista laskuistasi.
checkout.reject.errorMessage = Virhe hyl\u00E4tyn maksun k\u00E4sittelyss\u00E4. Raportoi t\u00E4m\u00E4 virhe osoitteeseen: code@codecrew.fi
checkout.reject.successMessage = Maksu hyl\u00E4tty. Voit yritt\u00E4\u00E4 maksua uudelleen omista laskuistasi.
checkout.return.errorDelayed = Virhe viiv\u00E4stetyn maksun vahvistuksessa. Ota yhteytt\u00E4 code@codecrew.fi
checkout.return.errorMessage = Virhe maksun onnistuneen maksun vahvistuksessa. Raportoi t\u00E4m\u00E4 virhe yll\u00E4pidolle: code@codecrew.fi
checkout.return.successDelayed = Viiv\u00E4stetty maksu onnistunut. Maksu vahvistet\u00E4\u00E4n my\u00F6hemp\u00E4n\u00E4 ajankohtana, yleens\u00E4 noin tunnin sis\u00E4ll\u00E4.
checkout.return.successMessage = Maksu vahvistettu. Tuotteet on maksettu ja voit siirty\u00E4 varmaan haluamiasi paikkoja.
compo.edit = Muokkaa compoa compo.edit = Muokkaa compoa
compo.saveVotes = Tallenna \u00E4\u00E4net compo.saveVotes = Tallenna \u00E4\u00E4net
compo.votesSaved = \u00C4\u00E4net tallennettu compo.votesSaved = \u00C4\u00E4net tallennettu
...@@ -119,6 +128,14 @@ event.startTime = Aloitusp\u00E4iv\u00E4 ...@@ -119,6 +128,14 @@ event.startTime = Aloitusp\u00E4iv\u00E4
eventdomain.domainname = Domain eventdomain.domainname = Domain
eventdomain.remove = Poista eventdomain.remove = Poista
eventmap.active = Aktiivinen\u0009
eventmap.buyable.like = Paikat
eventmap.buyable.lock = Lukitse paikat
eventmap.buyable.release = Vapauta paikat
eventmap.name = Kartan nimi
eventmap.notes = Lis\u00E4tiedot
eventmap.save = Tallenna
eventorg.bankName1 = Pankin nimi 1 eventorg.bankName1 = Pankin nimi 1
eventorg.bankName2 = Pankin nimi 2 eventorg.bankName2 = Pankin nimi 2
eventorg.bankNumber1 = Tilinumero 1 eventorg.bankNumber1 = Tilinumero 1
...@@ -178,6 +195,10 @@ javax.validation.constraints.Past.message = must be in the past ...@@ -178,6 +195,10 @@ javax.validation.constraints.Past.message = must be in the past
javax.validation.constraints.Pattern.message = must match "{regexp}" javax.validation.constraints.Pattern.message = must match "{regexp}"
javax.validation.constraints.Size.message = size must be between {min} and {max} javax.validation.constraints.Size.message = size must be between {min} and {max}
layout.editBottom = Muokkaa alasis\u00E4lt\u00F6\u00E4
layout.editContent = Muokkaa sis\u00E4lt\u00F6\u00E4
layout.editTop = Muokkaa yl\u00E4sis\u00E4lt\u00F6\u00E4
login.login = Kirjaudu sis\u00E4\u00E4n login.login = Kirjaudu sis\u00E4\u00E4n
login.logout = Kirjaudu ulos login.logout = Kirjaudu ulos
login.logoutmessage = Olet kirjautunut ulos j\u00E4rjestelm\u00E4st\u00E4. login.logoutmessage = Olet kirjautunut ulos j\u00E4rjestelm\u00E4st\u00E4.
...@@ -190,7 +211,23 @@ loginerror.message = K\u00E4ytt\u00E4j\u00E4tunnus tai salasana ei ollut o ...@@ -190,7 +211,23 @@ loginerror.message = K\u00E4ytt\u00E4j\u00E4tunnus tai salasana ei ollut o
loginerror.resetpassword = Salasana unohtunut? loginerror.resetpassword = Salasana unohtunut?
map.edit = Muokkaa map.edit = Muokkaa
map.generate = Generoi paikat
map.height = Paikan korkeus (px)
map.name = Nimi map.name = Nimi
map.namebase = Puolipisteell\u00E4 erotetut p\u00F6yt\u00E4-etuliitteet
map.oneRowTable = Yhden rivin p\u00F6yd\u00E4t
map.placesInRow = Paikkoja riviss\u00E4
map.product = Paikkatuote
map.startX = P\u00F6yd\u00E4n X-aloituskoord.
map.startY = P\u00F6yd\u00E4n Y-aloituskoord.
map.submitMap = L\u00E4het\u00E4 karttapohja
map.tableCount = P\u00F6ytien lukum\u00E4\u00E4r\u00E4
map.tableXdiff = P\u00F6ytien v\u00E4li ( X )
map.tableYdiff = P\u00F6ytien v\u00E4li ( Y )
map.tablesHorizontal = P\u00F6yd\u00E4t vaakatasossa
map.width = Leveys (px)
mapEdit.removePlaces = Poista kaikki paikat
mapManage.lockedPlaces = Lukittu kartasta {0} paikkaa. mapManage.lockedPlaces = Lukittu kartasta {0} paikkaa.
mapManage.releasedPlaces = Vapautettu kartasta {0} paikkaa mapManage.releasedPlaces = Vapautettu kartasta {0} paikkaa
...@@ -234,6 +271,10 @@ page.auth.resetPassword.header = Nollaa salasana ...@@ -234,6 +271,10 @@ page.auth.resetPassword.header = Nollaa salasana
page.bill.billSummary.header = Laskujen yhteenveto page.bill.billSummary.header = Laskujen yhteenveto
page.bill.list.header = Laskut page.bill.list.header = Laskut
page.bill.show.header = Laskun tiedot page.bill.show.header = Laskun tiedot
page.checkout.cancel.header = Maksu peruutettu.
page.checkout.delayed.header = Viiv\u00E4stetty maksu
page.checkout.reject.header = Maksu hyl\u00E4tty!
page.checkout.return.header = Maksu vahvistettu
page.place.insertToken.header = Sy\u00F6t\u00E4 paikkakoodi page.place.insertToken.header = Sy\u00F6t\u00E4 paikkakoodi
page.place.mygroups.header = Paikkaryhm\u00E4t page.place.mygroups.header = Paikkaryhm\u00E4t
page.place.placemap.header = Paikkakartta page.place.placemap.header = Paikkakartta
...@@ -352,6 +393,7 @@ products.save = Tallenna ...@@ -352,6 +393,7 @@ products.save = Tallenna
productshop.billCreated = Lasku luotu productshop.billCreated = Lasku luotu
productshop.commit = Osta productshop.commit = Osta
productshop.limits = Vapaana
productshop.noItemsInCart = Ostoskorissa ei ole tuotteita productshop.noItemsInCart = Ostoskorissa ei ole tuotteita
productshop.total = Yhteens\u00E4 productshop.total = Yhteens\u00E4
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#Bill number #Bill number
# Validationmessages # Validationmessages
bill.billMarkedPaidMail.message = Laskusi numero {0} on merkitty maksetuksi. Voit nyt siirty\u00E4 lippukauppaan varamaamaan haluamasi paikat. \nTervetuloa tapahtumaan!\n\nTerveisin,\nInsomnia lippupalvelu\nwww.insomnia.fi bill.billMarkedPaidMail.message = Laskusi numero {0} on merkitty maksetuksi. Voit nyt siirty\u00E4 lippukauppaan varamaamaan haluamasi paikat. \nTervetuloa tapahtumaan\!\n\nTerveisin,\nInsomnia lippupalvelu\nwww.insomnia.fi
bill.billMarkedPaidMail.subject = [INSOMNIA] Lasku merkitty maksetuksi bill.billMarkedPaidMail.subject = [INSOMNIA] Lasku merkitty maksetuksi
eventorg.edit = Muokkaa eventorg.edit = Muokkaa
......
...@@ -46,7 +46,7 @@ public class FileDownloadServlet extends GenericImageServlet { ...@@ -46,7 +46,7 @@ public class FileDownloadServlet extends GenericImageServlet {
private transient PermissionBeanLocal permbean; private transient PermissionBeanLocal permbean;
@EJB @EJB
private EventBeanLocal orgbean; private transient EventBeanLocal orgbean;
private static final Logger logger = LoggerFactory.getLogger(FileDownloadServlet.class); private static final Logger logger = LoggerFactory.getLogger(FileDownloadServlet.class);
......
...@@ -53,7 +53,7 @@ public class PlaceMap extends HttpServlet { ...@@ -53,7 +53,7 @@ public class PlaceMap extends HttpServlet {
private transient PermissionBeanLocal permbean; private transient PermissionBeanLocal permbean;
@EJB @EJB
private LoggingBeanLocal loggerbean; private transient LoggingBeanLocal loggerbean;
private static final String PARAMETER_EVENT_MAP_ID = "mapid"; private static final String PARAMETER_EVENT_MAP_ID = "mapid";
......
...@@ -48,7 +48,7 @@ public class UserCardServlet extends GenericImageServlet { ...@@ -48,7 +48,7 @@ public class UserCardServlet extends GenericImageServlet {
private final Pattern lhMatcher = Pattern.compile("^127.[0-9.]*|(0:)*1%0"); private final Pattern lhMatcher = Pattern.compile("^127.[0-9.]*|(0:)*1%0");
@EJB @EJB
private CardTemplateBeanLocal cardbean; private transient CardTemplateBeanLocal cardbean;
private static final Logger logger = LoggerFactory.getLogger(UserCardServlet.class); private static final Logger logger = LoggerFactory.getLogger(UserCardServlet.class);
......
...@@ -14,20 +14,20 @@ import fi.insomnia.bortal.web.cdiview.GenericCDIView; ...@@ -14,20 +14,20 @@ import fi.insomnia.bortal.web.cdiview.GenericCDIView;
@RequestScoped @RequestScoped
public class ActionLogMessageView extends GenericCDIView { public class ActionLogMessageView extends GenericCDIView {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private boolean updateEnabled = true; private boolean updateEnabled = true;
@EJB @EJB
private ActionLogBeanLocal actionLogBean; private transient ActionLogBeanLocal actionLogBean;
public boolean getUpdateEnabled() { public boolean getUpdateEnabled() {
return updateEnabled; return updateEnabled;
} }
public void setUpdateEnabled(boolean updateEnabled) { public void setUpdateEnabled(boolean updateEnabled) {
this.updateEnabled = updateEnabled; this.updateEnabled = updateEnabled;
} }
public List<ActionLogMessage> getMessages() { public List<ActionLogMessage> getMessages() {
return actionLogBean.getAllActionLogEvents(); return actionLogBean.getAllActionLogEvents();
} }
......
...@@ -27,7 +27,7 @@ public class TaskModificationView extends GenericCDIView { ...@@ -27,7 +27,7 @@ public class TaskModificationView extends GenericCDIView {
private ActionLogMessageState responseStateChange; private ActionLogMessageState responseStateChange;
@EJB @EJB
private ActionLogBeanLocal logbean; private transient ActionLogBeanLocal logbean;
public void initView() { public void initView() {
if (super.requirePermissions(ContentPermission.MANAGE_ACTIONLOG) && message == null) { if (super.requirePermissions(ContentPermission.MANAGE_ACTIONLOG) && message == null) {
......
...@@ -17,7 +17,7 @@ public class PageOutputView extends GenericCDIView { ...@@ -17,7 +17,7 @@ public class PageOutputView extends GenericCDIView {
private static final long serialVersionUID = 1384298744925823293L; private static final long serialVersionUID = 1384298744925823293L;
@EJB @EJB
private SitePageBeanLocal pagebean; private transient SitePageBeanLocal pagebean;
private Integer id; private Integer id;
private String name; private String name;
...@@ -26,7 +26,7 @@ public class PageOutputView extends GenericCDIView { ...@@ -26,7 +26,7 @@ public class PageOutputView extends GenericCDIView {
public void initIndexView() public void initIndexView()
{ {
name = "index"; name = "/index";
initView(); initView();
} }
......
package fi.insomnia.bortal.web.cdiview.content; package fi.insomnia.bortal.web.cdiview.content;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped; import javax.enterprise.context.ConversationScoped;
import javax.inject.Named; import javax.inject.Named;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.beans.SitePageBeanLocal; import fi.insomnia.bortal.beans.SitePageBeanLocal;
import fi.insomnia.bortal.enums.apps.ContentPermission; import fi.insomnia.bortal.enums.apps.ContentPermission;
import fi.insomnia.bortal.model.PageContent;
import fi.insomnia.bortal.model.SitePage; import fi.insomnia.bortal.model.SitePage;
import fi.insomnia.bortal.web.cdiview.GenericCDIView; import fi.insomnia.bortal.web.cdiview.GenericCDIView;
...@@ -17,10 +22,12 @@ public class SitePageView extends GenericCDIView { ...@@ -17,10 +22,12 @@ public class SitePageView extends GenericCDIView {
private static final long serialVersionUID = -513285802858190970L; private static final long serialVersionUID = -513285802858190970L;
@EJB @EJB
private SitePageBeanLocal sitepagebean; private transient SitePageBeanLocal sitepagebean;
private Integer id; private Integer id;
private SitePage sitepage; private SitePage sitepage;
private List<SitePage> pages; private List<SitePage> pages;
private String managedPage;
private static final Logger logger = LoggerFactory.getLogger(SitePageView.class);
public void initEdit() public void initEdit()
{ {
...@@ -31,6 +38,23 @@ public class SitePageView extends GenericCDIView { ...@@ -31,6 +38,23 @@ public class SitePageView extends GenericCDIView {
} }
} }
public void initManage()
{
if (super.requirePermissions(ContentPermission.MANAGE_PAGES) && sitepage == null)
{
sitepage = sitepagebean.findSitename(managedPage);
if (sitepage == null)
{
sitepage = new SitePage();
sitepage.setName(managedPage);
sitepage.setContents(new ArrayList<PageContent>());
sitepage.getContents().add(new PageContent(sitepage));
}
super.beginConversation();
logger.info("Initializing managed page {}", managedPage);
}
}
public void initCreate() public void initCreate()
{ {
if (super.requirePermissions(ContentPermission.MANAGE_PAGES)) if (super.requirePermissions(ContentPermission.MANAGE_PAGES))
...@@ -63,8 +87,14 @@ public class SitePageView extends GenericCDIView { ...@@ -63,8 +87,14 @@ public class SitePageView extends GenericCDIView {
public String saveSite() public String saveSite()
{ {
sitepage = sitepagebean.save(sitepage); String ret = null;
return null; if (sitepage.getId() == null) {
sitepagebean.create(sitepage);
ret = "/pages/edit";
} else {
sitepage = sitepagebean.save(sitepage);
}
return ret;
} }
public SitePage getSitepage() { public SitePage getSitepage() {
...@@ -91,4 +121,12 @@ public class SitePageView extends GenericCDIView { ...@@ -91,4 +121,12 @@ public class SitePageView extends GenericCDIView {
this.pages = pages; this.pages = pages;
} }
public String getManagedPage() {
return managedPage;
}
public void setManagedPage(String managedPage) {
this.managedPage = managedPage;
}
} }
...@@ -47,7 +47,7 @@ public class MapManageView extends GenericCDIView { ...@@ -47,7 +47,7 @@ public class MapManageView extends GenericCDIView {
@EJB @EJB
private transient ProductBeanLocal productbean; private transient ProductBeanLocal productbean;
private UploadedFile bgFile; private transient UploadedFile bgFile;
private List<EventMap> eventmaps; private List<EventMap> eventmaps;
private EventMap map; private EventMap map;
......
...@@ -41,7 +41,7 @@ public class MapView extends GenericCDIView { ...@@ -41,7 +41,7 @@ public class MapView extends GenericCDIView {
private transient EventBeanLocal eventBean; private transient EventBeanLocal eventBean;
private BigDecimal balance; private BigDecimal balance;
@EJB @EJB
private AccountEventBeanLocal acbean; private transient AccountEventBeanLocal acbean;
private static final Logger logger = LoggerFactory.getLogger(MapView.class); private static final Logger logger = LoggerFactory.getLogger(MapView.class);
......
...@@ -54,7 +54,7 @@ public class PlaceView extends GenericCDIView { ...@@ -54,7 +54,7 @@ public class PlaceView extends GenericCDIView {
private String searchuser; private String searchuser;
private transient ListDataModel<User> userlist; private transient ListDataModel<User> userlist;
@EJB @EJB
private AccountEventBeanLocal acbean; private transient AccountEventBeanLocal acbean;
public boolean canEdit() { public boolean canEdit() {
return permbean.hasPermission(MapPermission.MANAGE_MAPS); return permbean.hasPermission(MapPermission.MANAGE_MAPS);
......
...@@ -24,7 +24,7 @@ public class MenuListView extends GenericCDIView { ...@@ -24,7 +24,7 @@ public class MenuListView extends GenericCDIView {
private static final Logger logger = LoggerFactory.getLogger(MenuListView.class); private static final Logger logger = LoggerFactory.getLogger(MenuListView.class);
@EJB @EJB
private MenubeanLocal menubean; private transient MenubeanLocal menubean;
private TreeNode selectedNode; private TreeNode selectedNode;
private TreeNode root; private TreeNode root;
......
...@@ -12,6 +12,9 @@ import javax.faces.context.FacesContext; ...@@ -12,6 +12,9 @@ import javax.faces.context.FacesContext;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.beans.MenubeanLocal; import fi.insomnia.bortal.beans.MenubeanLocal;
import fi.insomnia.bortal.beans.SitePageBeanLocal; import fi.insomnia.bortal.beans.SitePageBeanLocal;
import fi.insomnia.bortal.model.MenuNavigation; import fi.insomnia.bortal.model.MenuNavigation;
...@@ -28,13 +31,13 @@ public class MenuView extends GenericCDIView { ...@@ -28,13 +31,13 @@ public class MenuView extends GenericCDIView {
private String pagename; private String pagename;
@Inject @Inject
private LayoutView layoutview; private transient LayoutView layoutview;
@Inject @Inject
private FacesContext context; private transient FacesContext context;
@EJB @EJB
private MenubeanLocal menubean; private transient MenubeanLocal menubean;
private LinkedList<List<JsfMenuitem>> menus; private LinkedList<List<JsfMenuitem>> menus;
...@@ -43,11 +46,15 @@ public class MenuView extends GenericCDIView { ...@@ -43,11 +46,15 @@ public class MenuView extends GenericCDIView {
private Map<String, List<PageContent>> contents = new HashMap<String, List<PageContent>>(); private Map<String, List<PageContent>> contents = new HashMap<String, List<PageContent>>();
@EJB @EJB
private SitePageBeanLocal pagebean; private transient SitePageBeanLocal pagebean;
private static final Logger logger = LoggerFactory.getLogger(MenuView.class);
public List<PageContent> getPagecontent(String pagekey) public List<PageContent> getPagecontent(String pagekey)
{ {
String key = new StringBuilder(layoutview.getPagepath()).append(":").append(pagekey).toString(); String key = new StringBuilder(layoutview.getPagepath()).append(":").append(pagekey).toString();
// logger.debug("Getting pagecontent for key {}", key);
if (!contents.containsKey(key)) { if (!contents.containsKey(key)) {
contents.put(key, pagebean.findContentsForUser(key)); contents.put(key, pagebean.findContentsForUser(key));
} }
......
...@@ -11,6 +11,7 @@ import javax.inject.Named; ...@@ -11,6 +11,7 @@ import javax.inject.Named;
import fi.insomnia.bortal.beans.EventBeanLocal; import fi.insomnia.bortal.beans.EventBeanLocal;
import fi.insomnia.bortal.beans.EventOrganiserBeanLocal; import fi.insomnia.bortal.beans.EventOrganiserBeanLocal;
import fi.insomnia.bortal.enums.apps.EventPermission;
import fi.insomnia.bortal.model.EventOrganiser; import fi.insomnia.bortal.model.EventOrganiser;
import fi.insomnia.bortal.model.EventUser; import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.model.LanEvent; import fi.insomnia.bortal.model.LanEvent;
...@@ -46,7 +47,7 @@ public class EventOrgView extends GenericCDIView { ...@@ -46,7 +47,7 @@ public class EventOrgView extends GenericCDIView {
private String newdomain; private String newdomain;
private ListDataModel<LanEventDomain> eventdomains; private transient ListDataModel<LanEventDomain> eventdomains;
public void initCreate() public void initCreate()
{ {
...@@ -82,14 +83,16 @@ public class EventOrgView extends GenericCDIView { ...@@ -82,14 +83,16 @@ public class EventOrgView extends GenericCDIView {
public void initEdit() { public void initEdit() {
if (super.requirePermissions(eventorgbean.hasOrgPermission(orgId) || user.isSuperadmin()) && eventorg == null) { if ((super.requirePermissions(eventorgbean.hasOrgPermission(orgId) || user.isSuperadmin())) && eventorg == null) {
if (orgId != null) { eventorg = eventorgbean.find(orgId);
eventorg = eventorgbean.find(orgId);
} else {
eventorg = eventbean.getCurrentEvent().getOrganiser();
}
super.beginConversation(); super.beginConversation();
} }
// else if (super.requirePermissions(EventPermission.MANAGE_PROPERTIES)
// && eventorg == null) {
// eventorg = eventbean.getCurrentEvent().getOrganiser();
// super.beginConversation();
// }
} }
public void initListView() { public void initListView() {
...@@ -105,10 +108,14 @@ public class EventOrgView extends GenericCDIView { ...@@ -105,10 +108,14 @@ public class EventOrgView extends GenericCDIView {
public void initEditEvent() public void initEditEvent()
{ {
if (super.requirePermissions(user.isSuperadmin() || eventorgbean.hasEventPermission(eventid)) && getEvent() == null) if (eventid != null && super.requirePermissions(user.isSuperadmin() || eventorgbean.hasEventPermission(eventid)) && getEvent() == null)
{ {
setEvent(eventorgbean.findEvent(eventid)); setEvent(eventorgbean.findEvent(eventid));
super.beginConversation(); super.beginConversation();
} else if (super.requirePermissions(EventPermission.MANAGE_PROPERTIES) && getEvent() == null)
{
setEvent(eventbean.getCurrentEvent());
super.beginConversation();
} }
} }
......
...@@ -10,6 +10,7 @@ import javax.faces.model.ListDataModel; ...@@ -10,6 +10,7 @@ import javax.faces.model.ListDataModel;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import org.primefaces.model.UploadedFile;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -32,13 +33,15 @@ public class EventPropertyView extends GenericCDIView { ...@@ -32,13 +33,15 @@ public class EventPropertyView extends GenericCDIView {
private LanEventProperty property; private LanEventProperty property;
@Inject @Inject
private EventOrgView eventorgview; private transient EventOrgView eventorgview;
@EJB @EJB
private EventBeanLocal eventbean; private transient EventBeanLocal eventbean;
private UploadedFile file;
private static final Logger logger = LoggerFactory.getLogger(EventPropertyView.class); private static final Logger logger = LoggerFactory.getLogger(EventPropertyView.class);
private ListDataModel<LanEventProperty> properties; private transient ListDataModel<LanEventProperty> properties;
private ListDataModel<LanEventPrivateProperty> privateProperties; private transient ListDataModel<LanEventPrivateProperty> privateProperties;
private LanEventPrivateProperty privateProperty; private LanEventPrivateProperty privateProperty;
...@@ -106,6 +109,11 @@ public class EventPropertyView extends GenericCDIView { ...@@ -106,6 +109,11 @@ public class EventPropertyView extends GenericCDIView {
public String savePrivateProperty() public String savePrivateProperty()
{ {
logger.info("Saving property {}, eventorg {}, key {}", new Object[] { privateProperty.getEvent(), privateProperty.getEventorg(), privateProperty.getKey() }); logger.info("Saving property {}, eventorg {}, key {}", new Object[] { privateProperty.getEvent(), privateProperty.getEventorg(), privateProperty.getKey() });
if (privateProperty.getKey().isData() && file != null)
{
privateProperty.setByteValue(file.getContents());
privateProperty.setByteMime(file.getContentType());
}
privateProperty = eventbean.saveOrCreatePrivateProperty(privateProperty); privateProperty = eventbean.saveOrCreatePrivateProperty(privateProperty);
privateProperty.setEvent(privateProperty.getEvent()); privateProperty.setEvent(privateProperty.getEvent());
privateProperties = null; privateProperties = null;
...@@ -125,8 +133,16 @@ public class EventPropertyView extends GenericCDIView { ...@@ -125,8 +133,16 @@ public class EventPropertyView extends GenericCDIView {
public String saveProperty() public String saveProperty()
{ {
logger.info("Saving property {}, eventorg {}, key {}", new Object[] { property.getEvent(), property.getEventorg(), property.getKey() }); logger.info("Saving property {}, eventorg {}, key {}, ", new Object[] { property.getEvent(), property.getEventorg(), property.getKey() });
logger.debug("Is data: {} File {}", property.getKey().isData(), file);
if (property.getKey().isData() && file != null)
{
logger.info("saving data values type: {}, length {}", file.getContentType(), file.getSize());
property.setByteValue(file.getContents());
property.setByteMime(file.getContentType());
}
property = eventbean.saveOrCreateProperty(property); property = eventbean.saveOrCreateProperty(property);
eventorgview.setEvent(property.getEvent()); eventorgview.setEvent(property.getEvent());
properties = null; properties = null;
property = null; property = null;
...@@ -197,4 +213,12 @@ public class EventPropertyView extends GenericCDIView { ...@@ -197,4 +213,12 @@ public class EventPropertyView extends GenericCDIView {
this.privateProperties = privateProperties; this.privateProperties = privateProperties;
} }
public UploadedFile getFile() {
return file;
}
public void setFile(UploadedFile file) {
this.file = file;
}
} }
package fi.insomnia.bortal.web.cdiview.shop; package fi.insomnia.bortal.web.cdiview.shop;
import java.util.List;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped; import javax.enterprise.context.ConversationScoped;
import javax.inject.Named; import javax.inject.Named;
...@@ -8,8 +10,10 @@ import org.slf4j.Logger; ...@@ -8,8 +10,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.beans.BillBeanLocal; import fi.insomnia.bortal.beans.BillBeanLocal;
import fi.insomnia.bortal.beans.CheckoutFiBeanLocal;
import fi.insomnia.bortal.beans.VerkkomaksutFiBeanLocal; import fi.insomnia.bortal.beans.VerkkomaksutFiBeanLocal;
import fi.insomnia.bortal.model.Bill; import fi.insomnia.bortal.model.Bill;
import fi.insomnia.bortal.util.CheckoutBank;
import fi.insomnia.bortal.util.VerkkomaksutReturnEntry; import fi.insomnia.bortal.util.VerkkomaksutReturnEntry;
import fi.insomnia.bortal.web.cdiview.GenericCDIView; import fi.insomnia.bortal.web.cdiview.GenericCDIView;
...@@ -29,8 +33,12 @@ public class BillEditView extends GenericCDIView { ...@@ -29,8 +33,12 @@ public class BillEditView extends GenericCDIView {
@EJB @EJB
private transient VerkkomaksutFiBeanLocal vmbean; private transient VerkkomaksutFiBeanLocal vmbean;
@EJB @EJB
private transient CheckoutFiBeanLocal checkoutbean;
@EJB
private transient BillBeanLocal billbean; private transient BillBeanLocal billbean;
private List<CheckoutBank> checkoutFiToken;
private static final Logger logger = LoggerFactory.getLogger(BillEditView.class); private static final Logger logger = LoggerFactory.getLogger(BillEditView.class);
public void initView() { public void initView() {
...@@ -48,12 +56,28 @@ public class BillEditView extends GenericCDIView { ...@@ -48,12 +56,28 @@ public class BillEditView extends GenericCDIView {
} }
} }
public boolean isVerkkomaksuAvailable() public boolean isCheckoutFiAvailable()
{
return checkoutbean.isPaymentEnabled();
}
public boolean isVerkkomaksuFiAvailable()
{ {
return vmbean.isSvmEnabled(); return vmbean.isSvmEnabled();
} }
public VerkkomaksutReturnEntry getVerkkomaksuToken() public List<CheckoutBank> getCheckoutFiToken()
{
if (bill != null && checkoutFiToken == null)
{
// checkoutFiToken = checkoutbean.testXml();
checkoutFiToken = checkoutbean.getToken(bill);
}
return checkoutFiToken;
}
public VerkkomaksutReturnEntry getVerkkomaksuFiToken()
{ {
if (bill != null && vmreturn == null) if (bill != null && vmreturn == null)
{ {
......
...@@ -28,12 +28,12 @@ public class BillListView extends GenericCDIView { ...@@ -28,12 +28,12 @@ public class BillListView extends GenericCDIView {
@Inject @Inject
@SelectedUser @SelectedUser
private EventUser user; private transient EventUser user;
@EJB @EJB
private transient BillBeanLocal billbean; private transient BillBeanLocal billbean;
private ListDataModel<Bill> bills; private transient ListDataModel<Bill> bills;
private boolean writeBill; private boolean writeBill;
......
...@@ -22,7 +22,7 @@ public class BillReviewView extends GenericCDIView { ...@@ -22,7 +22,7 @@ public class BillReviewView extends GenericCDIView {
*/ */
private static final long serialVersionUID = -4665348757236295800L; private static final long serialVersionUID = -4665348757236295800L;
@EJB @EJB
private VerkkomaksutFiBeanLocal vmbean; private transient VerkkomaksutFiBeanLocal vmbean;
@EJB @EJB
private transient BillBeanLocal billbean; private transient BillBeanLocal billbean;
......
package fi.insomnia.bortal.web.cdiview.shop;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import fi.insomnia.bortal.beans.CheckoutFiBeanLocal;
import fi.insomnia.bortal.util.CheckoutReturnType;
import fi.insomnia.bortal.web.cdiview.GenericCDIView;
@Named
@RequestScoped
public class CheckoutView extends GenericCDIView {
private static final long serialVersionUID = 2131137241062741415L;
private String version;
private String stamp;
private String reference;
private String payment;
private String status;
private String algorithm;
private String mac;
@EJB
private transient CheckoutFiBeanLocal checkoutbean;
private boolean validationResult;
public boolean isAvailable()
{
return checkoutbean.isPaymentEnabled();
}
public void validateReturn()
{
validationResult = checkoutbean.validateReturn(CheckoutReturnType.RETURN,
version, stamp, reference, payment, status, algorithm, mac);
}
public void validateCancel()
{
validationResult = checkoutbean.validateReturn(CheckoutReturnType.CANCEL,
version, stamp, reference, payment, status, algorithm, mac);
}
public void validateDelayed()
{
validationResult = checkoutbean.validateReturn(CheckoutReturnType.DELAYED,
version, stamp, reference, payment, status, algorithm, mac);
}
public void validateReject()
{
validationResult = checkoutbean.validateReturn(CheckoutReturnType.REJECT,
version, stamp, reference, payment, status, algorithm, mac);
}
public CheckoutFiBeanLocal getCheckoutbean() {
return checkoutbean;
}
public void setCheckoutbean(CheckoutFiBeanLocal checkoutbean) {
this.checkoutbean = checkoutbean;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getStamp() {
return stamp;
}
public void setStamp(String stamp) {
this.stamp = stamp;
}
public String getPayment() {
return payment;
}
public void setPayment(String payment) {
this.payment = payment;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMac() {
return mac;
}
public void setMac(String mac) {
this.mac = mac;
}
public boolean isValidationResult() {
return validationResult;
}
public void setValidationResult(boolean validationResult) {
this.validationResult = validationResult;
}
public String getAlgorithm() {
return algorithm;
}
public void setAlgorithm(String algorithm) {
this.algorithm = algorithm;
}
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
}
package fi.insomnia.bortal.web.cdiview.shop; package fi.insomnia.bortal.web.cdiview.shop;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped; import javax.enterprise.context.ConversationScoped;
...@@ -55,11 +57,13 @@ public class ProductShopView extends GenericCDIView { ...@@ -55,11 +57,13 @@ public class ProductShopView extends GenericCDIView {
@Inject @Inject
private BillEditView billEditView; private BillEditView billEditView;
private boolean hasLimits = false;
public void initBillView() public void initBillView()
{ {
if (requirePermissions(ShopPermission.LIST_USERPRODUCTS) && shoppingcart == null) { if (requirePermissions(ShopPermission.LIST_USERPRODUCTS) && shoppingcart == null) {
shoppingcart = new ListDataModel<ProductShopItem>(ProductShopItem.productList(productBean.listUserShoppableProducts())); shoppingcart = new ListDataModel<ProductShopItem>(ProductShopItem.productList(productBean.listUserShoppableProducts()));
updateCartLimits();
logger.debug("Initialized billing shoppingcart to {}", shoppingcart); logger.debug("Initialized billing shoppingcart to {}", shoppingcart);
this.beginConversation(); this.beginConversation();
} }
...@@ -70,6 +74,7 @@ public class ProductShopView extends GenericCDIView { ...@@ -70,6 +74,7 @@ public class ProductShopView extends GenericCDIView {
if (requirePermissions(ShopPermission.SHOP_TO_OTHERS) && shoppingcart == null) { if (requirePermissions(ShopPermission.SHOP_TO_OTHERS) && shoppingcart == null) {
shoppingcart = new ListDataModel<ProductShopItem>(ProductShopItem.productGTList(productBean.findForStaffshop())); shoppingcart = new ListDataModel<ProductShopItem>(ProductShopItem.productGTList(productBean.findForStaffshop()));
updateCartLimits();
logger.debug("Initialized shoppingcart to {}", shoppingcart); logger.debug("Initialized shoppingcart to {}", shoppingcart);
this.beginConversation(); this.beginConversation();
} }
...@@ -80,9 +85,32 @@ public class ProductShopView extends GenericCDIView { ...@@ -80,9 +85,32 @@ public class ProductShopView extends GenericCDIView {
{ {
ProductShopItem item = shoppingcart.getRowData(); ProductShopItem item = shoppingcart.getRowData();
item.setCount(item.getCount().add(BigDecimal.valueOf(count))); item.setCount(item.getCount().add(BigDecimal.valueOf(count)));
updateCartLimits();
return null; return null;
} }
public void updateCartLimits() {
Map<Integer, BigDecimal> prodCounts = new HashMap<Integer, BigDecimal>();
for (ProductShopItem sc : shoppingcart)
{
prodCounts.put(sc.getProduct().getId(), sc.getCount());
}
HashMap<Integer, BigDecimal> limits = productBean.getProductLimit(prodCounts, user);
for (ProductShopItem n : shoppingcart)
{
BigDecimal l = limits.get(n.getProduct().getId());
if (l != null) {
hasLimits = true;
}
n.updateLimit(l);
}
}
public BigDecimal getAccountBalance() public BigDecimal getAccountBalance()
{ {
BigDecimal ret = user.getAccountBalance(); BigDecimal ret = user.getAccountBalance();
...@@ -214,4 +242,12 @@ public class ProductShopView extends GenericCDIView { ...@@ -214,4 +242,12 @@ public class ProductShopView extends GenericCDIView {
public void setCash(BigDecimal cash) { public void setCash(BigDecimal cash) {
this.cash = cash; this.cash = cash;
} }
public boolean isHasLimits() {
return hasLimits;
}
public void setHasLimits(boolean hasLimits) {
this.hasLimits = hasLimits;
}
} }
package fi.insomnia.bortal.web.cdiview.shop; package fi.insomnia.bortal.web.cdiview.shop;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped; import javax.enterprise.context.ConversationScoped;
import javax.faces.model.ListDataModel; import javax.faces.model.ListDataModel;
import javax.inject.Named; import javax.inject.Named;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -35,10 +35,10 @@ public class ProductView extends GenericCDIView { ...@@ -35,10 +35,10 @@ public class ProductView extends GenericCDIView {
private Discount discount; private Discount discount;
private Integer productId; private Integer productId;
private Set<ProductFlag> productFlags; private Set<ProductFlag> productFlags;
private ListDataModel<Discount> productDiscounts; private transient ListDataModel<Discount> productDiscounts;
private static final Logger logger = LoggerFactory.getLogger(ProductView.class); private static final Logger logger = LoggerFactory.getLogger(ProductView.class);
...@@ -118,7 +118,7 @@ public class ProductView extends GenericCDIView { ...@@ -118,7 +118,7 @@ public class ProductView extends GenericCDIView {
productDiscounts = new ListDataModel<Discount>(product.getDiscounts()); productDiscounts = new ListDataModel<Discount>(product.getDiscounts());
return productDiscounts; return productDiscounts;
} }
public List<ProductFlag> getProductFlags() public List<ProductFlag> getProductFlags()
{ {
return Arrays.asList(ProductFlag.values()); return Arrays.asList(ProductFlag.values());
......
...@@ -23,9 +23,9 @@ public class ReaderListDataView extends GenericCDIView { ...@@ -23,9 +23,9 @@ public class ReaderListDataView extends GenericCDIView {
private static final long serialVersionUID = -601822388844764143L; private static final long serialVersionUID = -601822388844764143L;
@EJB @EJB
private ReaderBeanLocal readerbean; private transient ReaderBeanLocal readerbean;
private ListDataModel<Reader> readers; private transient ListDataModel<Reader> readers;
private static final Logger logger = LoggerFactory.getLogger(ReaderListDataView.class); private static final Logger logger = LoggerFactory.getLogger(ReaderListDataView.class);
......
...@@ -30,18 +30,18 @@ public class ReaderView extends GenericCDIView { ...@@ -30,18 +30,18 @@ public class ReaderView extends GenericCDIView {
private String placecode; private String placecode;
private String usersearch; private String usersearch;
private ListDataModel<UserCardWrapper> userlist; private transient ListDataModel<UserCardWrapper> userlist;
@Inject @Inject
private ReaderNameContainer namecontainer; private ReaderNameContainer namecontainer;
@EJB @EJB
private ReaderBeanLocal readerbean; private transient ReaderBeanLocal readerbean;
private ReaderEvent event; private ReaderEvent event;
@EJB @EJB
private UserBeanLocal userbean; private transient UserBeanLocal userbean;
private UserCardWrapper neighborUser; private UserCardWrapper neighborUser;
......
...@@ -21,7 +21,7 @@ public class SalespointListView extends GenericCDIView { ...@@ -21,7 +21,7 @@ public class SalespointListView extends GenericCDIView {
private SalespointBeanLocal salespointBean; private SalespointBeanLocal salespointBean;
private static final long serialVersionUID = -8990414681240360892L; private static final long serialVersionUID = -8990414681240360892L;
private ListDataModel<Salespoint> salespoints; private transient ListDataModel<Salespoint> salespoints;
private boolean modifySalespoint; private boolean modifySalespoint;
public SalespointListView() { public SalespointListView() {
......
...@@ -22,7 +22,7 @@ public class SvmView extends GenericCDIView { ...@@ -22,7 +22,7 @@ public class SvmView extends GenericCDIView {
private boolean validationResult; private boolean validationResult;
@EJB @EJB
private VerkkomaksutFiBeanLocal vmbean; private transient VerkkomaksutFiBeanLocal vmbean;
public void validateSuccess() public void validateSuccess()
{ {
......
...@@ -16,7 +16,7 @@ public class UserCardWrapper implements Serializable { ...@@ -16,7 +16,7 @@ public class UserCardWrapper implements Serializable {
private static final long serialVersionUID = -2755200540851855878L; private static final long serialVersionUID = -2755200540851855878L;
private final EventUser user; private final EventUser user;
private final ListDataModel<PrintedCard> printedCards; private transient final ListDataModel<PrintedCard> printedCards;
public UserCardWrapper(User u, UserBeanLocal userbean) { public UserCardWrapper(User u, UserBeanLocal userbean) {
user = userbean.getEventUser(u); user = userbean.getEventUser(u);
......
...@@ -32,9 +32,9 @@ public class AuthView extends GenericCDIView { ...@@ -32,9 +32,9 @@ public class AuthView extends GenericCDIView {
@Inject @Inject
private NavigationHandler navihandler; private NavigationHandler navihandler;
@EJB @EJB
private BootstrapBeanLocal bootStrapBean; private transient BootstrapBeanLocal bootStrapBean;
private HttpServletRequest getRequest() { private HttpServletRequest getRequest() {
FacesContext facesContext = FacesContext.getCurrentInstance(); FacesContext facesContext = FacesContext.getCurrentInstance();
...@@ -60,9 +60,9 @@ public class AuthView extends GenericCDIView { ...@@ -60,9 +60,9 @@ public class AuthView extends GenericCDIView {
} }
public void executeLogin() { public void executeLogin() {
bootStrapBean.saneDefaults(); bootStrapBean.saneDefaults();
if (login == null || password == null || login.isEmpty() || password.isEmpty()) { if (login == null || password == null || login.isEmpty() || password.isEmpty()) {
return; return;
} }
......
...@@ -31,19 +31,19 @@ public class CardView extends GenericCDIView { ...@@ -31,19 +31,19 @@ public class CardView extends GenericCDIView {
private Integer templateId; private Integer templateId;
private CardTemplate cardTemplate; private CardTemplate cardTemplate;
@EJB @EJB
private CardTemplateBeanLocal cfbean; private transient CardTemplateBeanLocal cfbean;
@EJB @EJB
private EventBeanLocal eventBean; private transient EventBeanLocal eventBean;
@Inject @Inject
@SelectedUser @SelectedUser
private EventUser user; private transient EventUser user;
private Integer cardid; private Integer cardid;
private List<CardTemplate> cardTemplates; private List<CardTemplate> cardTemplates;
private UploadedFile templateImage; private transient UploadedFile templateImage;
private static final Logger logger = LoggerFactory.getLogger(CardView.class); private static final Logger logger = LoggerFactory.getLogger(CardView.class);
......
...@@ -16,9 +16,9 @@ public class OrgRoleDataView extends GenericCDIView { ...@@ -16,9 +16,9 @@ public class OrgRoleDataView extends GenericCDIView {
private static final long serialVersionUID = -607046631885684171L; private static final long serialVersionUID = -607046631885684171L;
private transient ListDataModel<OrgRole> orgRoles; private transient ListDataModel<OrgRole> orgRoles;
@EJB @EJB
OrgRoleBeanLocal orgRolesBean; private transient OrgRoleBeanLocal orgRolesBean;
public ListDataModel<OrgRole> getOrgRoles() { public ListDataModel<OrgRole> getOrgRoles() {
...@@ -28,7 +28,7 @@ public class OrgRoleDataView extends GenericCDIView { ...@@ -28,7 +28,7 @@ public class OrgRoleDataView extends GenericCDIView {
return orgRoles; return orgRoles;
} }
public boolean permissionList() { public boolean permissionList() {
return true; return true;
} }
......
...@@ -21,10 +21,10 @@ public class OrgRoleView extends GenericCDIView { ...@@ -21,10 +21,10 @@ public class OrgRoleView extends GenericCDIView {
private OrgRole orgRole; private OrgRole orgRole;
@EJB @EJB
private OrgRoleBeanLocal orgRoleBean; private transient OrgRoleBeanLocal orgRoleBean;
@EJB @EJB
private EventBeanLocal eventBean; private transient EventBeanLocal eventBean;
public void permissionList() { public void permissionList() {
requirePermissions(permbean.hasPermission(UserPermission.READ_ORGROLES)); requirePermissions(permbean.hasPermission(UserPermission.READ_ORGROLES));
......
...@@ -18,13 +18,13 @@ public class UserCardView extends GenericCDIView { ...@@ -18,13 +18,13 @@ public class UserCardView extends GenericCDIView {
private static final long serialVersionUID = -7316229268164228981L; private static final long serialVersionUID = -7316229268164228981L;
@EJB @EJB
private CardTemplateBeanLocal cardBean; private transient CardTemplateBeanLocal cardBean;
@Inject @Inject
@SelectedUser @SelectedUser
private EventUser user; private transient EventUser user;
private ListDataModel<PrintedCard> printedCards; private transient ListDataModel<PrintedCard> printedCards;
public EventUser getUser() { public EventUser getUser() {
return user; return user;
......
...@@ -21,10 +21,10 @@ public class UserSessionView extends GenericCDIView { ...@@ -21,10 +21,10 @@ public class UserSessionView extends GenericCDIView {
private static final long serialVersionUID = -5305969666679378884L; private static final long serialVersionUID = -5305969666679378884L;
@EJB @EJB
private SessionMgmtBeanLocal sessionMgmt; private transient SessionMgmtBeanLocal sessionMgmt;
private ListDataModel<HttpSession> sessions; private transient ListDataModel<HttpSession> sessions;
private HttpSession session; private transient HttpSession session;
private static final Logger logger = LoggerFactory.getLogger(UserSessionView.class); private static final Logger logger = LoggerFactory.getLogger(UserSessionView.class);
public void initView() public void initView()
......
...@@ -43,9 +43,9 @@ public class UserView extends GenericCDIView { ...@@ -43,9 +43,9 @@ public class UserView extends GenericCDIView {
@EJB @EJB
private transient UserBeanLocal userbean; private transient UserBeanLocal userbean;
private Integer userid; private Integer userid;
private UploadedFile image; private transient UploadedFile image;
@EJB @EJB
private CardTemplateBeanLocal ctbean; private transient CardTemplateBeanLocal ctbean;
private CroppedImage croppedImage; private CroppedImage croppedImage;
...@@ -68,12 +68,12 @@ public class UserView extends GenericCDIView { ...@@ -68,12 +68,12 @@ public class UserView extends GenericCDIView {
private String passwordcheck; private String passwordcheck;
@EJB @EJB
private CardTemplateBeanLocal cardBean; private transient CardTemplateBeanLocal cardBean;
private List<Role> usersRoles; private List<Role> usersRoles;
@EJB @EJB
private RoleBeanLocal rolebean; private transient RoleBeanLocal rolebean;
@EJB @EJB
private EventBeanLocal eventbean; private transient EventBeanLocal eventbean;
@Produces @Produces
@LoggedIn @LoggedIn
......
...@@ -23,11 +23,11 @@ public class CompoFileDownloadView extends GenericCDIView { ...@@ -23,11 +23,11 @@ public class CompoFileDownloadView extends GenericCDIView {
private static final long serialVersionUID = -262883747402530562L; private static final long serialVersionUID = -262883747402530562L;
@EJB @EJB
private VotingBeanLocal votebean; private transient VotingBeanLocal votebean;
@Inject @Inject
private CompoEntry entry; private CompoEntry entry;
private ListDataModel<CompoEntryFile> files; private transient ListDataModel<CompoEntryFile> files;
private CompoEntryFile file; private CompoEntryFile file;
private DefaultStreamedContent dlfile; private DefaultStreamedContent dlfile;
......
...@@ -31,24 +31,24 @@ public class CompoView extends GenericCDIView { ...@@ -31,24 +31,24 @@ public class CompoView extends GenericCDIView {
private VotingBeanLocal votbean; private VotingBeanLocal votbean;
@EJB @EJB
private PermissionBeanLocal permbean; private transient PermissionBeanLocal permbean;
private boolean manage; private boolean manage;
private ListDataModel<CompoWrapper> compolist; private transient ListDataModel<CompoWrapper> compolist;
@Produces @Produces
private CompoEntry entry; private CompoEntry entry;
private static final Logger logger = LoggerFactory.getLogger(CompoView.class); private static final Logger logger = LoggerFactory.getLogger(CompoView.class);
private UploadedFile uploadedFile; private transient UploadedFile uploadedFile;
private Compo compo; private Compo compo;
private Integer entryId; private Integer entryId;
private ListDataModel<EntryWrapper> voteEntries; private transient ListDataModel<EntryWrapper> voteEntries;
public ListDataModel<CompoWrapper> getCompos() { public ListDataModel<CompoWrapper> getCompos() {
return compolist; return compolist;
......
...@@ -23,7 +23,7 @@ public class VotingCreateView extends GenericCDIView { ...@@ -23,7 +23,7 @@ public class VotingCreateView extends GenericCDIView {
private static final long serialVersionUID = 4677679766671547462L; private static final long serialVersionUID = 4677679766671547462L;
@EJB @EJB
private VotingBeanLocal votbean; private transient VotingBeanLocal votbean;
@Size(min = 4, message = "{voting.create.nameError}") @Size(min = 4, message = "{voting.create.nameError}")
private String name; private String name;
......
...@@ -23,14 +23,14 @@ public class VotingDetailsView extends GenericCDIView { ...@@ -23,14 +23,14 @@ public class VotingDetailsView extends GenericCDIView {
private static final long serialVersionUID = -8373473936336396427L; private static final long serialVersionUID = -8373473936336396427L;
@EJB @EJB
private VotingBeanLocal votingBean; private transient VotingBeanLocal votingBean;
private Integer compoId; private Integer compoId;
private String compoName; private String compoName;
private Compo compo; private Compo compo;
private ListDataModel<EntryWrapper> entries; private transient ListDataModel<EntryWrapper> entries;
private static final Logger logger = LoggerFactory.getLogger(VotingDetailsView.class); private static final Logger logger = LoggerFactory.getLogger(VotingDetailsView.class);
......
package fi.insomnia.bortal.web.helper; package fi.insomnia.bortal.web.helper;
import java.io.ByteArrayInputStream;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
...@@ -10,10 +11,16 @@ import javax.inject.Inject; ...@@ -10,10 +11,16 @@ import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.beans.EventBeanLocal; import fi.insomnia.bortal.beans.EventBeanLocal;
import fi.insomnia.bortal.beans.PermissionBeanLocal;
import fi.insomnia.bortal.enums.apps.ContentPermission;
import fi.insomnia.bortal.model.LanEventProperty;
import fi.insomnia.bortal.model.LanEventPropertyKey;
@Named @Named
@RequestScoped @RequestScoped
...@@ -25,12 +32,22 @@ public class LayoutView { ...@@ -25,12 +32,22 @@ public class LayoutView {
private String pagename; private String pagename;
@EJB @EJB
private EventBeanLocal eventbean; private EventBeanLocal eventbean;
@EJB
private PermissionBeanLocal permbean;
private StreamedContent headerimage;
private String headertext;
private static final Logger logger = LoggerFactory.getLogger(LayoutView.class); private static final Logger logger = LoggerFactory.getLogger(LayoutView.class);
public void init() { public void init() {
logger.info("Initialized layoutView"); logger.info("Initialized layoutView");
} }
public boolean isManageContent()
{
return permbean.hasPermission(ContentPermission.MANAGE_PAGES);
}
public String getPagepath() { public String getPagepath() {
if (pagename == null) { if (pagename == null) {
HttpServletRequest req = (HttpServletRequest) context.getExternalContext().getRequest(); HttpServletRequest req = (HttpServletRequest) context.getExternalContext().getRequest();
...@@ -73,6 +90,7 @@ public class LayoutView { ...@@ -73,6 +90,7 @@ public class LayoutView {
.append(localize(new StringBuilder("submenu").append(getPagepath().replace('/', '.')).toString())).toString(); .append(localize(new StringBuilder("submenu").append(getPagepath().replace('/', '.')).toString())).toString();
} }
// public String header() { // public String header() {
// logger.info("Context {}", context); // logger.info("Context {}", context);
// UIViewRoot root = context.getViewRoot(); // UIViewRoot root = context.getViewRoot();
...@@ -90,4 +108,33 @@ public class LayoutView { ...@@ -90,4 +108,33 @@ public class LayoutView {
// } // }
// return ""; // return "";
// } // }
public StreamedContent getHeaderimage() {
if (headertext == null && headerimage == null)
{
LanEventProperty logo = eventbean.getProperty(LanEventPropertyKey.EVENT_LOGO);
if (logo != null)
{
if (logo.getByteMime() == null)
{
headertext = logo.getTextvalue();
} else {
headerimage = new DefaultStreamedContent(new ByteArrayInputStream(logo.getByteValue()), logo.getByteMime());
}
}
}
return headerimage;
}
public void setHeaderimage(StreamedContent headerimage) {
this.headerimage = headerimage;
}
public String getHeadertext() {
return headertext;
}
public void setHeadertext(String headertext) {
this.headertext = headertext;
}
} }
...@@ -22,11 +22,13 @@ public class ProductShopItem { ...@@ -22,11 +22,13 @@ public class ProductShopItem {
private List<Discount> discounts; private List<Discount> discounts;
private Map<Integer, BigDecimal> discountValues; private Map<Integer, BigDecimal> discountValues;
private BigDecimal price; private BigDecimal price;
private BigDecimal limit;
public ProductShopItem(Product prod) { public ProductShopItem(Product prod) {
this.product = prod; this.product = prod;
id = this.product.getId(); id = this.product.getId();
setCount(BigDecimal.ZERO); setCount(BigDecimal.ZERO);
} }
/** /**
...@@ -108,4 +110,26 @@ public class ProductShopItem { ...@@ -108,4 +110,26 @@ public class ProductShopItem {
return id; return id;
} }
public void setLimit(BigDecimal l) {
limit = l;
}
public BigDecimal getLimit() {
return limit;
}
public void updateLimit(BigDecimal limit) {
if (limit != null && limit.compareTo(BigDecimal.ZERO) < 0)
{
setCount(getCount().add(limit));
if (getCount().compareTo(BigDecimal.ZERO) < 0)
{
setCount(BigDecimal.ZERO);
}
}
setLimit(limit);
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!