Commit ba3f6556 by Tuomas Riihimäki

Code cleanup

1 parent 8ba089a6
Showing with 178 additions and 315 deletions
...@@ -130,7 +130,7 @@ public abstract class GenericFacade<C extends ModelInterface> { ...@@ -130,7 +130,7 @@ public abstract class GenericFacade<C extends ModelInterface> {
} }
protected SearchResult<C> searcher(SearchQuery search, FacadeCallback<C> cb1, FacadeCallback<C> cb2) { protected SearchResult<C> searcher(SearchQuery search, FacadeCallback<C> cb1, FacadeCallback<C> cb2) {
ArrayList<FacadeCallback<C>> cbs = new ArrayList<FacadeCallback<C>>(); ArrayList<FacadeCallback<C>> cbs = new ArrayList<>();
cbs.add(cb1); cbs.add(cb1);
cbs.add(cb2); cbs.add(cb2);
return searcher(search, cbs); return searcher(search, cbs);
...@@ -138,7 +138,7 @@ public abstract class GenericFacade<C extends ModelInterface> { ...@@ -138,7 +138,7 @@ public abstract class GenericFacade<C extends ModelInterface> {
} }
protected SearchResult<C> searcher(SearchQuery search, FacadeCallback<C> cb1, FacadeCallback<C> cb2, FacadeCallback<C> cb3) { protected SearchResult<C> searcher(SearchQuery search, FacadeCallback<C> cb1, FacadeCallback<C> cb2, FacadeCallback<C> cb3) {
ArrayList<FacadeCallback<C>> cbs = new ArrayList<FacadeCallback<C>>(); ArrayList<FacadeCallback<C>> cbs = new ArrayList<>();
cbs.add(cb1); cbs.add(cb1);
cbs.add(cb2); cbs.add(cb2);
cbs.add(cb3); cbs.add(cb3);
...@@ -147,7 +147,7 @@ public abstract class GenericFacade<C extends ModelInterface> { ...@@ -147,7 +147,7 @@ public abstract class GenericFacade<C extends ModelInterface> {
} }
protected SearchResult<C> searcher(SearchQuery search, FacadeCallback<C> cb1, FacadeCallback<C> cb2, FacadeCallback<C> cb3, FacadeCallback<C> cb4) { protected SearchResult<C> searcher(SearchQuery search, FacadeCallback<C> cb1, FacadeCallback<C> cb2, FacadeCallback<C> cb3, FacadeCallback<C> cb4) {
ArrayList<FacadeCallback<C>> cbs = new ArrayList<FacadeCallback<C>>(); ArrayList<FacadeCallback<C>> cbs = new ArrayList<>();
cbs.add(cb1); cbs.add(cb1);
cbs.add(cb2); cbs.add(cb2);
cbs.add(cb3); cbs.add(cb3);
...@@ -174,7 +174,7 @@ public abstract class GenericFacade<C extends ModelInterface> { ...@@ -174,7 +174,7 @@ public abstract class GenericFacade<C extends ModelInterface> {
listQ.setMaxResults(search.getPagesize()); listQ.setMaxResults(search.getPagesize());
} }
return new SearchResult<C>(listQ.getResultList(), countQ.getSingleResult()); return new SearchResult<>(listQ.getResultList(), countQ.getSingleResult());
} }
protected From<?, C> searchCallbacks(CriteriaQuery<?> cq, List<FacadeCallback<C>> list, boolean isFullQuery) { protected From<?, C> searchCallbacks(CriteriaQuery<?> cq, List<FacadeCallback<C>> list, boolean isFullQuery) {
...@@ -185,7 +185,7 @@ public abstract class GenericFacade<C extends ModelInterface> { ...@@ -185,7 +185,7 @@ public abstract class GenericFacade<C extends ModelInterface> {
Root<T> root = cq.from(clazz); Root<T> root = cq.from(clazz);
ArrayList<Predicate> predicates = handlePredicates(cq, list, root, isFullQuery); ArrayList<Predicate> predicates = handlePredicates(cq, list, root, isFullQuery);
if (!predicates.isEmpty()) { if (!predicates.isEmpty()) {
Predicate[] preds = predicates.toArray(new Predicate[predicates.size()]); Predicate[] preds = predicates.toArray(new Predicate[0]);
cq.where(preds); cq.where(preds);
} }
...@@ -197,7 +197,7 @@ public abstract class GenericFacade<C extends ModelInterface> { ...@@ -197,7 +197,7 @@ public abstract class GenericFacade<C extends ModelInterface> {
CriteriaBuilder cb = getEm().getCriteriaBuilder(); CriteriaBuilder cb = getEm().getCriteriaBuilder();
ArrayList<Predicate> predicates = new ArrayList<Predicate>(); ArrayList<Predicate> predicates = new ArrayList<>();
for (FacadeCallback<T> fc : list) { for (FacadeCallback<T> fc : list) {
if (fc != null) { if (fc != null) {
fc.exec(cb, cq, root, predicates, isFullQuery); fc.exec(cb, cq, root, predicates, isFullQuery);
......
...@@ -28,7 +28,7 @@ import javax.faces.convert.Converter; ...@@ -28,7 +28,7 @@ import javax.faces.convert.Converter;
* Use this converter if you want to do some database find -magic via string * Use this converter if you want to do some database find -magic via string
* @param <T> * @param <T>
*/ */
public abstract class GenericEntityFinderConverter<T extends ModelInterface> implements Converter { public abstract class GenericEntityFinderConverter<T extends ModelInterface> implements Converter<T> {
protected abstract T find(Integer id); protected abstract T find(Integer id);
protected abstract T find(String searchString); protected abstract T find(String searchString);
...@@ -38,7 +38,7 @@ public abstract class GenericEntityFinderConverter<T extends ModelInterface> imp ...@@ -38,7 +38,7 @@ public abstract class GenericEntityFinderConverter<T extends ModelInterface> imp
} }
@Override @Override
public Object getAsObject(FacesContext context, UIComponent component, String value) { public T getAsObject(FacesContext context, UIComponent component, String value) {
T ret = null; T ret = null;
Integer id = null; Integer id = null;
if (value != null) { if (value != null) {
...@@ -56,11 +56,10 @@ public abstract class GenericEntityFinderConverter<T extends ModelInterface> imp ...@@ -56,11 +56,10 @@ public abstract class GenericEntityFinderConverter<T extends ModelInterface> imp
} }
@Override @Override
public String getAsString(FacesContext context, UIComponent component, Object value) { public String getAsString(FacesContext context, UIComponent component, T entity) {
String ret = "0"; String ret = "0";
if (value != null && value instanceof ModelInterface) { if (entity != null) {
ModelInterface entity = (ModelInterface) value;
if (entity.getId() != null) { if (entity.getId() != null) {
ret = entity.getId().toString(); ret = entity.getId().toString();
} }
......
...@@ -24,7 +24,7 @@ import javax.faces.convert.Converter; ...@@ -24,7 +24,7 @@ import javax.faces.convert.Converter;
import fi.codecrew.moya.utilities.jpa.ModelInterface; import fi.codecrew.moya.utilities.jpa.ModelInterface;
public abstract class GenericIntegerEntityConverter<T extends ModelInterface> implements Converter { public abstract class GenericIntegerEntityConverter<T extends ModelInterface> implements Converter<T> {
protected abstract T find(Integer id); protected abstract T find(Integer id);
...@@ -33,7 +33,7 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface> im ...@@ -33,7 +33,7 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface> im
} }
@Override @Override
public Object getAsObject(FacesContext context, UIComponent component, String value) { public T getAsObject(FacesContext context, UIComponent component, String value) {
T ret = null; T ret = null;
Integer id = null; Integer id = null;
if (value != null) { if (value != null) {
...@@ -46,11 +46,10 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface> im ...@@ -46,11 +46,10 @@ public abstract class GenericIntegerEntityConverter<T extends ModelInterface> im
} }
@Override @Override
public String getAsString(FacesContext context, UIComponent component, Object value) { public String getAsString(FacesContext context, UIComponent component, T entity) {
String ret = "0"; String ret = "0";
if (value != null && value instanceof ModelInterface) { if (entity != null) {
ModelInterface entity = (ModelInterface) value;
if (entity.getId() != null) { if (entity.getId() != null) {
ret = entity.getId().toString(); ret = entity.getId().toString();
} }
......
...@@ -44,7 +44,7 @@ public class JsonUtilsTest { ...@@ -44,7 +44,7 @@ public class JsonUtilsTest {
@Test @Test
public final void testGetSubObject() { public final void testGetSubObject() {
JsonObject meta = jsonObject("{\"foo\":\"bar\",\"baz\":{\"quuz\":\"plop\"}}"); JsonObject meta = jsonObject("{\"foo\":\"bar\",\"baz\":{\"quuz\":\"plop\"}}");
ArrayList<String> path = new ArrayList<String>(); ArrayList<String> path = new ArrayList<>();
path.add("baz"); path.add("baz");
JsonValue expected = jsonObject("{\"quuz\":\"plop\"}"); JsonValue expected = jsonObject("{\"quuz\":\"plop\"}");
...@@ -57,7 +57,7 @@ public class JsonUtilsTest { ...@@ -57,7 +57,7 @@ public class JsonUtilsTest {
JsonObject meta = jsonObject("{\"foo\":\"bar\"}"); JsonObject meta = jsonObject("{\"foo\":\"bar\"}");
JsonObject newData = jsonObject("{\"quux\":\"plop\"}"); JsonObject newData = jsonObject("{\"quux\":\"plop\"}");
ArrayList<String> path = new ArrayList<String>(); ArrayList<String> path = new ArrayList<>();
path.add("baz"); path.add("baz");
JsonObject actual = JsonUtils.alterSubObject(meta, path, newData); JsonObject actual = JsonUtils.alterSubObject(meta, path, newData);
...@@ -71,7 +71,7 @@ public class JsonUtilsTest { ...@@ -71,7 +71,7 @@ public class JsonUtilsTest {
JsonObject meta = jsonObject("{\"bystander1\":\"canary1\", \"module1\":{\"bystander2\":\"canary2\",\"submodule1\":{\"replacee1\":\"replacedvalue1\",\"r2\":\"rv2\"}}}"); JsonObject meta = jsonObject("{\"bystander1\":\"canary1\", \"module1\":{\"bystander2\":\"canary2\",\"submodule1\":{\"replacee1\":\"replacedvalue1\",\"r2\":\"rv2\"}}}");
JsonObject newData = jsonObject("{\"quux\":\"plop\"}"); JsonObject newData = jsonObject("{\"quux\":\"plop\"}");
ArrayList<String> path = new ArrayList<String>(); ArrayList<String> path = new ArrayList<>();
path.add("module1"); path.add("module1");
path.add("submodule1"); path.add("submodule1");
......
...@@ -49,7 +49,7 @@ public class GraphQLBuilder { ...@@ -49,7 +49,7 @@ public class GraphQLBuilder {
public Set<GraphQLType> getTypes() { public Set<GraphQLType> getTypes() {
Set<GraphQLType> ret = new HashSet<>(enums.values()); Set<GraphQLType> ret = new HashSet<>(enums.values());
List<GraphQLObjectType> retEnt = entities.values().stream().map(v -> v.build()).collect(Collectors.toList()); List<GraphQLObjectType> retEnt = entities.values().stream().map(v -> v.build()).collect(Collectors.toList());
logger.warn("Returning entities", retEnt); logger.warn("Returning entities: {}", retEnt);
ret.addAll(retEnt); ret.addAll(retEnt);
logger.warn("Enums {}, entities {}", enums, entities); logger.warn("Enums {}, entities {}", enums, entities);
logger.warn("Builder returning types: {}", ret); logger.warn("Builder returning types: {}", ret);
...@@ -59,7 +59,7 @@ public class GraphQLBuilder { ...@@ -59,7 +59,7 @@ public class GraphQLBuilder {
public GraphQLTypeReference typeFor(String typeName) { public GraphQLTypeReference typeFor(String typeName) {
logger.warn("Adding typeFor: {}", typeName); logger.warn("Adding typeFor: {}", typeName);
if (!entities.containsKey(typeName) && !enums.containsKey(typeName)) { if (!entities.containsKey(typeName) && !enums.containsKey(typeName)) {
logger.warn("Adding unknown type: this might be an error!" + typeName, new RuntimeException().fillInStackTrace()); logger.warn("Adding unknown type: {} this might be an error!", typeName, new RuntimeException().fillInStackTrace());
uncheckedTypes.add(typeName); uncheckedTypes.add(typeName);
} }
...@@ -71,14 +71,14 @@ public class GraphQLBuilder { ...@@ -71,14 +71,14 @@ public class GraphQLBuilder {
} }
public <X extends Enum> GraphQLOutputType getEnum(Class<X> type) { public <X extends Enum<?>> GraphQLOutputType getEnum(Class<X> type) {
String name = type.getSimpleName(); String name = type.getSimpleName();
if (name == null) { if (name == null) {
throw new NullPointerException("Trying to get enum with type " + type); throw new NullPointerException("Trying to get enum with type " + type);
} }
if (!enums.containsKey(name)) { if (!enums.containsKey(name)) {
GraphQLEnumType.Builder ret = newEnum().name(name); GraphQLEnumType.Builder ret = newEnum().name(name);
for (Enum c : type.getEnumConstants()) { for (Enum<?> c : type.getEnumConstants()) {
ret.value(c.name()); ret.value(c.name());
} }
enums.put(name, ret.build()); enums.put(name, ret.build());
......
...@@ -16,6 +16,6 @@ public class PropertyFetchWrapper<T, INNER> implements DataFetcher<T> { ...@@ -16,6 +16,6 @@ public class PropertyFetchWrapper<T, INNER> implements DataFetcher<T> {
@Override @Override
public T get(DataFetchingEnvironment environment) { public T get(DataFetchingEnvironment environment) {
INNER field = fetcher.get(environment); INNER field = fetcher.get(environment);
return innerFetcher.get(new DataFetchingEnvironmentWrapper(environment, field)); return innerFetcher.get(new DataFetchingEnvironmentWrapper<>(environment, field));
} }
} }
...@@ -12,5 +12,5 @@ public class ArrayListWrapper<T> { ...@@ -12,5 +12,5 @@ public class ArrayListWrapper<T> {
this.list = list; this.list = list;
} }
public ArrayList<T> list = new ArrayList<T>(); public ArrayList<T> list = new ArrayList<>();
} }
\ No newline at end of file
...@@ -22,12 +22,7 @@ import java.util.List; ...@@ -22,12 +22,7 @@ import java.util.List;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.ws.rs.FormParam; import javax.ws.rs.*;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import fi.codecrew.moya.beans.NetworkAssociationBeanLocal; import fi.codecrew.moya.beans.NetworkAssociationBeanLocal;
......
package fi.codecrew.moya.rest; package fi.codecrew.moya.rest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
...@@ -65,7 +66,7 @@ public class PojoUtils { ...@@ -65,7 +66,7 @@ public class PojoUtils {
} }
public static CardRoot parsePrintedCards(List<PrintedCard> cards) { public static CardRoot parsePrintedCards(List<PrintedCard> cards) {
ArrayList<PrintedCardRestPojo> ret = new ArrayList<PrintedCardRestPojo>(); ArrayList<PrintedCardRestPojo> ret = new ArrayList<>();
for (PrintedCard c : cards) { for (PrintedCard c : cards) {
ret.add(initPrintedCardRestPojo(c)); ret.add(initPrintedCardRestPojo(c));
} }
...@@ -125,7 +126,7 @@ public class PojoUtils { ...@@ -125,7 +126,7 @@ public class PojoUtils {
} }
private static List<PlacePojo> parsePlaces(List<Place> places) { private static List<PlacePojo> parsePlaces(List<Place> places) {
ArrayList<PlacePojo> ret = new ArrayList<PlacePojo>(); ArrayList<PlacePojo> ret = new ArrayList<>();
for (Place place : places) { for (Place place : places) {
ret.add(initPlacePojo(place)); ret.add(initPlacePojo(place));
} }
...@@ -205,7 +206,7 @@ public class PojoUtils { ...@@ -205,7 +206,7 @@ public class PojoUtils {
} }
public static List<ProductRestPojo> parseProducts(List<Product> prods) { public static List<ProductRestPojo> parseProducts(List<Product> prods) {
ArrayList<ProductRestPojo> ret = new ArrayList<ProductRestPojo>(); ArrayList<ProductRestPojo> ret = new ArrayList<>();
for (Product p : prods) { for (Product p : prods) {
ret.add(initProductRestPojo(p)); ret.add(initProductRestPojo(p));
} }
...@@ -217,7 +218,7 @@ public class PojoUtils { ...@@ -217,7 +218,7 @@ public class PojoUtils {
ret.setId(product.getId()); ret.setId(product.getId());
ret.setName(product.getName()); ret.setName(product.getName());
ret.setDescription(product.getDescription()); ret.setDescription(product.getDescription());
ret.setPrice(product.getPrice().setScale(2, BigDecimal.ROUND_HALF_UP).toString()); ret.setPrice(product.getPrice().setScale(2, RoundingMode.HALF_UP).toString());
return ret; return ret;
......
...@@ -22,15 +22,12 @@ import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource; ...@@ -22,15 +22,12 @@ import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource;
import io.swagger.v3.oas.integration.SwaggerConfiguration; import io.swagger.v3.oas.integration.SwaggerConfiguration;
import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.servers.Server;
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.media.multipart.MultiPartFeature; import org.glassfish.jersey.media.multipart.MultiPartFeature;
import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.ResourceConfig;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.servlet.ServletConfig;
import javax.ws.rs.ApplicationPath; import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Context;
import java.util.Arrays; import java.util.Arrays;
......
...@@ -2,7 +2,6 @@ package fi.codecrew.moya.rest; ...@@ -2,7 +2,6 @@ package fi.codecrew.moya.rest;
import fi.codecrew.moya.rest.placemap.v1.PlaceCodePojo; import fi.codecrew.moya.rest.placemap.v1.PlaceCodePojo;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
......
...@@ -43,7 +43,7 @@ public abstract class AbstractRestViewV1 { ...@@ -43,7 +43,7 @@ public abstract class AbstractRestViewV1 {
* @return List<String> * @return List<String>
*/ */
public List<String> pathToStrings(List<PathSegment> path) { public List<String> pathToStrings(List<PathSegment> path) {
ArrayList<String> stringList = new ArrayList<String>(path.size()); ArrayList<String> stringList = new ArrayList<>(path.size());
for (PathSegment s : path) { for (PathSegment s : path) {
String segmentString = s.getPath(); String segmentString = s.getPath();
if (segmentString != null && !segmentString.isEmpty()) { if (segmentString != null && !segmentString.isEmpty()) {
......
package fi.codecrew.moya.rest.placemap.v1; package fi.codecrew.moya.rest.placemap.v1;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import javax.ejb.EJB; import javax.ejb.EJB;
...@@ -9,38 +8,17 @@ import javax.enterprise.context.RequestScoped; ...@@ -9,38 +8,17 @@ import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.BarcodeBeanLocal;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.PermissionBeanLocal; import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.beans.PlaceBeanLocal;
import fi.codecrew.moya.beans.UserBeanLocal;
import fi.codecrew.moya.beans.map.QueueBeanLocal;
import fi.codecrew.moya.enums.apps.MapPermission;
import fi.codecrew.moya.enums.apps.UserPermission;
import fi.codecrew.moya.model.EventMap;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.LanEvent;
import fi.codecrew.moya.model.Place; import fi.codecrew.moya.model.Place;
import fi.codecrew.moya.rest.PojoUtils; import fi.codecrew.moya.rest.PojoUtils;
import fi.codecrew.moya.rest.pojo.placemap.v1.IntegerRoot;
import fi.codecrew.moya.rest.pojo.placemap.v1.PlacemapMapRootPojo;
import fi.codecrew.moya.rest.pojo.placemap.v1.SimplePlacePojo; import fi.codecrew.moya.rest.pojo.placemap.v1.SimplePlacePojo;
import fi.codecrew.moya.rest.pojo.placemap.v1.SimplePlacelistRoot; import fi.codecrew.moya.rest.pojo.placemap.v1.SimplePlacelistRoot;
import fi.codecrew.moya.utilities.PasswordFunctions;
import fi.codecrew.moya.web.cdiview.map.MapPlacechangeView; import fi.codecrew.moya.web.cdiview.map.MapPlacechangeView;
import fi.codecrew.moya.web.cdiview.map.MapPlacechangeView.MoveContainer; import fi.codecrew.moya.web.cdiview.map.MapPlacechangeView.MoveContainer;
import fi.codecrew.moya.web.cdiview.user.UserView;
@RequestScoped @RequestScoped
@Path("/placemove/v1") @Path("/placemove/v1")
......
package fi.codecrew.moya.rest.v2; package fi.codecrew.moya.rest.v2;
import fi.codecrew.moya.enums.Gender; import fi.codecrew.moya.enums.Gender;
import fi.codecrew.moya.model.CardCode;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.PrintedCard;
import fi.codecrew.moya.model.User; import fi.codecrew.moya.model.User;
import fi.codecrew.moya.rest.pojo.userinfo.v3.CardCodePojoV3;
import fi.codecrew.moya.rest.pojo.userinfo.v3.PrintedCardRestPojoV3;
import fi.codecrew.moya.rest.v2.pojo.UserPojo; import fi.codecrew.moya.rest.v2.pojo.UserPojo;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
/** /**
* Created by jkj on 2015-05-31. * Created by jkj on 2015-05-31.
......
...@@ -2,7 +2,6 @@ package fi.codecrew.moya.rest.v2; ...@@ -2,7 +2,6 @@ package fi.codecrew.moya.rest.v2;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
......
...@@ -3,7 +3,6 @@ package fi.codecrew.moya.rest.v3; ...@@ -3,7 +3,6 @@ package fi.codecrew.moya.rest.v3;
import fi.codecrew.moya.beans.EventBeanLocal; import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.UserBeanLocal; import fi.codecrew.moya.beans.UserBeanLocal;
import fi.codecrew.moya.handler.SessionHandler;
import fi.codecrew.moya.handler.SessionStore; import fi.codecrew.moya.handler.SessionStore;
import fi.codecrew.moya.rest.v3.pojo.LocalePojoV3; import fi.codecrew.moya.rest.v3.pojo.LocalePojoV3;
import io.swagger.v3.oas.annotations.OpenAPIDefinition; import io.swagger.v3.oas.annotations.OpenAPIDefinition;
......
package fi.codecrew.moya.rest.v3.pojo; package fi.codecrew.moya.rest.v3.pojo;
import fi.codecrew.moya.model.Vip; import fi.codecrew.moya.model.Vip;
import fi.codecrew.moya.model.VipProduct;
import fi.codecrew.moya.rest.pojo.vip.v2.VipProductPojo; import fi.codecrew.moya.rest.pojo.vip.v2.VipProductPojo;
......
...@@ -69,7 +69,7 @@ public class UserCardPngServlet extends GenericImageServlet { ...@@ -69,7 +69,7 @@ public class UserCardPngServlet extends GenericImageServlet {
@Override @Override
protected ImageMover getImagedata(HttpServletRequest request) { protected ImageMover getImagedata(HttpServletRequest request) {
ImageMover ret = new ImageMover(); ImageMover ret = new ImageMover();
List<String> urlparts = new ArrayList<String>(); List<String> urlparts = new ArrayList<>();
if (request.getPathInfo() != null) if (request.getPathInfo() != null)
{ {
Matcher matcher = URLPATTERN.matcher(request.getPathInfo()); Matcher matcher = URLPATTERN.matcher(request.getPathInfo());
......
...@@ -45,7 +45,6 @@ import fi.codecrew.moya.beans.UserBeanLocal; ...@@ -45,7 +45,6 @@ import fi.codecrew.moya.beans.UserBeanLocal;
import fi.codecrew.moya.beans.UserUtilBeanLocal; import fi.codecrew.moya.beans.UserUtilBeanLocal;
import fi.codecrew.moya.enums.apps.EventPermission; import fi.codecrew.moya.enums.apps.EventPermission;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.LanEvent;
import fi.codecrew.moya.model.Poll; import fi.codecrew.moya.model.Poll;
import fi.codecrew.moya.model.PollQuestion; import fi.codecrew.moya.model.PollQuestion;
import fi.codecrew.moya.model.PossibleAnswer; import fi.codecrew.moya.model.PossibleAnswer;
......
...@@ -2,19 +2,14 @@ package fi.codecrew.moya.web.api; ...@@ -2,19 +2,14 @@ package fi.codecrew.moya.web.api;
import fi.codecrew.moya.beans.ApiApplicationBeanLocal; import fi.codecrew.moya.beans.ApiApplicationBeanLocal;
import fi.codecrew.moya.beans.PermissionBeanLocal; import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.enums.apps.SpecialPermission;
import fi.codecrew.moya.model.ApiApplication; import fi.codecrew.moya.model.ApiApplication;
import fi.codecrew.moya.model.ApiApplicationInstance; import fi.codecrew.moya.model.ApiApplicationInstance;
import fi.codecrew.moya.utilities.PasswordFunctions;
import fi.codecrew.moya.web.cdiview.GenericCDIView; import fi.codecrew.moya.web.cdiview.GenericCDIView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.List;
@Named @Named
@ConversationScoped @ConversationScoped
......
...@@ -6,17 +6,13 @@ import javax.ejb.EJB; ...@@ -6,17 +6,13 @@ import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped; import javax.enterprise.context.ConversationScoped;
import javax.inject.Named; import javax.inject.Named;
import org.primefaces.component.log.Log;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.ApiApplicationBeanLocal; import fi.codecrew.moya.beans.ApiApplicationBeanLocal;
import fi.codecrew.moya.beans.PermissionBeanLocal; import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.beans.api.ApiBeanLocal;
import fi.codecrew.moya.enums.apps.EventPermission;
import fi.codecrew.moya.enums.apps.SpecialPermission; import fi.codecrew.moya.enums.apps.SpecialPermission;
import fi.codecrew.moya.model.ApiApplication; import fi.codecrew.moya.model.ApiApplication;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.web.cdiview.GenericCDIView; import fi.codecrew.moya.web.cdiview.GenericCDIView;
@Named @Named
......
...@@ -84,7 +84,7 @@ public abstract class PaginationView<T extends ModelInterface> extends GenericCD ...@@ -84,7 +84,7 @@ public abstract class PaginationView<T extends ModelInterface> extends GenericCD
public ListDataModel<T> getResultdatamodel() { public ListDataModel<T> getResultdatamodel() {
if (resultdatamodel == null) { if (resultdatamodel == null) {
resultdatamodel = new ListDataModel<T>(results); resultdatamodel = new ListDataModel<>(results);
} }
return resultdatamodel; return resultdatamodel;
} }
......
...@@ -64,7 +64,7 @@ public class CardMassPrintView extends GenericCDIView implements Serializable { ...@@ -64,7 +64,7 @@ public class CardMassPrintView extends GenericCDIView implements Serializable {
public void initView() { public void initView() {
List<EventUser> eventUsers = userCartView.getUsercart(); List<EventUser> eventUsers = userCartView.getUsercart();
ArrayList<Integer> userIdList = new ArrayList<Integer>(); ArrayList<Integer> userIdList = new ArrayList<>();
for (EventUser eu : eventUsers) { for (EventUser eu : eventUsers) {
userIdList.add(eu.getId()); userIdList.add(eu.getId());
} }
...@@ -95,7 +95,7 @@ public class CardMassPrintView extends GenericCDIView implements Serializable { ...@@ -95,7 +95,7 @@ public class CardMassPrintView extends GenericCDIView implements Serializable {
cardPrintBean.acceptMassPrintResult(mpr); cardPrintBean.acceptMassPrintResult(mpr);
} }
userCartView.setUsercart(new ArrayList<EventUser>()); userCartView.setUsercart(new ArrayList<>());
return "accepted"; return "accepted";
} }
......
...@@ -294,19 +294,19 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -294,19 +294,19 @@ public class CardTemplateDataEditView extends GenericCDIView {
} }
public List<CardObjectDataType> getCardObjectDataTypes() { public List<CardObjectDataType> getCardObjectDataTypes() {
return new ArrayList<CardObjectDataType>(Arrays.asList(CardObjectDataType.values())); return new ArrayList<>(Arrays.asList(CardObjectDataType.values()));
} }
public List<CardTextDataType> getCardTextDataTypes() { public List<CardTextDataType> getCardTextDataTypes() {
List<CardTextDataType> types = new ArrayList<CardTextDataType>(Arrays.asList(CardTextDataType.values())); List<CardTextDataType> types = new ArrayList<>(Arrays.asList(CardTextDataType.values()));
return types; return types;
} }
public List<CardTextStyle> getFontStyles() { public List<CardTextStyle> getFontStyles() {
return new ArrayList<CardTextStyle>(Arrays.asList(CardTextStyle.values())); return new ArrayList<>(Arrays.asList(CardTextStyle.values()));
} }
public List<CardTextAlignment> getTextAlignments() { public List<CardTextAlignment> getTextAlignments() {
return new ArrayList<CardTextAlignment>(Arrays.asList(CardTextAlignment.values())); return new ArrayList<>(Arrays.asList(CardTextAlignment.values()));
} }
} }
...@@ -65,7 +65,7 @@ public class SitePageView extends GenericCDIView { ...@@ -65,7 +65,7 @@ public class SitePageView extends GenericCDIView {
{ {
sitepage = new SitePage(); sitepage = new SitePage();
sitepage.setName(managedPage); sitepage.setName(managedPage);
sitepage.setContents(new ArrayList<PageContent>()); sitepage.setContents(new ArrayList<>());
sitepage.getContents().add(new PageContent(sitepage)); sitepage.getContents().add(new PageContent(sitepage));
} }
super.beginConversation(); super.beginConversation();
......
...@@ -92,7 +92,7 @@ public class EticketView extends GenericCDIView { ...@@ -92,7 +92,7 @@ public class EticketView extends GenericCDIView {
} }
public ListDataModel<GroupMembership> getGroupMemberships() { public ListDataModel<GroupMembership> getGroupMemberships() {
memberlist = new ListDataModel<GroupMembership>(ticketBean.findMembershipPrintlistForUser(userView.getSelectedUser())); memberlist = new ListDataModel<>(ticketBean.findMembershipPrintlistForUser(userView.getSelectedUser()));
return memberlist; return memberlist;
} }
......
...@@ -88,7 +88,7 @@ public class StandaloneEticketView extends GenericCDIView { ...@@ -88,7 +88,7 @@ public class StandaloneEticketView extends GenericCDIView {
public ListDataModel<GroupMembership> getGroupMemberships() { public ListDataModel<GroupMembership> getGroupMemberships() {
memberlist = new ListDataModel<GroupMembership>(ticketBean.findMembershipPrintlistForUser(user)); memberlist = new ListDataModel<>(ticketBean.findMembershipPrintlistForUser(user));
return memberlist; return memberlist;
} }
......
...@@ -68,7 +68,7 @@ public class LicenseView extends GenericCDIView { ...@@ -68,7 +68,7 @@ public class LicenseView extends GenericCDIView {
if (licenses == null) { if (licenses == null) {
this.currentLicense = new LicenseTarget(); this.currentLicense = new LicenseTarget();
this.currentLicense.setEvent(eventBean.getCurrentEvent()); this.currentLicense.setEvent(eventBean.getCurrentEvent());
this.licenses = new ListDataModel<LicenseTarget>(licenseBean.findAll(eventBean.getCurrentEvent())); this.licenses = new ListDataModel<>(licenseBean.findAll(eventBean.getCurrentEvent()));
this.beginConversation(); this.beginConversation();
} }
} }
...@@ -78,8 +78,8 @@ public class LicenseView extends GenericCDIView { ...@@ -78,8 +78,8 @@ public class LicenseView extends GenericCDIView {
if (super.requirePermissions(LicensePermission.VIEW_OWN_CODES)) { if (super.requirePermissions(LicensePermission.VIEW_OWN_CODES)) {
if (licenseCodes == null) { if (licenseCodes == null) {
currentUser = permissionBean.getCurrentUser(); currentUser = permissionBean.getCurrentUser();
this.licenseCodes = new ListDataModel<LicenseCode>(currentUser.getUser().getLicenseCodes()); this.licenseCodes = new ListDataModel<>(currentUser.getUser().getLicenseCodes());
this.licenses = new ListDataModel<LicenseTarget>(licenseBean.findUnopenedUserGames(currentUser)); this.licenses = new ListDataModel<>(licenseBean.findUnopenedUserGames(currentUser));
this.beginConversation(); this.beginConversation();
} }
} }
...@@ -87,7 +87,7 @@ public class LicenseView extends GenericCDIView { ...@@ -87,7 +87,7 @@ public class LicenseView extends GenericCDIView {
public String saveCurrentLicense() { public String saveCurrentLicense() {
licenseBean.saveOrCreateLicense(currentLicense); licenseBean.saveOrCreateLicense(currentLicense);
this.licenses = new ListDataModel<LicenseTarget>(licenseBean.findAll(eventBean.getCurrentEvent())); this.licenses = new ListDataModel<>(licenseBean.findAll(eventBean.getCurrentEvent()));
return null; return null;
} }
......
...@@ -31,7 +31,7 @@ public class AjaxMapManageView extends GenericCDIView { ...@@ -31,7 +31,7 @@ public class AjaxMapManageView extends GenericCDIView {
public void placeClicked(ActionEvent event) { public void placeClicked(ActionEvent event) {
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
String placeIdStr = ec.getRequestParameterMap().get("mgmtPlaceId"); String placeIdStr = ec.getRequestParameterMap().get("mgmtPlaceId");
logger.info("Place id {}, str", placeId, placeIdStr); logger.info("Place id {}, str {}", placeId, placeIdStr);
placeId = Integer.parseInt(placeIdStr); placeId = Integer.parseInt(placeIdStr);
place = placebean.find(placeId); place = placebean.find(placeId);
......
package fi.codecrew.moya.web.cdiview.map; package fi.codecrew.moya.web.cdiview.map;
import java.awt.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.*; import java.util.*;
import java.util.List; import java.util.List;
......
...@@ -89,7 +89,7 @@ public class PlacegroupView extends GenericCDIView { ...@@ -89,7 +89,7 @@ public class PlacegroupView extends GenericCDIView {
public String editGroup() { public String editGroup() {
setGroup(placegroups.getRowData()); setGroup(placegroups.getRowData());
setPlacelist(new ListDataModel<Place>(group.getPlaces())); setPlacelist(new ListDataModel<>(group.getPlaces()));
return "/place/editGroup"; return "/place/editGroup";
} }
...@@ -197,7 +197,7 @@ public class PlacegroupView extends GenericCDIView { ...@@ -197,7 +197,7 @@ public class PlacegroupView extends GenericCDIView {
} }
public ListDataModel<GroupMembership> getGroupMemberships() { public ListDataModel<GroupMembership> getGroupMemberships() {
memberlist = new ListDataModel<GroupMembership>(placegroupBean.getMembershipsAndCreations(user)); memberlist = new ListDataModel<>(placegroupBean.getMembershipsAndCreations(user));
return memberlist; return memberlist;
} }
...@@ -251,8 +251,7 @@ public class PlacegroupView extends GenericCDIView { ...@@ -251,8 +251,7 @@ public class PlacegroupView extends GenericCDIView {
public ListDataModel<PlaceGroup> getPlacegroups() { public ListDataModel<PlaceGroup> getPlacegroups() {
if (placegroups == null) { if (placegroups == null) {
List<PlaceGroup> retlist = new ArrayList<PlaceGroup>(); List<PlaceGroup> retlist = new ArrayList<>(placegroupBean.getPlacegroups(user));
retlist.addAll(placegroupBean.getPlacegroups(user));
for (GroupMembership gm : placegroupBean.getMemberships(user)) { for (GroupMembership gm : placegroupBean.getMemberships(user)) {
if (!retlist.contains(gm.getPlaceGroup())) { if (!retlist.contains(gm.getPlaceGroup())) {
...@@ -260,7 +259,7 @@ public class PlacegroupView extends GenericCDIView { ...@@ -260,7 +259,7 @@ public class PlacegroupView extends GenericCDIView {
} }
} }
placegroups = new ListDataModel<PlaceGroup>(retlist); placegroups = new ListDataModel<>(retlist);
} }
return placegroups; return placegroups;
} }
......
...@@ -24,7 +24,6 @@ import fi.codecrew.moya.enums.apps.MapPermission; ...@@ -24,7 +24,6 @@ import fi.codecrew.moya.enums.apps.MapPermission;
import fi.codecrew.moya.model.EventMap; import fi.codecrew.moya.model.EventMap;
import fi.codecrew.moya.model.Place; import fi.codecrew.moya.model.Place;
import fi.codecrew.moya.web.cdiview.GenericCDIView; import fi.codecrew.moya.web.cdiview.GenericCDIView;
import org.joda.time.format.ISODateTimeFormat;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
......
...@@ -76,7 +76,7 @@ public class UnlockedPlaceView extends GenericCDIView { ...@@ -76,7 +76,7 @@ public class UnlockedPlaceView extends GenericCDIView {
public void init() public void init()
{ {
if (places == null) { if (places == null) {
HashMap<EventUser, UnlockedPlaceContainer> usermap = new HashMap<EventUser, UnlockedPlaceContainer>(); HashMap<EventUser, UnlockedPlaceContainer> usermap = new HashMap<>();
EventMap map = null; EventMap map = null;
if (getMapId() != null) { if (getMapId() != null) {
......
...@@ -65,7 +65,7 @@ public class MenuView implements Serializable{ ...@@ -65,7 +65,7 @@ public class MenuView implements Serializable{
private HashSet<MenuNavigation> navis; private HashSet<MenuNavigation> navis;
private Map<String, List<PageContent>> contents = new HashMap<String, List<PageContent>>(); private Map<String, List<PageContent>> contents = new HashMap<>();
@EJB @EJB
private SitePageBeanLocal pagebean; private SitePageBeanLocal pagebean;
...@@ -125,7 +125,7 @@ public class MenuView implements Serializable{ ...@@ -125,7 +125,7 @@ public class MenuView implements Serializable{
public List<JsfMenuitem> getViewChangeTopmenu() public List<JsfMenuitem> getViewChangeTopmenu()
{ {
if (viewchangeTopmenu == null) { if (viewchangeTopmenu == null) {
viewchangeTopmenu = new ArrayList<JsfMenuitem>(); viewchangeTopmenu = new ArrayList<>();
for (MenuNavigation topmenu : menubean.getTopmenus()) { for (MenuNavigation topmenu : menubean.getTopmenus()) {
...@@ -155,8 +155,8 @@ public class MenuView implements Serializable{ ...@@ -155,8 +155,8 @@ public class MenuView implements Serializable{
{ {
if (menus == null) if (menus == null)
{ {
menus = new LinkedList<List<JsfMenuitem>>(); menus = new LinkedList<>();
navis = new HashSet<MenuNavigation>(); navis = new HashSet<>();
MenuNavigation pathIter = menubean.findNavigation(layoutview.getPagepath()); MenuNavigation pathIter = menubean.findNavigation(layoutview.getPagepath());
while (pathIter != null) { while (pathIter != null) {
...@@ -172,7 +172,7 @@ public class MenuView implements Serializable{ ...@@ -172,7 +172,7 @@ public class MenuView implements Serializable{
} }
private LinkedList<JsfMenuitem> addMenu(List<MenuNavigation> children) { private LinkedList<JsfMenuitem> addMenu(List<MenuNavigation> children) {
LinkedList<JsfMenuitem> ret = new LinkedList<JsfMenuitem>(); LinkedList<JsfMenuitem> ret = new LinkedList<>();
// Iterate through children // Iterate through children
for (MenuNavigation child : children) { for (MenuNavigation child : children) {
// if is visible, permission is null or has permission, continue // if is visible, permission is null or has permission, continue
......
...@@ -256,7 +256,7 @@ public class EventOrgView extends GenericCDIView { ...@@ -256,7 +256,7 @@ public class EventOrgView extends GenericCDIView {
public void setEvent(LanEvent event) { public void setEvent(LanEvent event) {
this.event = event; this.event = event;
eventdomains = new ListDataModel<LanEventDomain>(event.getDomains()); eventdomains = new ListDataModel<>(event.getDomains());
} }
public ListDataModel<LanEventDomain> getEventdomains() { public ListDataModel<LanEventDomain> getEventdomains() {
...@@ -317,7 +317,7 @@ public class EventOrgView extends GenericCDIView { ...@@ -317,7 +317,7 @@ public class EventOrgView extends GenericCDIView {
public List<User> getSuperUsers() { public List<User> getSuperUsers() {
if (!permbean.getCurrentUser().isSuperadmin()) if (!permbean.getCurrentUser().isSuperadmin())
return new ArrayList<User>(); return new ArrayList<>();
return userBean.findSuperusers(); return userBean.findSuperusers();
} }
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
*/ */
package fi.codecrew.moya.web.cdiview.organisation; package fi.codecrew.moya.web.cdiview.organisation;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -66,7 +65,7 @@ public class EventPropertyView extends GenericCDIView { ...@@ -66,7 +65,7 @@ public class EventPropertyView extends GenericCDIView {
private LanEventPrivateProperty privateProperty; private LanEventPrivateProperty privateProperty;
public List<LanEventPropertyKey> getAvailablePropertyKeys() { public List<LanEventPropertyKey> getAvailablePropertyKeys() {
List<LanEventPropertyKey> ret = new ArrayList<LanEventPropertyKey>(Arrays.asList(LanEventPropertyKey.values())); List<LanEventPropertyKey> ret = new ArrayList<>(Arrays.asList(LanEventPropertyKey.values()));
if (createKey != null) { if (createKey != null) {
ret.remove(createKey); ret.remove(createKey);
} }
...@@ -81,7 +80,7 @@ public class EventPropertyView extends GenericCDIView { ...@@ -81,7 +80,7 @@ public class EventPropertyView extends GenericCDIView {
public List<LanEventPrivatePropertyKey> getAvailablePrivatePropertyKeys() { public List<LanEventPrivatePropertyKey> getAvailablePrivatePropertyKeys() {
List<LanEventPrivatePropertyKey> ret = null; List<LanEventPrivatePropertyKey> ret = null;
if (isPrivatePropertyPermission() && eventbean.getCurrentEvent().equals(eventorgview.getEvent())) { if (isPrivatePropertyPermission() && eventbean.getCurrentEvent().equals(eventorgview.getEvent())) {
ret = new ArrayList<LanEventPrivatePropertyKey>(Arrays.asList(LanEventPrivatePropertyKey.values())); ret = new ArrayList<>(Arrays.asList(LanEventPrivatePropertyKey.values()));
if (createPrivateKey != null) { if (createPrivateKey != null) {
ret.remove(createPrivateKey); ret.remove(createPrivateKey);
} }
...@@ -220,14 +219,14 @@ public class EventPropertyView extends GenericCDIView { ...@@ -220,14 +219,14 @@ public class EventPropertyView extends GenericCDIView {
public ListDataModel<LanEventProperty> getProperties() { public ListDataModel<LanEventProperty> getProperties() {
if (properties == null && eventorgview != null && eventorgview.getEvent() != null) { if (properties == null && eventorgview != null && eventorgview.getEvent() != null) {
properties = new ListDataModel<LanEventProperty>(eventorgview.getEvent().getProperties()); properties = new ListDataModel<>(eventorgview.getEvent().getProperties());
} }
return properties; return properties;
} }
public ListDataModel<LanEventPrivateProperty> getPrivateProperties() { public ListDataModel<LanEventPrivateProperty> getPrivateProperties() {
if (privateProperties == null && eventorgview != null && eventbean.getCurrentEvent().equals(eventorgview.getEvent())) { if (privateProperties == null && eventorgview != null && eventbean.getCurrentEvent().equals(eventorgview.getEvent())) {
privateProperties = new ListDataModel<LanEventPrivateProperty>(eventbean.getPrivateProperties()); privateProperties = new ListDataModel<>(eventbean.getPrivateProperties());
} }
return privateProperties; return privateProperties;
} }
......
...@@ -102,13 +102,13 @@ public class PollView extends GenericCDIView { ...@@ -102,13 +102,13 @@ public class PollView extends GenericCDIView {
return; return;
} }
logger.debug("initializing poll questions {}", poll.getQuestions()); logger.debug("initializing poll questions {}", poll.getQuestions());
pages = new HashMap<Integer, List<QuestionWrapper>>(); pages = new HashMap<>();
for (PollQuestion q : poll.getQuestions()) { for (PollQuestion q : poll.getQuestions()) {
if (!getPages().containsKey(q.getPage())) { if (!getPages().containsKey(q.getPage())) {
getPages().put(q.getPage(), new LinkedList<QuestionWrapper>()); getPages().put(q.getPage(), new LinkedList<>());
} }
getPages().get(q.getPage()).add(new QuestionWrapper(q)); getPages().get(q.getPage()).add(new QuestionWrapper(q));
} }
...@@ -134,7 +134,7 @@ public class PollView extends GenericCDIView { ...@@ -134,7 +134,7 @@ public class PollView extends GenericCDIView {
} }
private List<PollAnswer> createAnswers() { private List<PollAnswer> createAnswers() {
ArrayList<PollAnswer> ret = new ArrayList<PollAnswer>(); ArrayList<PollAnswer> ret = new ArrayList<>();
for (List<QuestionWrapper> qw : getPages().values()) { for (List<QuestionWrapper> qw : getPages().values()) {
for (QuestionWrapper wrapper : qw) { for (QuestionWrapper wrapper : qw) {
ret.addAll(wrapper.getAnswers()); ret.addAll(wrapper.getAnswers());
...@@ -200,7 +200,7 @@ public class PollView extends GenericCDIView { ...@@ -200,7 +200,7 @@ public class PollView extends GenericCDIView {
public QuestionWrapper(PollQuestion q) { public QuestionWrapper(PollQuestion q) {
question = q; question = q;
answers = new ArrayList<PollAnswer>(); answers = new ArrayList<>();
for (PossibleAnswer possible : q.getAnswers()) { for (PossibleAnswer possible : q.getAnswers()) {
answers.add(new PollAnswer(possible)); answers.add(new PollAnswer(possible));
} }
......
...@@ -61,7 +61,7 @@ public class ReaderListDataView extends GenericCDIView { ...@@ -61,7 +61,7 @@ public class ReaderListDataView extends GenericCDIView {
public ListDataModel<Reader> getReaders() public ListDataModel<Reader> getReaders()
{ {
if (readers == null) { if (readers == null) {
readers = new ListDataModel<Reader>(readerbean.getReaders()); readers = new ListDataModel<>(readerbean.getReaders());
} }
return readers; return readers;
} }
...@@ -82,7 +82,7 @@ public class ReaderListDataView extends GenericCDIView { ...@@ -82,7 +82,7 @@ public class ReaderListDataView extends GenericCDIView {
public ListDataModel<Reader> getSelectedReaders() { public ListDataModel<Reader> getSelectedReaders() {
ArrayList<Reader> readers = new ArrayList<Reader>(); ArrayList<Reader> readers = new ArrayList<>();
for(Integer rid : readerNameContainer.getReaders()) { for(Integer rid : readerNameContainer.getReaders()) {
Reader r = readerbean.getReader(rid); Reader r = readerbean.getReader(rid);
...@@ -91,7 +91,7 @@ public class ReaderListDataView extends GenericCDIView { ...@@ -91,7 +91,7 @@ public class ReaderListDataView extends GenericCDIView {
readers.add(r); readers.add(r);
} }
return new ListDataModel<Reader>(readers); return new ListDataModel<>(readers);
} }
} }
......
...@@ -37,7 +37,7 @@ public class ReaderNameContainer implements Serializable { ...@@ -37,7 +37,7 @@ public class ReaderNameContainer implements Serializable {
//private Integer readerId; //private Integer readerId;
// handling first user when using via getReaderId and setReaderId; // handling first user when using via getReaderId and setReaderId;
private final List<Integer> readers = new ArrayList<Integer>();; private final List<Integer> readers = new ArrayList<>();;
private boolean autopoll = false; private boolean autopoll = false;
......
...@@ -27,6 +27,7 @@ import javax.faces.model.ListDataModel; ...@@ -27,6 +27,7 @@ import javax.faces.model.ListDataModel;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import fi.codecrew.moya.model.role.Role;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -40,7 +41,6 @@ import fi.codecrew.moya.model.Product; ...@@ -40,7 +41,6 @@ import fi.codecrew.moya.model.Product;
import fi.codecrew.moya.model.Reader; import fi.codecrew.moya.model.Reader;
import fi.codecrew.moya.model.ReaderEvent; import fi.codecrew.moya.model.ReaderEvent;
import fi.codecrew.moya.model.ReaderType; import fi.codecrew.moya.model.ReaderType;
import fi.codecrew.moya.model.Role;
import fi.codecrew.moya.web.cdiview.GenericCDIView; import fi.codecrew.moya.web.cdiview.GenericCDIView;
import fi.codecrew.moya.web.cdiview.shop.UserCardWrapper; import fi.codecrew.moya.web.cdiview.shop.UserCardWrapper;
import fi.codecrew.moya.web.cdiview.user.UserView; import fi.codecrew.moya.web.cdiview.user.UserView;
...@@ -163,7 +163,7 @@ public class ReaderView extends GenericCDIView { ...@@ -163,7 +163,7 @@ public class ReaderView extends GenericCDIView {
public List<Product> getAutoProducts() { public List<Product> getAutoProducts() {
List<Product> ret = new ArrayList<Product>(); List<Product> ret = new ArrayList<>();
ret.add(Product.EMPTY_PRODUCT); ret.add(Product.EMPTY_PRODUCT);
ret.addAll(shopBean.getProducts()); ret.addAll(shopBean.getProducts());
return ret; return ret;
...@@ -177,7 +177,7 @@ public class ReaderView extends GenericCDIView { ...@@ -177,7 +177,7 @@ public class ReaderView extends GenericCDIView {
public ListDataModel<ReaderEvent> getReaderEvents() public ListDataModel<ReaderEvent> getReaderEvents()
{ {
readerEventList = new ListDataModel<ReaderEvent>(readerbean.getReaderEvents(namecontainer.getReaderId())); readerEventList = new ListDataModel<>(readerbean.getReaderEvents(namecontainer.getReaderId()));
return readerEventList; return readerEventList;
} }
......
...@@ -28,7 +28,6 @@ import javax.inject.Named; ...@@ -28,7 +28,6 @@ import javax.inject.Named;
import fi.codecrew.moya.beans.CheckoutFiV2BeanLocal; import fi.codecrew.moya.beans.CheckoutFiV2BeanLocal;
import fi.codecrew.moya.beans.EventBeanLocal; import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.checkout.CheckoutCreateResponsePojo; import fi.codecrew.moya.beans.checkout.CheckoutCreateResponsePojo;
import fi.codecrew.moya.model.LanEventProperty;
import fi.codecrew.moya.model.LanEventPropertyKey; import fi.codecrew.moya.model.LanEventPropertyKey;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
......
...@@ -131,7 +131,7 @@ public class BillListView extends GenericCDIView { ...@@ -131,7 +131,7 @@ public class BillListView extends GenericCDIView {
public void initSummaryView() public void initSummaryView()
{ {
if (super.requirePermissions(BillPermission.READ_ALL)) { if (super.requirePermissions(BillPermission.READ_ALL)) {
setBillsummary(new ArrayList<BillSummary>(billbean.getBillLineSummary())); setBillsummary(new ArrayList<>(billbean.getBillLineSummary()));
} }
} }
......
...@@ -18,15 +18,12 @@ ...@@ -18,15 +18,12 @@
*/ */
package fi.codecrew.moya.web.cdiview.shop; package fi.codecrew.moya.web.cdiview.shop;
import fi.codecrew.moya.beans.CheckoutFiBeanLocal;
import fi.codecrew.moya.beans.CheckoutFiV2BeanLocal; import fi.codecrew.moya.beans.CheckoutFiV2BeanLocal;
import fi.codecrew.moya.util.CheckoutReturnType;
import fi.codecrew.moya.web.cdiview.GenericCDIView; import fi.codecrew.moya.web.cdiview.GenericCDIView;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.faces.event.ComponentSystemEvent;
import javax.inject.Named; import javax.inject.Named;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration; import java.util.Enumeration;
......
...@@ -66,7 +66,7 @@ public class DiscountView extends GenericCDIView { ...@@ -66,7 +66,7 @@ public class DiscountView extends GenericCDIView {
public String create() { public String create() {
if (product.getDiscounts() == null) { if (product.getDiscounts() == null) {
product.setDiscounts(new ArrayList<Discount>()); product.setDiscounts(new ArrayList<>());
} }
product.getDiscounts().add(discount); product.getDiscounts().add(discount);
......
...@@ -90,7 +90,7 @@ public class FoodWaveFoodView extends GenericCDIView { ...@@ -90,7 +90,7 @@ public class FoodWaveFoodView extends GenericCDIView {
foodWave = foodWaveBean.findFoodwave(getFoodwaveid()); foodWave = foodWaveBean.findFoodwave(getFoodwaveid());
logger.debug("Foodwave {}", foodWave); logger.debug("Foodwave {}", foodWave);
shoppingcart = new ListDataModel<ProductShopItem>(ProductShopItem.productGTList(foodWave.getTemplate().getProducts(), userview.getSelectedUser())); shoppingcart = new ListDataModel<>(ProductShopItem.productGTList(foodWave.getTemplate().getProducts(), userview.getSelectedUser()));
this.beginConversation(); this.beginConversation();
} }
...@@ -232,9 +232,8 @@ public class FoodWaveFoodView extends GenericCDIView { ...@@ -232,9 +232,8 @@ public class FoodWaveFoodView extends GenericCDIView {
} }
private boolean productsInCart() { private boolean productsInCart() {
Iterator<ProductShopItem> nullcheckIter = getShoppingcart().iterator(); for (ProductShopItem productShopItem : getShoppingcart()) {
while (nullcheckIter.hasNext()) { if (productShopItem.getCount().compareTo(BigDecimal.ZERO) > 0) {
if (nullcheckIter.next().getCount().compareTo(BigDecimal.ZERO) > 0) {
return true; return true;
} }
} }
......
...@@ -108,7 +108,7 @@ public class FoodWaveView extends GenericCDIView { ...@@ -108,7 +108,7 @@ public class FoodWaveView extends GenericCDIView {
} }
} }
foodWaves = new ListDataModel<FoodWave>(foodWaveBean.getEventFoodWaves()); foodWaves = new ListDataModel<>(foodWaveBean.getEventFoodWaves());
} }
public String createFoodwave() { public String createFoodwave() {
...@@ -132,9 +132,9 @@ public class FoodWaveView extends GenericCDIView { ...@@ -132,9 +132,9 @@ public class FoodWaveView extends GenericCDIView {
if (templateId != null) if (templateId != null)
{ {
template = foodWaveBean.findTemplate(templateId); template = foodWaveBean.findTemplate(templateId);
foodWaves = new ListDataModel<FoodWave>(template.getFoodwaves()); foodWaves = new ListDataModel<>(template.getFoodwaves());
} else { } else {
foodWaves = new ListDataModel<FoodWave>(foodWaveBean.getOpenFoodWaves()); foodWaves = new ListDataModel<>(foodWaveBean.getOpenFoodWaves());
} }
super.beginConversation(); super.beginConversation();
} }
...@@ -160,7 +160,7 @@ public class FoodWaveView extends GenericCDIView { ...@@ -160,7 +160,7 @@ public class FoodWaveView extends GenericCDIView {
if (super.requirePermissions(ShopPermission.MANAGE_PRODUCTS) && template == null) if (super.requirePermissions(ShopPermission.MANAGE_PRODUCTS) && template == null)
{ {
template = new FoodWaveTemplate(); template = new FoodWaveTemplate();
template.setProducts(new ArrayList<Product>()); template.setProducts(new ArrayList<>());
template.setEvent(eventbean.getCurrentEvent()); template.setEvent(eventbean.getCurrentEvent());
createNewProductSkeleton(); createNewProductSkeleton();
...@@ -172,7 +172,7 @@ public class FoodWaveView extends GenericCDIView { ...@@ -172,7 +172,7 @@ public class FoodWaveView extends GenericCDIView {
public List<FoodwaveProductSummary> getProductSummaries() { public List<FoodwaveProductSummary> getProductSummaries() {
HashMap<Product, FoodwaveProductSummary> pmap = new HashMap<Product, FoodwaveProductSummary>(); HashMap<Product, FoodwaveProductSummary> pmap = new HashMap<>();
for (AccountEvent ae : getSelectedFoodWave().getAccountEvents()) { for (AccountEvent ae : getSelectedFoodWave().getAccountEvents()) {
if (!pmap.containsKey(ae.getProduct())) { if (!pmap.containsKey(ae.getProduct())) {
...@@ -183,11 +183,11 @@ public class FoodWaveView extends GenericCDIView { ...@@ -183,11 +183,11 @@ public class FoodWaveView extends GenericCDIView {
pmap.get(ae.getProduct()).add(ae); pmap.get(ae.getProduct()).add(ae);
} }
System.out.println("::" + pmap.values().size()); System.out.println("::" + pmap.values().size());
return new ArrayList<FoodwaveProductSummary>(pmap.values()); return new ArrayList<>(pmap.values());
} }
private void createNewProductSkeleton() { private void createNewProductSkeleton() {
TreeSet<ProductFlag> ts = new TreeSet<ProductFlag>(); TreeSet<ProductFlag> ts = new TreeSet<>();
currentProduct = new Product(); currentProduct = new Product();
currentProduct.setProductFlags(ts); currentProduct.setProductFlags(ts);
...@@ -343,7 +343,7 @@ public class FoodWaveView extends GenericCDIView { ...@@ -343,7 +343,7 @@ public class FoodWaveView extends GenericCDIView {
} }
HashSet<Bill> billList = new HashSet<Bill>(); HashSet<Bill> billList = new HashSet<>();
for (BillLine line : getSelectedFoodWave().getBillLines()) { for (BillLine line : getSelectedFoodWave().getBillLines()) {
if (!line.getBill().isPaid()) { if (!line.getBill().isPaid()) {
...@@ -351,11 +351,11 @@ public class FoodWaveView extends GenericCDIView { ...@@ -351,11 +351,11 @@ public class FoodWaveView extends GenericCDIView {
} }
} }
bills = new ListDataModel<Bill>(new ArrayList<Bill>(billList)); bills = new ListDataModel<>(new ArrayList<>(billList));
accountEventLines = new ListDataModel<AccountEvent>(getSelectedFoodWave().getAccountEvents()); accountEventLines = new ListDataModel<>(getSelectedFoodWave().getAccountEvents());
} }
......
...@@ -127,7 +127,7 @@ public class ProductShopView extends GenericCDIView { ...@@ -127,7 +127,7 @@ public class ProductShopView extends GenericCDIView {
return; return;
} }
shoppingcart = new ListDataModel<ProductShopItem>( shoppingcart = new ListDataModel<>(
ProductShopItem.productList(productBean.listUserShoppableProducts(), userView.getSelectedUser())); ProductShopItem.productList(productBean.listUserShoppableProducts(), userView.getSelectedUser()));
for (ProductShopItem item : shoppingcart) { for (ProductShopItem item : shoppingcart) {
...@@ -172,7 +172,7 @@ public class ProductShopView extends GenericCDIView { ...@@ -172,7 +172,7 @@ public class ProductShopView extends GenericCDIView {
public void initShopView() { public void initShopView() {
if (requirePermissions(ShopPermission.SHOP_TO_OTHERS) && shoppingcart == null) { if (requirePermissions(ShopPermission.SHOP_TO_OTHERS) && shoppingcart == null) {
shoppingcart = new ListDataModel<ProductShopItem>(ProductShopItem.productGTList(productBean.findForStaffshop(), userView.getSelectedUser())); shoppingcart = new ListDataModel<>(ProductShopItem.productGTList(productBean.findForStaffshop(), userView.getSelectedUser()));
updateCartLimits(null); updateCartLimits(null);
LanEventProperty cashdefault = eventbean.getProperty(LanEventPropertyKey.SHOP_DEFAULT_CASH); LanEventProperty cashdefault = eventbean.getProperty(LanEventPropertyKey.SHOP_DEFAULT_CASH);
...@@ -236,7 +236,7 @@ public class ProductShopView extends GenericCDIView { ...@@ -236,7 +236,7 @@ public class ProductShopView extends GenericCDIView {
public void updateCartLimits(ProductShopItem item) { public void updateCartLimits(ProductShopItem item) {
if (boughtItems == null) { if (boughtItems == null) {
boughtItems = new ListDataModel<ProductShopItem>(new ArrayList<ProductShopItem>()); boughtItems = new ListDataModel<>(new ArrayList<>());
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
...@@ -246,7 +246,7 @@ public class ProductShopView extends GenericCDIView { ...@@ -246,7 +246,7 @@ public class ProductShopView extends GenericCDIView {
listdata.add(item); listdata.add(item);
} }
Map<Integer, BigDecimal> prodCounts = new HashMap<Integer, BigDecimal>(); Map<Integer, BigDecimal> prodCounts = new HashMap<>();
for (ProductShopItem sc : shoppingcart) { for (ProductShopItem sc : shoppingcart) {
prodCounts.put(sc.getProduct().getId(), sc.getCount()); prodCounts.put(sc.getProduct().getId(), sc.getCount());
} }
...@@ -438,9 +438,7 @@ public class ProductShopView extends GenericCDIView { ...@@ -438,9 +438,7 @@ public class ProductShopView extends GenericCDIView {
} }
private boolean productsInCart() { private boolean productsInCart() {
Iterator<ProductShopItem> nullcheckIter = shoppingcart.iterator(); for (ProductShopItem prod : shoppingcart) {
while (nullcheckIter.hasNext()) {
ProductShopItem prod = nullcheckIter.next();
// Autoproduct is not counted as a real product. // Autoproduct is not counted as a real product.
if (!prod.getProduct().getProductFlags().contains(ProductFlag.USERSHOP_AUTOPRODUCT) && prod.getCount().compareTo(BigDecimal.ZERO) > 0) { if (!prod.getProduct().getProductFlags().contains(ProductFlag.USERSHOP_AUTOPRODUCT) && prod.getCount().compareTo(BigDecimal.ZERO) > 0) {
return true; return true;
......
...@@ -19,33 +19,16 @@ ...@@ -19,33 +19,16 @@
package fi.codecrew.moya.web.cdiview.shop; package fi.codecrew.moya.web.cdiview.shop;
import fi.codecrew.moya.beans.BillBeanLocal; import fi.codecrew.moya.beans.BillBeanLocal;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.VerkkomaksutFiBeanLocal;
import fi.codecrew.moya.bortal.views.BillSummary;
import fi.codecrew.moya.entitysearch.BillSearchQuery;
import fi.codecrew.moya.enums.apps.BillPermission; import fi.codecrew.moya.enums.apps.BillPermission;
import fi.codecrew.moya.exceptions.BillException;
import fi.codecrew.moya.model.Bill;
import fi.codecrew.moya.model.BillLine; import fi.codecrew.moya.model.BillLine;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.utilities.SearchQuery.QuerySortOrder;
import fi.codecrew.moya.utilities.SearchResult;
import fi.codecrew.moya.utilities.jsf.MessageHelper;
import fi.codecrew.moya.web.annotations.SelectedUser;
import fi.codecrew.moya.web.cdiview.GenericCDIView; import fi.codecrew.moya.web.cdiview.GenericCDIView;
import fi.codecrew.moya.web.helpers.LazyEntityDataModel;
import org.primefaces.model.SortOrder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped; import javax.enterprise.context.ConversationScoped;
import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.Map;
@Named @Named
@ConversationScoped @ConversationScoped
......
...@@ -160,7 +160,7 @@ public class ProductView extends GenericCDIView { ...@@ -160,7 +160,7 @@ public class ProductView extends GenericCDIView {
public String saveLimit() public String saveLimit()
{ {
if (product.getProductLimits() == null) { if (product.getProductLimits() == null) {
product.setProductLimits(new ArrayList<ProductLimitation>()); product.setProductLimits(new ArrayList<>());
} }
if (!product.getProductLimits().contains(limit)) { if (!product.getProductLimits().contains(limit)) {
product.getProductLimits().add(limit); product.getProductLimits().add(limit);
...@@ -217,13 +217,13 @@ public class ProductView extends GenericCDIView { ...@@ -217,13 +217,13 @@ public class ProductView extends GenericCDIView {
{ {
List<Discount> discs = product.getDiscounts(); List<Discount> discs = product.getDiscounts();
discs.sort(Discount.SORT_COMPARATOR); discs.sort(Discount.SORT_COMPARATOR);
productDiscounts = new ListDataModel<Discount>(discs); productDiscounts = new ListDataModel<>(discs);
return productDiscounts; return productDiscounts;
} }
public ListDataModel<ProductLimitation> getProductLimits() public ListDataModel<ProductLimitation> getProductLimits()
{ {
productLimits = new ListDataModel<ProductLimitation>(product.getProductLimits()); productLimits = new ListDataModel<>(product.getProductLimits());
return productLimits; return productLimits;
} }
......
...@@ -49,7 +49,7 @@ public class SalespointListView extends GenericCDIView { ...@@ -49,7 +49,7 @@ public class SalespointListView extends GenericCDIView {
if (super.requirePermissions(SalespointPermission.VIEW)) { if (super.requirePermissions(SalespointPermission.VIEW)) {
beginConversation(); beginConversation();
salespoints = new ListDataModel<Salespoint>( salespoints = new ListDataModel<>(
salespointBean.findAll()); salespointBean.findAll());
modifySalespoint = permbean modifySalespoint = permbean
.hasPermission(SalespointPermission.MODIFY); .hasPermission(SalespointPermission.MODIFY);
......
...@@ -42,17 +42,17 @@ public class UserCardWrapper implements Serializable { ...@@ -42,17 +42,17 @@ public class UserCardWrapper implements Serializable {
if (user != null) { if (user != null) {
cards = user.getPrintedCards(); cards = user.getPrintedCards();
} }
printedCards = new ListDataModel<PrintedCard>(cards); printedCards = new ListDataModel<>(cards);
} }
public static ListDataModel<UserCardWrapper> initWrapper(List<User> users, UserBeanLocal userbean) public static ListDataModel<UserCardWrapper> initWrapper(List<User> users, UserBeanLocal userbean)
{ {
List<UserCardWrapper> ret = new ArrayList<UserCardWrapper>(); List<UserCardWrapper> ret = new ArrayList<>();
for (User u : users) for (User u : users)
{ {
ret.add(new UserCardWrapper(u, userbean)); ret.add(new UserCardWrapper(u, userbean));
} }
return new ListDataModel<UserCardWrapper>(ret); return new ListDataModel<>(ret);
} }
public EventUser getUser() { public EventUser getUser() {
......
...@@ -40,7 +40,7 @@ public class TournamentAddTeamView implements Serializable { ...@@ -40,7 +40,7 @@ public class TournamentAddTeamView implements Serializable {
// Players // Players
setPlayers(new ArrayList<String>()); setPlayers(new ArrayList<>());
getPlayers().add(""); getPlayers().add("");
getPlayers().add(""); getPlayers().add("");
getPlayers().add(""); getPlayers().add("");
......
...@@ -49,7 +49,7 @@ public class TournamentParticipantsView extends GenericCDIView { ...@@ -49,7 +49,7 @@ public class TournamentParticipantsView extends GenericCDIView {
if(eventUserGameID == null) { if(eventUserGameID == null) {
this.tournament = tournamentBean.getTournamentById(tournamentId); this.tournament = tournamentBean.getTournamentById(tournamentId);
this.beginConversation(); this.beginConversation();
eventUserGameID = new HashMap<Integer, String>(); eventUserGameID = new HashMap<>();
for(TournamentParticipant tp : tournament.getParticipants()) { for(TournamentParticipant tp : tournament.getParticipants()) {
for(TournamentTeamMember ttm : tp.getTeamMembers()) { for(TournamentTeamMember ttm : tp.getTeamMembers()) {
GameID gid = userBean.getGameIDByGameAndUser(tournament.getTournamentGame(), ttm.getEventUser()); GameID gid = userBean.getGameIDByGameAndUser(tournament.getTournamentGame(), ttm.getEventUser());
......
...@@ -114,7 +114,7 @@ public class TournamentParticipateView extends GenericCDIView { ...@@ -114,7 +114,7 @@ public class TournamentParticipateView extends GenericCDIView {
tournamentParticipant = new TournamentParticipant(); tournamentParticipant = new TournamentParticipant();
tournamentParticipant.setTournament(tournament); tournamentParticipant.setTournament(tournament);
tournamentParticipant.setParticipator(permissionBean.getCurrentUser()); tournamentParticipant.setParticipator(permissionBean.getCurrentUser());
tournamentParticipant.setTeamMembers(new ArrayList<TournamentTeamMember>()); tournamentParticipant.setTeamMembers(new ArrayList<>());
TournamentTeamMember captain = new TournamentTeamMember(); TournamentTeamMember captain = new TournamentTeamMember();
captain.setRole(TournamentTeamMemberRole.CAPTAIN); captain.setRole(TournamentTeamMemberRole.CAPTAIN);
captain.setEventUser(permissionBean.getCurrentUser()); captain.setEventUser(permissionBean.getCurrentUser());
......
...@@ -19,44 +19,17 @@ ...@@ -19,44 +19,17 @@
package fi.codecrew.moya.web.cdiview.user; package fi.codecrew.moya.web.cdiview.user;
import fi.codecrew.moya.beans.*; import fi.codecrew.moya.beans.*;
import fi.codecrew.moya.enums.CardState;
import fi.codecrew.moya.enums.apps.UserPermission;
import fi.codecrew.moya.model.*; import fi.codecrew.moya.model.*;
import fi.codecrew.moya.rest.meta.v1.PrintedCardRestViewV1;
import fi.codecrew.moya.util.MassPrintResult;
import fi.codecrew.moya.utilities.jsf.MessageHelper;
import fi.codecrew.moya.web.annotations.LoggedIn;
import fi.codecrew.moya.web.annotations.SelectedUser;
import fi.codecrew.moya.web.cdiview.GenericCDIView; import fi.codecrew.moya.web.cdiview.GenericCDIView;
import fi.codecrew.moya.web.cdiview.reader.ReaderView;
import fi.codecrew.moya.web.helper.LayoutView;
import org.primefaces.event.CaptureEvent;
import org.primefaces.event.FileUploadEvent;
import org.primefaces.model.CroppedImage;
import org.primefaces.model.DefaultStreamedContent;
import org.primefaces.model.StreamedContent;
import org.primefaces.model.UploadedFile;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.Conversation;
import javax.enterprise.context.ConversationScoped; import javax.enterprise.context.ConversationScoped;
import javax.enterprise.inject.Produces;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;
import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import javax.json.*; import javax.json.*;
import javax.json.stream.JsonGenerator;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.StringWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Named() @Named()
@ConversationScoped @ConversationScoped
...@@ -116,11 +89,11 @@ public class CardHolderizeView extends GenericCDIView { ...@@ -116,11 +89,11 @@ public class CardHolderizeView extends GenericCDIView {
JsonObjectBuilder filingBuilder = Json.createObjectBuilder(); JsonObjectBuilder filingBuilder = Json.createObjectBuilder();
if (meta != null) { if (meta != null) {
meta.entrySet().forEach(e -> metaBuilder.add(e.getKey(), e.getValue())); meta.forEach(metaBuilder::add);
JsonObject filingObj = meta.getJsonObject("card-filing"); JsonObject filingObj = meta.getJsonObject("card-filing");
if (filingObj != null) { if (filingObj != null) {
filingObj.entrySet().forEach(e -> filingBuilder.add(e.getKey(), e.getValue())); filingObj.forEach(filingBuilder::add);
} }
} }
filingBuilder.add("cardplace", sb.toString()); filingBuilder.add("cardplace", sb.toString());
......
...@@ -111,7 +111,7 @@ public class CardView extends GenericCDIView { ...@@ -111,7 +111,7 @@ public class CardView extends GenericCDIView {
} }
public List<CardTemplate> getTemplatesWithNull() { public List<CardTemplate> getTemplatesWithNull() {
ArrayList<CardTemplate> retlist = new ArrayList<CardTemplate>(); ArrayList<CardTemplate> retlist = new ArrayList<>();
CardTemplate dummytempl = new CardTemplate(); CardTemplate dummytempl = new CardTemplate();
dummytempl.setName(I18n.get("cardTemplate.emptyCardTemplate")); dummytempl.setName(I18n.get("cardTemplate.emptyCardTemplate"));
retlist.add(dummytempl); retlist.add(dummytempl);
......
...@@ -57,7 +57,7 @@ public class CreditTransferView extends GenericCDIView { ...@@ -57,7 +57,7 @@ public class CreditTransferView extends GenericCDIView {
public void init(List<EventUser> users) { public void init(List<EventUser> users) {
ArrayList<EventUserWrapper> wrap = new ArrayList<EventUserWrapper>(); ArrayList<EventUserWrapper> wrap = new ArrayList<>();
for (EventUser u : users) { for (EventUser u : users) {
wrap.add(new EventUserWrapper(u)); wrap.add(new EventUserWrapper(u));
} }
...@@ -84,7 +84,7 @@ public class CreditTransferView extends GenericCDIView { ...@@ -84,7 +84,7 @@ public class CreditTransferView extends GenericCDIView {
} }
public String commitTransfer() { public String commitTransfer() {
List<User> transfer = new ArrayList<User>(); List<User> transfer = new ArrayList<>();
for (EventUserWrapper u : users) { for (EventUserWrapper u : users) {
if (!u.isSkip()) if (!u.isSkip())
{ {
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
*/ */
package fi.codecrew.moya.web.cdiview.user; package fi.codecrew.moya.web.cdiview.user;
import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -81,7 +80,7 @@ public class ImportView extends GenericCDIView { ...@@ -81,7 +80,7 @@ public class ImportView extends GenericCDIView {
public String parse() public String parse()
{ {
ArrayList<ImportWrapper> ret = new ArrayList<ImportWrapper>(); ArrayList<ImportWrapper> ret = new ArrayList<>();
byte[] bytes = FileUploadUtils.getFileContents(file); byte[] bytes = FileUploadUtils.getFileContents(file);
......
...@@ -39,7 +39,7 @@ public class ImportWrapper implements Serializable { ...@@ -39,7 +39,7 @@ public class ImportWrapper implements Serializable {
public ImportWrapper(IUser usr) { public ImportWrapper(IUser usr) {
user = usr; user = usr;
potential = new ArrayList<User>(); potential = new ArrayList<>();
selected = new User(); selected = new User();
potential.add(selected); potential.add(selected);
} }
......
...@@ -41,7 +41,7 @@ public class OrgRoleDataView extends GenericCDIView { ...@@ -41,7 +41,7 @@ public class OrgRoleDataView extends GenericCDIView {
public ListDataModel<OrgRole> getOrgRoles() { public ListDataModel<OrgRole> getOrgRoles() {
if (orgRoles == null) { if (orgRoles == null) {
orgRoles = new ListDataModel<OrgRole>(orgRolesBean.listOrgRoles()); orgRoles = new ListDataModel<>(orgRolesBean.listOrgRoles());
} }
return orgRoles; return orgRoles;
......
...@@ -18,15 +18,6 @@ ...@@ -18,15 +18,6 @@
*/ */
package fi.codecrew.moya.web.cdiview.user; package fi.codecrew.moya.web.cdiview.user;
import java.util.List;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.inject.Named;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.EventBeanLocal; import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.OrgRoleBeanLocal; import fi.codecrew.moya.beans.OrgRoleBeanLocal;
import fi.codecrew.moya.beans.RoleBeanLocal; import fi.codecrew.moya.beans.RoleBeanLocal;
...@@ -34,10 +25,17 @@ import fi.codecrew.moya.beans.UserBeanLocal; ...@@ -34,10 +25,17 @@ import fi.codecrew.moya.beans.UserBeanLocal;
import fi.codecrew.moya.entitysearch.UserSearchQuery; import fi.codecrew.moya.entitysearch.UserSearchQuery;
import fi.codecrew.moya.enums.apps.UserPermission; import fi.codecrew.moya.enums.apps.UserPermission;
import fi.codecrew.moya.model.OrgRole; import fi.codecrew.moya.model.OrgRole;
import fi.codecrew.moya.model.Role;
import fi.codecrew.moya.model.User; import fi.codecrew.moya.model.User;
import fi.codecrew.moya.model.role.Role;
import fi.codecrew.moya.utilities.SearchResult; import fi.codecrew.moya.utilities.SearchResult;
import fi.codecrew.moya.web.cdiview.GenericCDIView; import fi.codecrew.moya.web.cdiview.GenericCDIView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.inject.Named;
import java.util.List;
@ConversationScoped @ConversationScoped
@Named @Named
......
...@@ -18,20 +18,18 @@ ...@@ -18,20 +18,18 @@
*/ */
package fi.codecrew.moya.web.cdiview.user; package fi.codecrew.moya.web.cdiview.user;
import java.util.List; import fi.codecrew.moya.beans.RoleBeanLocal;
import fi.codecrew.moya.enums.apps.UserPermission;
import fi.codecrew.moya.model.role.Role;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.faces.model.ListDataModel; import javax.faces.model.ListDataModel;
import javax.inject.Named; import javax.inject.Named;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.RoleBeanLocal;
import fi.codecrew.moya.enums.apps.UserPermission;
import fi.codecrew.moya.model.Role;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
@Named @Named
@RequestScoped @RequestScoped
...@@ -72,7 +70,7 @@ public class RoleDataView extends GenericCDIView { ...@@ -72,7 +70,7 @@ public class RoleDataView extends GenericCDIView {
if (roles == null) { if (roles == null) {
List<Role> list = rolebean.listRoles(); List<Role> list = rolebean.listRoles();
list.add(0, Role.EMPTY_ROLE); list.add(0, Role.EMPTY_ROLE);
roles = new ListDataModel<Role>(list); roles = new ListDataModel<>(list);
logger.info("rolecount {}", roles.getRowCount()); logger.info("rolecount {}", roles.getRowCount());
} }
return roles; return roles;
......
...@@ -55,7 +55,7 @@ public class UserCardView extends GenericCDIView { ...@@ -55,7 +55,7 @@ public class UserCardView extends GenericCDIView {
public ListDataModel<PrintedCard> getPrintedCards() { public ListDataModel<PrintedCard> getPrintedCards() {
if (printedCards == null && user != null) if (printedCards == null && user != null)
{ {
printedCards = new ListDataModel<PrintedCard>(cardBean.getCards(user)); printedCards = new ListDataModel<>(cardBean.getCards(user));
} }
return printedCards; return printedCards;
} }
......
...@@ -21,7 +21,6 @@ package fi.codecrew.moya.web.cdiview.user; ...@@ -21,7 +21,6 @@ package fi.codecrew.moya.web.cdiview.user;
import fi.codecrew.moya.beans.UserBeanLocal; import fi.codecrew.moya.beans.UserBeanLocal;
import fi.codecrew.moya.beans.UserPropertyBeanLocal; import fi.codecrew.moya.beans.UserPropertyBeanLocal;
import fi.codecrew.moya.model.*; import fi.codecrew.moya.model.*;
import fi.codecrew.moya.utilities.jsf.MessageHelper;
import fi.codecrew.moya.web.cdiview.GenericCDIView; import fi.codecrew.moya.web.cdiview.GenericCDIView;
import org.primefaces.event.RowEditEvent; import org.primefaces.event.RowEditEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
......
...@@ -61,7 +61,7 @@ public class UserOverviewView extends GenericCDIView { ...@@ -61,7 +61,7 @@ public class UserOverviewView extends GenericCDIView {
public void initView() { public void initView() {
if (userOverviewItems == null) { if (userOverviewItems == null) {
ArrayList<UserOverviewItem> ovlist = new ArrayList<UserOverviewItem>(); ArrayList<UserOverviewItem> ovlist = new ArrayList<>();
for (EventUser eu : getUserCartView().getUsercart()) { for (EventUser eu : getUserCartView().getUsercart()) {
PrintedCard pc = cardTemplateBean.checkPrintedCard(eu); PrintedCard pc = cardTemplateBean.checkPrintedCard(eu);
UserOverviewItem uoi = new UserOverviewItem(eu, pc, I18n.get("rejectcard.mailSubject"), I18n.get("rejectcard.mailBody")); UserOverviewItem uoi = new UserOverviewItem(eu, pc, I18n.get("rejectcard.mailSubject"), I18n.get("rejectcard.mailBody"));
......
...@@ -204,7 +204,7 @@ public class UserSearchView extends PaginationView<UserWrapper> { ...@@ -204,7 +204,7 @@ public class UserSearchView extends PaginationView<UserWrapper> {
private List<UserWrapper> getUserWrappers(List<User> users) private List<UserWrapper> getUserWrappers(List<User> users)
{ {
ArrayList<UserWrapper> res = new ArrayList<UserWrapper>(); ArrayList<UserWrapper> res = new ArrayList<>();
for (User u : users) { for (User u : users) {
res.add(new UserWrapper(u, userbean.getEventUser(u, false))); res.add(new UserWrapper(u, userbean.getEventUser(u, false)));
} }
......
...@@ -42,7 +42,7 @@ public class VipListView extends PaginationView<Vip> { ...@@ -42,7 +42,7 @@ public class VipListView extends PaginationView<Vip> {
public void initView() { public void initView() {
if (super.requirePermissions(VipPermission.VIEW) && viplist == null) { if (super.requirePermissions(VipPermission.VIEW) && viplist == null) {
viplist = new ListDataModel<Vip>(vipBean.getAvailableVips()); viplist = new ListDataModel<>(vipBean.getAvailableVips());
filteredVips = null; filteredVips = null;
super.beginConversation(); super.beginConversation();
} }
......
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
*/ */
package fi.codecrew.moya.web.cdiview.voting; package fi.codecrew.moya.web.cdiview.voting;
import java.io.ByteArrayInputStream;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.faces.model.ListDataModel; import javax.faces.model.ListDataModel;
......
...@@ -94,7 +94,7 @@ public class CompoMgmtView extends GenericCDIView { ...@@ -94,7 +94,7 @@ public class CompoMgmtView extends GenericCDIView {
for (CompoEntry e : entries) { for (CompoEntry e : entries) {
setCompo(votingBean.saveSort(e).getCompo()); setCompo(votingBean.saveSort(e).getCompo());
} }
entries = new ListDataModel<CompoEntry>(getCompo().getCompoEntries()); entries = new ListDataModel<>(getCompo().getCompoEntries());
return null; return null;
} }
...@@ -110,7 +110,7 @@ public class CompoMgmtView extends GenericCDIView { ...@@ -110,7 +110,7 @@ public class CompoMgmtView extends GenericCDIView {
public void initView() { public void initView() {
if (super.requirePermissions(CompoPermission.MANAGE) && entries == null) { if (super.requirePermissions(CompoPermission.MANAGE) && entries == null) {
setCompo(votingBean.getCompoById(compoId)); setCompo(votingBean.getCompoById(compoId));
entries = new ListDataModel<CompoEntry>(getCompo().getCompoEntries()); entries = new ListDataModel<>(getCompo().getCompoEntries());
super.beginConversation(); super.beginConversation();
} }
} }
......
...@@ -18,11 +18,6 @@ ...@@ -18,11 +18,6 @@
*/ */
package fi.codecrew.moya.web.cdiview.voting; package fi.codecrew.moya.web.cdiview.voting;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.ejb.EJB; import javax.ejb.EJB;
...@@ -31,10 +26,8 @@ import javax.enterprise.inject.Produces; ...@@ -31,10 +26,8 @@ import javax.enterprise.inject.Produces;
import javax.faces.model.ListDataModel; import javax.faces.model.ListDataModel;
import javax.inject.Named; import javax.inject.Named;
import fi.codecrew.moya.beans.RoleBeanLocal;
import fi.codecrew.moya.beans.UserBeanLocal; import fi.codecrew.moya.beans.UserBeanLocal;
import fi.codecrew.moya.model.*; import fi.codecrew.moya.model.*;
import fi.codecrew.moya.web.helpers.FileUploadUtils;
import org.primefaces.event.RateEvent; import org.primefaces.event.RateEvent;
import org.primefaces.model.UploadedFile; import org.primefaces.model.UploadedFile;
import org.slf4j.Logger; import org.slf4j.Logger;
......
...@@ -58,7 +58,7 @@ public class EntryWrapper implements Serializable { ...@@ -58,7 +58,7 @@ public class EntryWrapper implements Serializable {
} }
public static ListDataModel<EntryWrapper> init(List<CompoEntry> compoEntries, VotingBeanLocal votbean, boolean calcSummary) { public static ListDataModel<EntryWrapper> init(List<CompoEntry> compoEntries, VotingBeanLocal votbean, boolean calcSummary) {
ArrayList<EntryWrapper> ret = new ArrayList<EntryWrapper>(); ArrayList<EntryWrapper> ret = new ArrayList<>();
for (CompoEntry entry : compoEntries) for (CompoEntry entry : compoEntries)
{ {
if (entry.getSort() != null && entry.getSort() > 0) if (entry.getSort() != null && entry.getSort() > 0)
...@@ -69,7 +69,7 @@ public class EntryWrapper implements Serializable { ...@@ -69,7 +69,7 @@ public class EntryWrapper implements Serializable {
} }
} }
return new ListDataModel<EntryWrapper>(ret); return new ListDataModel<>(ret);
} }
public CompoEntry getEntry() { public CompoEntry getEntry() {
......
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
*/ */
package fi.codecrew.moya.web.cdiview.voting; package fi.codecrew.moya.web.cdiview.voting;
import java.io.IOException;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.inject.Named; import javax.inject.Named;
......
...@@ -27,7 +27,7 @@ import javax.inject.Named; ...@@ -27,7 +27,7 @@ import javax.inject.Named;
@Named("taskTypeConverter") @Named("taskTypeConverter")
@RequestScoped @RequestScoped
public class ActionlogTaskTypeConverter implements Converter { public class ActionlogTaskTypeConverter implements Converter<Object> {
@Override @Override
public Object getAsObject(FacesContext context, UIComponent component, public Object getAsObject(FacesContext context, UIComponent component,
......
...@@ -30,18 +30,14 @@ import fi.codecrew.moya.enums.CardState; ...@@ -30,18 +30,14 @@ import fi.codecrew.moya.enums.CardState;
@Named() @Named()
@RequestScoped @RequestScoped
public class CardStateConverter implements Converter { public class CardStateConverter implements Converter<CardState> {
@EJB
private RoleBeanLocal rolebean;
@Override @Override
public Object getAsObject(FacesContext context, UIComponent component, String value) { public CardState getAsObject(FacesContext context, UIComponent component, String value) {
return CardState.valueOf(value); return CardState.valueOf(value);
} }
@Override @Override
public String getAsString(FacesContext context, UIComponent component, Object value) { public String getAsString(FacesContext context, UIComponent component, CardState value) {
return value.toString(); return value.toString();
} }
} }
...@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory; ...@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
@Named("emptytonullconverter") @Named("emptytonullconverter")
@RequestScoped @RequestScoped
public class EmptyToNullConverter implements Converter { public class EmptyToNullConverter implements Converter<Object> {
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(EmptyToNullConverter.class); private static final org.slf4j.Logger logger = LoggerFactory.getLogger(EmptyToNullConverter.class);
......
...@@ -29,12 +29,12 @@ import org.slf4j.Logger; ...@@ -29,12 +29,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@Named @Named
public class LocaleConverter implements Converter { public class LocaleConverter implements Converter<Locale> {
private static final Logger logger = LoggerFactory.getLogger(LocaleConverter.class); private static final Logger logger = LoggerFactory.getLogger(LocaleConverter.class);
@Override @Override
public Object getAsObject(FacesContext context, UIComponent component, String value) { public Locale getAsObject(FacesContext context, UIComponent component, String value) {
Locale ret = null; Locale ret = null;
if (value != null && !value.isEmpty() && !"null".equals(value)) { if (value != null && !value.isEmpty() && !"null".equals(value)) {
try { try {
...@@ -48,7 +48,7 @@ public class LocaleConverter implements Converter { ...@@ -48,7 +48,7 @@ public class LocaleConverter implements Converter {
} }
@Override @Override
public String getAsString(FacesContext context, UIComponent component, Object value) { public String getAsString(FacesContext context, UIComponent component, Locale value) {
String ret = "null"; String ret = "null";
if (value != null && value instanceof Locale) { if (value != null && value instanceof Locale) {
Locale loc = (Locale) value; Locale loc = (Locale) value;
......
...@@ -31,7 +31,7 @@ import fi.codecrew.moya.model.PossibleAnswer; ...@@ -31,7 +31,7 @@ import fi.codecrew.moya.model.PossibleAnswer;
@Named("pollAnswerConverter") @Named("pollAnswerConverter")
@RequestScoped() @RequestScoped()
public class PollAnswerConverter implements Converter { public class PollAnswerConverter implements Converter<PollAnswer> {
@EJB @EJB
private PollBeanLocal pollbean; private PollBeanLocal pollbean;
...@@ -40,7 +40,7 @@ public class PollAnswerConverter implements Converter { ...@@ -40,7 +40,7 @@ public class PollAnswerConverter implements Converter {
} }
@Override @Override
public Object getAsObject(FacesContext context, UIComponent component, String value) { public PollAnswer getAsObject(FacesContext context, UIComponent component, String value) {
PossibleAnswer possibleAnswer = pollbean.findPossibleAnwerById(Integer.parseInt(value)); PossibleAnswer possibleAnswer = pollbean.findPossibleAnwerById(Integer.parseInt(value));
PollAnswer ret = new PollAnswer(); PollAnswer ret = new PollAnswer();
...@@ -50,15 +50,8 @@ public class PollAnswerConverter implements Converter { ...@@ -50,15 +50,8 @@ public class PollAnswerConverter implements Converter {
} }
@Override @Override
public String getAsString(FacesContext context, UIComponent component, Object value) { public String getAsString(FacesContext context, UIComponent component, PollAnswer value) {
String ret = null; return value.getChoice().getId().toString();
if (value instanceof PollAnswer) {
ret = ((PollAnswer) value).getChoice().getId().toString();
}
return ret;
} }
} }
...@@ -28,17 +28,15 @@ import fi.codecrew.moya.model.ProductFlag; ...@@ -28,17 +28,15 @@ import fi.codecrew.moya.model.ProductFlag;
@Named("productFlagConverter") @Named("productFlagConverter")
@RequestScoped() @RequestScoped()
public class ProductFlagConverter implements Converter { public class ProductFlagConverter implements Converter<ProductFlag> {
@Override @Override
public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) { public ProductFlag getAsObject(FacesContext arg0, UIComponent arg1, String arg2) {
// TODO Auto-generated method stub
return ProductFlag.valueOf(arg2); return ProductFlag.valueOf(arg2);
} }
@Override @Override
public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) { public String getAsString(FacesContext arg0, UIComponent arg1, ProductFlag arg2) {
// TODO Auto-generated method stub
return arg2.toString(); return arg2.toString();
} }
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
package fi.codecrew.moya.web.converter; package fi.codecrew.moya.web.converter;
import fi.codecrew.moya.beans.ProductBeanLocal; import fi.codecrew.moya.beans.ProductBeanLocal;
import fi.codecrew.moya.model.Product;
import fi.codecrew.moya.model.ProductOption; import fi.codecrew.moya.model.ProductOption;
import fi.codecrew.moya.utilities.jsf.GenericIntegerEntityConverter; import fi.codecrew.moya.utilities.jsf.GenericIntegerEntityConverter;
import org.slf4j.Logger; import org.slf4j.Logger;
......
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
*/ */
package fi.codecrew.moya.web.converter; package fi.codecrew.moya.web.converter;
import fi.codecrew.moya.beans.RoleBeanLocal;
import fi.codecrew.moya.model.role.Role;
import fi.codecrew.moya.utilities.jsf.GenericIntegerEntityConverter;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.inject.Named; import javax.inject.Named;
import fi.codecrew.moya.beans.RoleBeanLocal;
import fi.codecrew.moya.model.Role;
import fi.codecrew.moya.utilities.jsf.GenericIntegerEntityConverter;
@Named("roleConverter") @Named("roleConverter")
@RequestScoped @RequestScoped
public class RoleConverter extends GenericIntegerEntityConverter<Role> { public class RoleConverter extends GenericIntegerEntityConverter<Role> {
......
...@@ -29,7 +29,7 @@ import fi.codecrew.moya.beans.SessionMgmtBeanLocal.UserContainer; ...@@ -29,7 +29,7 @@ import fi.codecrew.moya.beans.SessionMgmtBeanLocal.UserContainer;
import fi.codecrew.moya.utilities.I18n; import fi.codecrew.moya.utilities.I18n;
@Named() @Named()
public class SessionToHostnameConverter implements Converter { public class SessionToHostnameConverter implements Converter<Object> {
@EJB @EJB
private SessionMgmtBeanLocal sessbean; private SessionMgmtBeanLocal sessbean;
......
...@@ -29,7 +29,7 @@ import fi.codecrew.moya.beans.SessionMgmtBeanLocal.UserContainer; ...@@ -29,7 +29,7 @@ import fi.codecrew.moya.beans.SessionMgmtBeanLocal.UserContainer;
import fi.codecrew.moya.utilities.I18n; import fi.codecrew.moya.utilities.I18n;
@Named() @Named()
public class SessionToUsernameConverter implements Converter { public class SessionToUsernameConverter implements Converter<Object> {
@EJB @EJB
private SessionMgmtBeanLocal sessbean; private SessionMgmtBeanLocal sessbean;
......
...@@ -41,7 +41,6 @@ import javax.inject.Named; ...@@ -41,7 +41,6 @@ import javax.inject.Named;
import javax.json.JsonObject; import javax.json.JsonObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List;
@Named @Named
@ConversationScoped @ConversationScoped
...@@ -286,7 +285,7 @@ public class IncomingView extends GenericCDIView { ...@@ -286,7 +285,7 @@ public class IncomingView extends GenericCDIView {
} }
public ListDataModel<GroupMembership> getGroupMemberships() { public ListDataModel<GroupMembership> getGroupMemberships() {
memberlist = new ListDataModel<GroupMembership>(ticketBean.findMembershipPrintlistForUser(userview.getSelectedUser())); memberlist = new ListDataModel<>(ticketBean.findMembershipPrintlistForUser(userview.getSelectedUser()));
return memberlist; return memberlist;
} }
...@@ -320,9 +319,9 @@ public class IncomingView extends GenericCDIView { ...@@ -320,9 +319,9 @@ public class IncomingView extends GenericCDIView {
public ListDataModel<CardCode> getCardCodes() { public ListDataModel<CardCode> getCardCodes() {
if (userview.getPrintedCard() == null) if (userview.getPrintedCard() == null)
return new ListDataModel<CardCode>(new ArrayList<CardCode>()); return new ListDataModel<>(new ArrayList<>());
cardCodes = new ListDataModel<CardCode>(userview.getPrintedCard().getCardCodes()); cardCodes = new ListDataModel<>(userview.getPrintedCard().getCardCodes());
return cardCodes; return cardCodes;
} }
......
...@@ -5,7 +5,6 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView; ...@@ -5,7 +5,6 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView;
import javax.enterprise.context.ConversationScoped; import javax.enterprise.context.ConversationScoped;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.inject.Named; import javax.inject.Named;
import java.io.Serializable;
import java.util.Map; import java.util.Map;
/** /**
......
...@@ -64,10 +64,10 @@ public class FeedbackView extends GenericCDIView { ...@@ -64,10 +64,10 @@ public class FeedbackView extends GenericCDIView {
public ListDataModel<Feedback> getFeedbacks() { public ListDataModel<Feedback> getFeedbacks() {
if (feedbacks == null && permissionBean.getCurrentUser().isSuperadmin()) if (feedbacks == null && permissionBean.getCurrentUser().isSuperadmin())
{ {
feedbacks = new ListDataModel<Feedback>(userbean.getFeedbacks()); feedbacks = new ListDataModel<>(userbean.getFeedbacks());
} }
else { else {
feedbacks = new ListDataModel<Feedback>(); feedbacks = new ListDataModel<>();
} }
return feedbacks; return feedbacks;
} }
......
...@@ -41,7 +41,7 @@ public class FieldsetView extends GenericCDIView { ...@@ -41,7 +41,7 @@ public class FieldsetView extends GenericCDIView {
private HashMap<String, Boolean> collapseStates = new HashMap<String, Boolean>(); private HashMap<String, Boolean> collapseStates = new HashMap<>();
public boolean isCollapsed(String id) { public boolean isCollapsed(String id) {
......
...@@ -135,7 +135,7 @@ public class HttpSessionWrapper ...@@ -135,7 +135,7 @@ public class HttpSessionWrapper
} }
ret.add(new HttpSessionWrapper(s, username, hostname)); ret.add(new HttpSessionWrapper(s, username, hostname));
} }
Collections.sort(ret, new LastSeenComparator()); ret.sort(new LastSeenComparator());
return ret; return ret;
} }
......
...@@ -58,7 +58,7 @@ public class ProductShopItemHelper extends GenericCDIView { ...@@ -58,7 +58,7 @@ public class ProductShopItemHelper extends GenericCDIView {
item.setInternalDiscounts(discountBean.getActiveDiscountsByProduct(item.getProduct(), item.getCount(), item.setInternalDiscounts(discountBean.getActiveDiscountsByProduct(item.getProduct(), item.getCount(),
new Date(), item.getUser())); new Date(), item.getUser()));
item.setInternalDiscountValues(new HashMap<Integer, BigDecimal>()); item.setInternalDiscountValues(new HashMap<>());
for (Discount d : item.getDiscounts()) { for (Discount d : item.getDiscounts()) {
BigDecimal newprice = item.getPrice().multiply(d.getPercentage()); BigDecimal newprice = item.getPrice().multiply(d.getPercentage());
......
...@@ -39,7 +39,7 @@ public class ThemeSwitcherView extends GenericCDIView { ...@@ -39,7 +39,7 @@ public class ThemeSwitcherView extends GenericCDIView {
public Map<String, String> getThemes() { public Map<String, String> getThemes() {
if (themes == null) { if (themes == null) {
themes = new TreeMap<String, String>(); themes = new TreeMap<>();
themes.put("Afterdark", "afterdark"); themes.put("Afterdark", "afterdark");
themes.put("Afternoon", "afternoon"); themes.put("Afternoon", "afternoon");
themes.put("Afterwork", "afterwork"); themes.put("Afterwork", "afterwork");
......
...@@ -36,14 +36,14 @@ public class BortalApplicationWrapper implements Serializable { ...@@ -36,14 +36,14 @@ public class BortalApplicationWrapper implements Serializable {
*/ */
private static final long serialVersionUID = -5552828911388714876L; private static final long serialVersionUID = -5552828911388714876L;
private final ArrayList<IAppPermission> permissions; private final ArrayList<IAppPermission> permissions;
private Set<String> selected = new HashSet<String>(); private Set<String> selected = new HashSet<>();
private final BortalApplication app; private final BortalApplication app;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static final Logger logger = LoggerFactory.getLogger(BortalApplicationWrapper.class); private static final Logger logger = LoggerFactory.getLogger(BortalApplicationWrapper.class);
public BortalApplicationWrapper(BortalApplication bApp, Set<IAppPermission> set) { public BortalApplicationWrapper(BortalApplication bApp, Set<IAppPermission> set) {
app = bApp; app = bApp;
permissions = new ArrayList<IAppPermission>(); permissions = new ArrayList<>();
for (IAppPermission ap : bApp.getPermissions()) { for (IAppPermission ap : bApp.getPermissions()) {
boolean has = set != null && set.contains(ap); boolean has = set != null && set.contains(ap);
......
...@@ -92,7 +92,7 @@ public class LectureGroupView extends GenericCDIView { ...@@ -92,7 +92,7 @@ public class LectureGroupView extends GenericCDIView {
public ListDataModel<LectureGroup> getLectureGroups() { public ListDataModel<LectureGroup> getLectureGroups() {
if (lectureGroupModel == null) { if (lectureGroupModel == null) {
lectureGroupModel = new ListDataModel<LectureGroup>(lectureBean.getLectureGroups()); lectureGroupModel = new ListDataModel<>(lectureBean.getLectureGroups());
} }
return lectureGroupModel; return lectureGroupModel;
......
...@@ -92,7 +92,7 @@ public class LectureReportsView extends GenericCDIView { ...@@ -92,7 +92,7 @@ public class LectureReportsView extends GenericCDIView {
} }
public ListDataModel<LectureGroup> getLectureGroups() { public ListDataModel<LectureGroup> getLectureGroups() {
lectureGroups = new ListDataModel<LectureGroup>(lectureBean.getLectureGroups()); lectureGroups = new ListDataModel<>(lectureBean.getLectureGroups());
return lectureGroups; return lectureGroups;
} }
...@@ -117,10 +117,10 @@ public class LectureReportsView extends GenericCDIView { ...@@ -117,10 +117,10 @@ public class LectureReportsView extends GenericCDIView {
public ListDataModel<Lecture> getLectures() { public ListDataModel<Lecture> getLectures() {
if (currentLectureGroup == null) if (currentLectureGroup == null)
return new ListDataModel<Lecture>(); return new ListDataModel<>();
if(lectures == null) if(lectures == null)
lectures = new ListDataModel<Lecture>(lectureBean.getLecturesByLectureGroup(getCurrentLectureGroup())); lectures = new ListDataModel<>(lectureBean.getLecturesByLectureGroup(getCurrentLectureGroup()));
return lectures; return lectures;
} }
...@@ -140,7 +140,7 @@ public class LectureReportsView extends GenericCDIView { ...@@ -140,7 +140,7 @@ public class LectureReportsView extends GenericCDIView {
public List<String> getEmptyLinesList() { public List<String> getEmptyLinesList() {
ArrayList<String> retList = new ArrayList<String>(); ArrayList<String> retList = new ArrayList<>();
for(int n = getCurrentLecture().getParticipantsCount(); n < getCurrentLecture().getMaxParticipantsCount(); n++) { for(int n = getCurrentLecture().getParticipantsCount(); n < getCurrentLecture().getMaxParticipantsCount(); n++) {
retList.add(""+(n+1)+":"); retList.add(""+(n+1)+":");
} }
......
...@@ -83,7 +83,7 @@ public class LectureUserView extends GenericCDIView { ...@@ -83,7 +83,7 @@ public class LectureUserView extends GenericCDIView {
} }
public ListDataModel<LectureGroup> getLectureGroups() { public ListDataModel<LectureGroup> getLectureGroups() {
lectureGroups = new ListDataModel<LectureGroup>(lectureBean.getLectureGroups()); lectureGroups = new ListDataModel<>(lectureBean.getLectureGroups());
return lectureGroups; return lectureGroups;
} }
...@@ -108,16 +108,16 @@ public class LectureUserView extends GenericCDIView { ...@@ -108,16 +108,16 @@ public class LectureUserView extends GenericCDIView {
public ListDataModel<Lecture> getLectures() { public ListDataModel<Lecture> getLectures() {
if (currentLectureGroup == null) if (currentLectureGroup == null)
return new ListDataModel<Lecture>(); return new ListDataModel<>();
if (lectures == null) if (lectures == null)
lectures = new ListDataModel<Lecture>(lectureBean.findAvailableLectures(getCurrentLectureGroup(), userView.getCurrentUser())); lectures = new ListDataModel<>(lectureBean.findAvailableLectures(getCurrentLectureGroup(), userView.getCurrentUser()));
return lectures; return lectures;
} }
public ListDataModel<Lecture> getParticipatedLectures() { public ListDataModel<Lecture> getParticipatedLectures() {
participatedLectures = new ListDataModel<Lecture>(lectureBean.getParticipatedLectures(userView.getCurrentUser())); participatedLectures = new ListDataModel<>(lectureBean.getParticipatedLectures(userView.getCurrentUser()));
return participatedLectures; return participatedLectures;
} }
......
...@@ -120,7 +120,7 @@ public class LectureView extends GenericCDIView { ...@@ -120,7 +120,7 @@ public class LectureView extends GenericCDIView {
public ListDataModel<Lecture> getLectures() { public ListDataModel<Lecture> getLectures() {
if (lectures == null && getCurrentLectureGroup() != null) { if (lectures == null && getCurrentLectureGroup() != null) {
lectures = new ListDataModel<Lecture>(getCurrentLectureGroup().getLectures()); lectures = new ListDataModel<>(getCurrentLectureGroup().getLectures());
} }
return lectures; return lectures;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!