Commit ba2d0e50 by Tuomas Riihimäki

Merge branch 'pieniaKorjailuja' into 'master'

Pienia korjailuja

commit -viestit kertoo kaiken oleellisen muutoksista.

See merge request !220
2 parents 503e0ef2 b7abfbcc
......@@ -33,6 +33,7 @@ import fi.codecrew.moya.facade.ProductFacade;
import fi.codecrew.moya.model.FoodWave;
import fi.codecrew.moya.model.FoodWaveTemplate;
import fi.codecrew.moya.model.Product;
import fi.codecrew.moya.model.ProductFlag;
/**
* Session Bean implementation class FoodWaveBean
......@@ -117,6 +118,7 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
template = fwtFacade.reload(template);
if (product.getId() == null)
{
product.addProductFlag(ProductFlag.HIDE_FROM_INFOSHOP);
productfacade.create(product);
} else {
product = productfacade.reload(product);
......
......@@ -203,8 +203,8 @@ public class ProductBean implements ProductBeanLocal {
public HashMap<Integer, BigDecimal> getProductLimit(Map<Integer, BigDecimal> prodCounts, EventUser user)
{
Set<Role> userroles = new HashSet<Role>(userbean.findUsersRoles(user));
HashMap<Integer, BigDecimal> ret = new HashMap<Integer, BigDecimal>();
Set<Role> userroles = new HashSet<>(userbean.findUsersRoles(user));
HashMap<Integer, BigDecimal> ret = new HashMap<>();
for (Entry<Integer, BigDecimal> pc : prodCounts.entrySet())
{
Product prod = productFacade.find(pc.getKey());
......
......@@ -6,6 +6,7 @@ import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import fi.codecrew.moya.utilities.moyamessage.MoyaEventType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -18,6 +19,10 @@ import fi.codecrew.moya.model.LanEvent;
import fi.codecrew.moya.model.User;
import fi.codecrew.moya.utilities.moyamessage.MoyaEventMessage;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Message-Driven Bean implementation class for: IrcBotTopicListener
*/
......@@ -26,6 +31,8 @@ public class IrcBotMoyaEventTopicListener implements MessageListener {
private static final Logger logger = LoggerFactory.getLogger(IrcBotMoyaEventTopicListener.class);
private static List<MoyaEventType> ignoreTypes = Arrays.asList(MoyaEventType.LOGIN_SUCCESSFULL);
@EJB
private BotBean botbean;
......@@ -42,6 +49,11 @@ public class IrcBotMoyaEventTopicListener implements MessageListener {
public void onMessage(Message message) {
try {
MoyaEventMessage msg = message.getBody(MoyaEventMessage.class);
// do not flood irc-channel, message only really needed ones
if(msg.getEventtype() != null && ignoreTypes.contains(msg.getEventtype()))
return;
String event = "unknown event";
if (msg.getEventId() != null) {
LanEvent e = eventfacade.find(msg.getEventId());
......
......@@ -232,8 +232,12 @@ public class PlaceFacade extends IntegerPkGenericFacade<Place> {
cq.where(
cb.equal(root.get(Place_.map), map),
cb.isFalse(root.get(Place_.disabled))
);
cb.isFalse(root.get(Place_.disabled)),
// TKwtf lisäsi:
cb.isTrue(root.get(Place_.buyable))
);
return getSingleNullableResult(getEm().createQuery(cq));
......@@ -256,7 +260,10 @@ public class PlaceFacade extends IntegerPkGenericFacade<Place> {
cb.equal(root.get(Place_.map), map),
cb.isNull(root.get(Place_.releaseTime)),
cb.isNull(root.get(Place_.group)),
cb.isFalse(root.get(Place_.disabled))
cb.isFalse(root.get(Place_.disabled)),
// TKwtf lisäsi:
cb.isTrue(root.get(Place_.buyable))
);
return getSingleNullableResult(getEm().createQuery(cq));
......
......@@ -43,7 +43,7 @@ public enum LanEventPropertyKey {
TEMPLATE_PROPERTY4(Type.TEXT, null),
TEMPLATE_PROPERTY5(Type.TEXT, null),
INVITE_ONLY_EVENT(Type.BOOL, null),
USE_ETICKET(Type.BOOL, null),
USE_ETICKET(Type.BOOL, "1"),
ETICKETMAIL_SUBJECT(Type.TEXT, "Your etickets to Moya Online Youth Accumulator"),
ETICKETMAIL_CONTENT(Type.TEXT, "Hello {1},\n\nYou can find your etickets to an event from: {0}"),
MAP_QUEUE(Type.BOOL, null),
......
......@@ -22,26 +22,13 @@
*/
package fi.codecrew.moya.model;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.persistence.*;
import org.eclipse.persistence.annotations.PrivateOwned;
......@@ -320,6 +307,20 @@ public class Product extends GenericEntity {
this.productFlags = productFlags;
}
@Transient
public void addProductFlag(ProductFlag flag) {
Set<ProductFlag> flags = getProductFlags();
if(flags == null)
flags = new HashSet<ProductFlag>();
if(!flags.contains(flag)) {
flags.add(flag);
setProductFlags(flags);
}
}
public List<ProductLimitation> getProductLimits() {
return productLimits;
}
......
......@@ -487,3 +487,4 @@ barcodeReader.readBarcode=Lue viivakoodi
incomingflow.allGiven=Merkitty {0} lippu(a) annetuksi.
reader.noReader=Ei valittua lukijaa
etickets.mailSended=Lippu l\u00E4hetetty s\u00E4hk\u00F6postiisi
user.roles=Pakotetut roolit
......@@ -1564,7 +1564,7 @@ user.passwordlengthMessage = Password is too short!
user.phone = Tel
user.profile = Profile
user.realname = Name
user.roles = Roles
user.roles = Forced roles
user.rolesave = Save roles
user.save = Save
user.saveFailed = Save failed, Not enough permissions!
......
......@@ -1549,7 +1549,7 @@ user.phone = Puhelin
user.placegroups = Omat paikkaryhm\u00E4t
user.profile = Profiili
user.realname = Nimi
user.roles = Roolit
user.roles = Pakotetut roolit
user.rolesave = Tallenna roolit
user.save = Tallenna
user.saveRoles = Tallenna roolit
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!