Commit ba3f6556 by Tuomas Riihimäki

Code cleanup

1 parent 8ba089a6
Showing with 1219 additions and 1356 deletions
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.utilities.jpa; package fi.codecrew.moya.utilities.jpa;
...@@ -55,12 +55,12 @@ public abstract class GenericFacade<C extends ModelInterface> { ...@@ -55,12 +55,12 @@ public abstract class GenericFacade<C extends ModelInterface> {
/* /*
* This function does not need to return the persisted entity. All changes are made to the parameter. * This function does not need to return the persisted entity. All changes are made to the parameter.
* *
*/ */
/** /**
* Persists the entity into database. After calling this function the entity * Persists the entity into database. After calling this function the entity
* is attached and all changes are persisted to database * is attached and all changes are persisted to database
* *
* @param entity * @param entity
* Entity to be created and attached to database. * Entity to be created and attached to database.
*/ */
...@@ -75,9 +75,9 @@ public abstract class GenericFacade<C extends ModelInterface> { ...@@ -75,9 +75,9 @@ public abstract class GenericFacade<C extends ModelInterface> {
/** /**
* Merge changes from a detached entity to the database. * Merge changes from a detached entity to the database.
* *
* This function does nothing if entity is already attached. * This function does nothing if entity is already attached.
* *
* @param entity * @param entity
* Detached entity to be merged into database * Detached entity to be merged into database
* @return Attached entity with changes merged * @return Attached entity with changes merged
...@@ -90,9 +90,9 @@ public abstract class GenericFacade<C extends ModelInterface> { ...@@ -90,9 +90,9 @@ public abstract class GenericFacade<C extends ModelInterface> {
/** /**
* Refresh the state of the instance from the database, overwriting changes * Refresh the state of the instance from the database, overwriting changes
* made to the entity, if any. * made to the entity, if any.
* *
* ENTITY MUST BE ATTACHED! * ENTITY MUST BE ATTACHED!
* *
* @param entity * @param entity
*/ */
public void refresh(C entity) { public void refresh(C entity) {
...@@ -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);
...@@ -209,7 +209,7 @@ public abstract class GenericFacade<C extends ModelInterface> { ...@@ -209,7 +209,7 @@ public abstract class GenericFacade<C extends ModelInterface> {
/** /**
* Synchronize the persistence context to the underlying database. * Synchronize the persistence context to the underlying database.
* *
* This gives to newly created entities ID, etc. * This gives to newly created entities ID, etc.
*/ */
public void flush() { public void flush() {
...@@ -218,7 +218,7 @@ public abstract class GenericFacade<C extends ModelInterface> { ...@@ -218,7 +218,7 @@ public abstract class GenericFacade<C extends ModelInterface> {
/** /**
* Remove the given entity from cache. * Remove the given entity from cache.
* *
* @param entity * @param entity
*/ */
public void evict(C entity) { public void evict(C entity) {
...@@ -228,7 +228,7 @@ public abstract class GenericFacade<C extends ModelInterface> { ...@@ -228,7 +228,7 @@ public abstract class GenericFacade<C extends ModelInterface> {
/** /**
* Tells wether the entity is attached to this transaction. ie. Changes to * Tells wether the entity is attached to this transaction. ie. Changes to
* this object are automatically propagated to the database * this object are automatically propagated to the database
* *
* @param entity * @param entity
* @return * @return
*/ */
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.utilities.jsf; package fi.codecrew.moya.utilities.jsf;
...@@ -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();
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.utilities.jsf; package fi.codecrew.moya.utilities.jsf;
...@@ -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();
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.utilities; package fi.codecrew.moya.utilities;
...@@ -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);
...@@ -65,13 +65,13 @@ public class JsonUtilsTest { ...@@ -65,13 +65,13 @@ public class JsonUtilsTest {
Assert.assertEquals(actual.toString(), expected.toString()); Assert.assertEquals(actual.toString(), expected.toString());
} }
@Test @Test
public final void testAlterSubSubObject() { public final void testAlterSubSubObject() {
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
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.rest; package fi.codecrew.moya.rest;
...@@ -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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.rest; package fi.codecrew.moya.rest;
...@@ -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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.rest.meta.v1; package fi.codecrew.moya.rest.meta.v1;
...@@ -37,13 +37,13 @@ public abstract class AbstractRestViewV1 { ...@@ -37,13 +37,13 @@ public abstract class AbstractRestViewV1 {
/** /**
* Convert List<PathSegment> to List<String> * Convert List<PathSegment> to List<String>
* *
* @param path * @param path
* List<PathSegment> * List<PathSegment>
* @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.
...@@ -18,7 +13,7 @@ import java.util.ArrayList; ...@@ -18,7 +13,7 @@ import java.util.ArrayList;
public class PojoFactoryV2 implements Serializable { public class PojoFactoryV2 implements Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.servlet; package fi.codecrew.moya.servlet;
...@@ -43,7 +43,7 @@ import fi.codecrew.moya.model.UserImage; ...@@ -43,7 +43,7 @@ import fi.codecrew.moya.model.UserImage;
public class UserCardPngServlet extends GenericImageServlet { public class UserCardPngServlet extends GenericImageServlet {
/** /**
* *
*/ */
private static final long serialVersionUID = -3359999630873773508L; private static final long serialVersionUID = -3359999630873773508L;
...@@ -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());
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
/* /*
* To change this template, choose Tools | Templates * To change this template, choose Tools | Templates
...@@ -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;
...@@ -53,7 +52,7 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView; ...@@ -53,7 +52,7 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView;
import fi.codecrew.moya.web.cdiview.eticket.EticketView; import fi.codecrew.moya.web.cdiview.eticket.EticketView;
/** /**
* *
* @author tuukka * @author tuukka
*/ */
@Named("testView") @Named("testView")
...@@ -61,7 +60,7 @@ import fi.codecrew.moya.web.cdiview.eticket.EticketView; ...@@ -61,7 +60,7 @@ import fi.codecrew.moya.web.cdiview.eticket.EticketView;
public class TestDataView extends GenericCDIView { public class TestDataView extends GenericCDIView {
/** /**
* *
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -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
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview; package fi.codecrew.moya.web.cdiview;
...@@ -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;
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.card; package fi.codecrew.moya.web.cdiview.card;
...@@ -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";
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.card; package fi.codecrew.moya.web.cdiview.card;
...@@ -45,28 +45,28 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView; ...@@ -45,28 +45,28 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView;
@Named @Named
@ConversationScoped @ConversationScoped
public class CardTemplateDataEditView extends GenericCDIView { public class CardTemplateDataEditView extends GenericCDIView {
private static final long serialVersionUID = -9115983838324313414L; private static final long serialVersionUID = -9115983838324313414L;
private static final Logger logger = LoggerFactory.getLogger(CardTemplateDataEditView.class); private static final Logger logger = LoggerFactory.getLogger(CardTemplateDataEditView.class);
private Integer templateId = 0; private Integer templateId = 0;
private Integer cardTextDataId = 0; private Integer cardTextDataId = 0;
private Integer cardObjectDataId = 0; private Integer cardObjectDataId = 0;
private CardTemplateDataType createObjectType = CardTemplateDataType.UNKNOWN; private CardTemplateDataType createObjectType = CardTemplateDataType.UNKNOWN;
private CardTemplate cardTemplate; private CardTemplate cardTemplate;
private CardTextData cardTextData; private CardTextData cardTextData;
private CardObjectData cardObjectData; private CardObjectData cardObjectData;
private String fontColorHex; private String fontColorHex;
@EJB @EJB
private transient CardTemplateBeanLocal cfbean; private transient CardTemplateBeanLocal cfbean;
public void initView() { public void initView() {
if (super.requirePermissions(UserPermission.VIEW_ALL)) if (super.requirePermissions(UserPermission.VIEW_ALL))
{ {
...@@ -87,7 +87,7 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -87,7 +87,7 @@ public class CardTemplateDataEditView extends GenericCDIView {
setCardTextData(cfbean.findTextData(cardTextDataId)); setCardTextData(cfbean.findTextData(cardTextDataId));
logger.info("CardTextData {}", cardTextData); logger.info("CardTextData {}", cardTextData);
} }
if(templateId != 0) { if(templateId != 0) {
setCardTemplate(cfbean.find(templateId)); setCardTemplate(cfbean.find(templateId));
logger.info("CardTemplate {}", cardTemplate); logger.info("CardTemplate {}", cardTemplate);
...@@ -105,7 +105,7 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -105,7 +105,7 @@ public class CardTemplateDataEditView extends GenericCDIView {
} }
} }
} }
public void initCardTextData() { public void initCardTextData() {
if (super.requirePermissions(UserPermission.VIEW_ALL)) if (super.requirePermissions(UserPermission.VIEW_ALL))
{ {
...@@ -115,7 +115,7 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -115,7 +115,7 @@ public class CardTemplateDataEditView extends GenericCDIView {
} }
} }
} }
public void initCardObjectData() { public void initCardObjectData() {
if (super.requirePermissions(UserPermission.VIEW_ALL)) if (super.requirePermissions(UserPermission.VIEW_ALL))
{ {
...@@ -125,7 +125,7 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -125,7 +125,7 @@ public class CardTemplateDataEditView extends GenericCDIView {
} }
} }
} }
public void initCardTemplate() { public void initCardTemplate() {
if (super.requirePermissions(UserPermission.VIEW_ALL)) if (super.requirePermissions(UserPermission.VIEW_ALL))
{ {
...@@ -140,7 +140,7 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -140,7 +140,7 @@ public class CardTemplateDataEditView extends GenericCDIView {
} }
} }
} }
public void initCardTextDataCreate() { public void initCardTextDataCreate() {
if (super.requirePermissions(UserPermission.VIEW_ALL)) if (super.requirePermissions(UserPermission.VIEW_ALL))
{ {
...@@ -151,7 +151,7 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -151,7 +151,7 @@ public class CardTemplateDataEditView extends GenericCDIView {
} }
} }
} }
public void initCardTextObjectCreate() { public void initCardTextObjectCreate() {
if (super.requirePermissions(UserPermission.VIEW_ALL)) if (super.requirePermissions(UserPermission.VIEW_ALL))
{ {
...@@ -162,7 +162,7 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -162,7 +162,7 @@ public class CardTemplateDataEditView extends GenericCDIView {
} }
} }
} }
public void initCreateObjectType() { public void initCreateObjectType() {
if (super.requirePermissions(UserPermission.VIEW_ALL)) if (super.requirePermissions(UserPermission.VIEW_ALL))
{ {
...@@ -176,7 +176,7 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -176,7 +176,7 @@ public class CardTemplateDataEditView extends GenericCDIView {
}*/ }*/
} }
} }
public String deleteObjectData() { public String deleteObjectData() {
if(this.cardObjectData != null) { if(this.cardObjectData != null) {
setCardTemplate(cfbean.removeCardObjectData(this.cardObjectData)); setCardTemplate(cfbean.removeCardObjectData(this.cardObjectData));
...@@ -185,7 +185,7 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -185,7 +185,7 @@ public class CardTemplateDataEditView extends GenericCDIView {
logger.info("CardObjectData is null!"); logger.info("CardObjectData is null!");
return "/useradmin/listCardTemplateData"; return "/useradmin/listCardTemplateData";
} }
public String deleteTextData() { public String deleteTextData() {
if(this.cardTextData != null) { if(this.cardTextData != null) {
setCardTemplate(cfbean.removeCardTextData(this.cardTextData)); setCardTemplate(cfbean.removeCardTextData(this.cardTextData));
...@@ -194,7 +194,7 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -194,7 +194,7 @@ public class CardTemplateDataEditView extends GenericCDIView {
logger.info("CardTextData is null!"); logger.info("CardTextData is null!");
return "/useradmin/listCardTemplateData"; return "/useradmin/listCardTemplateData";
} }
public String deleteObjectData(Integer objectDataId) { public String deleteObjectData(Integer objectDataId) {
if(this.cardObjectData != null) { if(this.cardObjectData != null) {
setCardTemplate(cfbean.removeCardObjectData(cfbean.findObjectData(objectDataId))); setCardTemplate(cfbean.removeCardObjectData(cfbean.findObjectData(objectDataId)));
...@@ -203,7 +203,7 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -203,7 +203,7 @@ public class CardTemplateDataEditView extends GenericCDIView {
logger.info("CardObjectData is null!"); logger.info("CardObjectData is null!");
return "/useradmin/listCardTemplateData"; return "/useradmin/listCardTemplateData";
} }
public String deleteTextData(Integer textDataId) { public String deleteTextData(Integer textDataId) {
if(this.cardTextData != null) { if(this.cardTextData != null) {
setCardTemplate(cfbean.removeCardTextData(cfbean.findTextData(textDataId))); setCardTemplate(cfbean.removeCardTextData(cfbean.findTextData(textDataId)));
...@@ -212,11 +212,11 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -212,11 +212,11 @@ public class CardTemplateDataEditView extends GenericCDIView {
logger.info("CardTextData is null!"); logger.info("CardTextData is null!");
return "/useradmin/listCardTemplateData"; return "/useradmin/listCardTemplateData";
} }
public String localisedLabel(String text, String type) { public String localisedLabel(String text, String type) {
return I18n.get(text + type); return I18n.get(text + type);
} }
public String getFontColorHex() { public String getFontColorHex() {
return fontColorHex; return fontColorHex;
} }
...@@ -224,19 +224,19 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -224,19 +224,19 @@ public class CardTemplateDataEditView extends GenericCDIView {
public void setFontColorHex(String fontColorHex) { public void setFontColorHex(String fontColorHex) {
this.fontColorHex = fontColorHex; this.fontColorHex = fontColorHex;
} }
public String saveTextData() { public String saveTextData() {
//if(cardTextData.getMeta() == null) //if(cardTextData.getMeta() == null)
// cardTextData.setMeta(Json.createObjectBuilder().build()); // cardTextData.setMeta(Json.createObjectBuilder().build());
cardTextData = cfbean.save(cardTextData); cardTextData = cfbean.save(cardTextData);
return null; return null;
} }
public String saveObjectData() { public String saveObjectData() {
cardObjectData = cfbean.save(cardObjectData); cardObjectData = cfbean.save(cardObjectData);
return null; return null;
} }
public CardTextData getCardTextData() { public CardTextData getCardTextData() {
return cardTextData; return cardTextData;
} }
...@@ -252,7 +252,7 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -252,7 +252,7 @@ public class CardTemplateDataEditView extends GenericCDIView {
public void setCardObjectData(CardObjectData cardObjectData) { public void setCardObjectData(CardObjectData cardObjectData) {
this.cardObjectData = cardObjectData; this.cardObjectData = cardObjectData;
} }
public Integer getCardTextDataId() { public Integer getCardTextDataId() {
return cardTextDataId; return cardTextDataId;
} }
...@@ -276,7 +276,7 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -276,7 +276,7 @@ public class CardTemplateDataEditView extends GenericCDIView {
public void setCreateObjectType(CardTemplateDataType createObjectType) { public void setCreateObjectType(CardTemplateDataType createObjectType) {
this.createObjectType = createObjectType; this.createObjectType = createObjectType;
} }
public Integer getTemplateId() { public Integer getTemplateId() {
return templateId; return templateId;
} }
...@@ -292,21 +292,21 @@ public class CardTemplateDataEditView extends GenericCDIView { ...@@ -292,21 +292,21 @@ public class CardTemplateDataEditView extends GenericCDIView {
public void setCardTemplate(CardTemplate cardTemplate) { public void setCardTemplate(CardTemplate cardTemplate) {
this.cardTemplate = cardTemplate; this.cardTemplate = cardTemplate;
} }
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()));
} }
} }
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.content; package fi.codecrew.moya.web.cdiview.content;
...@@ -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();
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.eticket; package fi.codecrew.moya.web.cdiview.eticket;
...@@ -90,9 +90,9 @@ public class EticketView extends GenericCDIView { ...@@ -90,9 +90,9 @@ public class EticketView extends GenericCDIView {
super.navihandler.forward("/shop/createBill?faces-redirect=true"); super.navihandler.forward("/shop/createBill?faces-redirect=true");
} }
} }
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;
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.eticket; package fi.codecrew.moya.web.cdiview.eticket;
...@@ -64,7 +64,7 @@ public class StandaloneEticketView extends GenericCDIView { ...@@ -64,7 +64,7 @@ public class StandaloneEticketView extends GenericCDIView {
@EJB @EJB
private TicketBeanLocal ticketBean; private TicketBeanLocal ticketBean;
private ListDataModel<GroupMembership> memberlist; private ListDataModel<GroupMembership> memberlist;
private boolean mapVisible = false; private boolean mapVisible = false;
...@@ -86,9 +86,9 @@ public class StandaloneEticketView extends GenericCDIView { ...@@ -86,9 +86,9 @@ 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;
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.license; package fi.codecrew.moya.web.cdiview.license;
...@@ -44,16 +44,16 @@ public class LicenseView extends GenericCDIView { ...@@ -44,16 +44,16 @@ public class LicenseView extends GenericCDIView {
private static final long serialVersionUID = -8346420143750551402L; private static final long serialVersionUID = -8346420143750551402L;
private EventUser currentUser; private EventUser currentUser;
@EJB @EJB
private PermissionBeanLocal permissionBean; private PermissionBeanLocal permissionBean;
@EJB @EJB
private EventBeanLocal eventBean; private EventBeanLocal eventBean;
@EJB @EJB
private LicenseBeanLocal licenseBean; private LicenseBeanLocal licenseBean;
@EJB @EJB
private ProductBeanLocal productBean; private ProductBeanLocal productBean;
...@@ -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;
} }
...@@ -97,16 +97,16 @@ public class LicenseView extends GenericCDIView { ...@@ -97,16 +97,16 @@ public class LicenseView extends GenericCDIView {
} }
public String openSelectedCode() { public String openSelectedCode() {
if(this.licenses != null && this.licenses.isRowAvailable()) { if(this.licenses != null && this.licenses.isRowAvailable()) {
LicenseTarget license = this.licenses.getRowData(); LicenseTarget license = this.licenses.getRowData();
try { try {
LicenseCode code = licenseBean.createAndAccessCode(license, currentUser.getUser()); LicenseCode code = licenseBean.createAndAccessCode(license, currentUser.getUser());
} catch(GenerationException x) { } catch(GenerationException x) {
this.addFaceMessage("game.out"); this.addFaceMessage("game.out");
} }
licenseCodes = null; licenseCodes = null;
initUserView(); initUserView();
...@@ -144,7 +144,7 @@ public class LicenseView extends GenericCDIView { ...@@ -144,7 +144,7 @@ public class LicenseView extends GenericCDIView {
public void setCurrentLicense(LicenseTarget currentLicense) { public void setCurrentLicense(LicenseTarget currentLicense) {
this.currentLicense = currentLicense; this.currentLicense = currentLicense;
} }
public List<Product> getProductsForLicenses() { public List<Product> getProductsForLicenses() {
return productBean.findPlaceProducts(); return productBean.findPlaceProducts();
} }
......
...@@ -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;
...@@ -35,7 +34,7 @@ import fi.codecrew.moya.web.cdiview.user.UserView; ...@@ -35,7 +34,7 @@ import fi.codecrew.moya.web.cdiview.user.UserView;
public class AjaxMapView extends GenericCDIView { public class AjaxMapView extends GenericCDIView {
/** /**
* *
*/ */
private static final long serialVersionUID = 8203589456357519480L; private static final long serialVersionUID = 8203589456357519480L;
// @Inject // @Inject
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.map; package fi.codecrew.moya.web.cdiview.map;
...@@ -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;
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.map; package fi.codecrew.moya.web.cdiview.map;
...@@ -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;
......
...@@ -24,7 +24,7 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView; ...@@ -24,7 +24,7 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView;
public class UnlockedPlaceView extends GenericCDIView { public class UnlockedPlaceView extends GenericCDIView {
/** /**
* *
*/ */
private static final long serialVersionUID = 7430277821503568386L; private static final long serialVersionUID = 7430277821503568386L;
...@@ -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) {
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.menu; package fi.codecrew.moya.web.cdiview.menu;
...@@ -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
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.organisation; package fi.codecrew.moya.web.cdiview.organisation;
...@@ -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();
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
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;
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.poll; package fi.codecrew.moya.web.cdiview.poll;
...@@ -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));
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.reader; package fi.codecrew.moya.web.cdiview.reader;
...@@ -39,13 +39,13 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView; ...@@ -39,13 +39,13 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView;
public class ReaderListDataView extends GenericCDIView { public class ReaderListDataView extends GenericCDIView {
/** /**
* *
*/ */
private static final long serialVersionUID = -601822388844764143L; private static final long serialVersionUID = -601822388844764143L;
@EJB @EJB
private ReaderBeanLocal readerbean; private ReaderBeanLocal readerbean;
@Inject @Inject
private ReaderNameContainer readerNameContainer; private ReaderNameContainer readerNameContainer;
...@@ -61,37 +61,37 @@ public class ReaderListDataView extends GenericCDIView { ...@@ -61,37 +61,37 @@ 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;
} }
public String selectReader() { public String selectReader() {
if(readers.isRowAvailable()) { if(readers.isRowAvailable()) {
readerNameContainer.setReaderId(readers.getRowData().getId()); readerNameContainer.setReaderId(readers.getRowData().getId());
} }
return null; return null;
} }
public void selectMultipleReaders() { public void selectMultipleReaders() {
if(readers.isRowAvailable()) { if(readers.isRowAvailable()) {
readerNameContainer.addReader(readers.getRowData().getId()); readerNameContainer.addReader(readers.getRowData().getId());
} }
} }
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);
if(r != null) if(r != null)
readers.add(r); readers.add(r);
} }
return new ListDataModel<Reader>(readers); return new ListDataModel<>(readers);
} }
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.reader; package fi.codecrew.moya.web.cdiview.reader;
...@@ -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;
...@@ -46,7 +46,7 @@ public class ReaderNameContainer implements Serializable { ...@@ -46,7 +46,7 @@ public class ReaderNameContainer implements Serializable {
/** /**
* use this function when using readers in "only one reader" -mode * use this function when using readers in "only one reader" -mode
* *
* @return first selected reader, or null if no reader selected * @return first selected reader, or null if no reader selected
*/ */
public Integer getReaderId() { public Integer getReaderId() {
...@@ -58,7 +58,7 @@ public class ReaderNameContainer implements Serializable { ...@@ -58,7 +58,7 @@ public class ReaderNameContainer implements Serializable {
/** /**
* Use this function when using readers in "only one reader" -mode * Use this function when using readers in "only one reader" -mode
* *
* @param readerId * @param readerId
* to set, or null to clear all readers * to set, or null to clear all readers
*/ */
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.reader; package fi.codecrew.moya.web.cdiview.reader;
...@@ -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,12 +41,11 @@ import fi.codecrew.moya.model.Product; ...@@ -40,12 +41,11 @@ 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;
@Named @Named
@SessionScoped @SessionScoped
public class ReaderView extends GenericCDIView { public class ReaderView extends GenericCDIView {
...@@ -55,7 +55,7 @@ public class ReaderView extends GenericCDIView { ...@@ -55,7 +55,7 @@ public class ReaderView extends GenericCDIView {
private ListDataModel<UserCardWrapper> userlist; private ListDataModel<UserCardWrapper> userlist;
private ListDataModel<ReaderEvent> readerEventList; private ListDataModel<ReaderEvent> readerEventList;
private Reader editReader = null; private Reader editReader = null;
@Inject @Inject
...@@ -82,7 +82,7 @@ public class ReaderView extends GenericCDIView { ...@@ -82,7 +82,7 @@ public class ReaderView extends GenericCDIView {
@Inject @Inject
private UserView userview; private UserView userview;
public void initEditReader() { public void initEditReader() {
if (super.requirePermissions(ShopPermission.SHOP_TO_OTHERS) && editReader == null) { if (super.requirePermissions(ShopPermission.SHOP_TO_OTHERS) && editReader == null) {
editReader = readerbean.getReader(readerid); editReader = readerbean.getReader(readerid);
...@@ -143,9 +143,9 @@ public class ReaderView extends GenericCDIView { ...@@ -143,9 +143,9 @@ public class ReaderView extends GenericCDIView {
return "/useradmin/edit"; return "/useradmin/edit";
} }
public String searchforuser() public String searchforuser()
{ {
if (usersearch == null || usersearch.length() < 2) { if (usersearch == null || usersearch.length() < 2) {
...@@ -156,14 +156,14 @@ public class ReaderView extends GenericCDIView { ...@@ -156,14 +156,14 @@ public class ReaderView extends GenericCDIView {
return null; return null;
} }
*/ */
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;
} }
...@@ -242,7 +242,7 @@ public class ReaderView extends GenericCDIView { ...@@ -242,7 +242,7 @@ public class ReaderView extends GenericCDIView {
return ReaderType.values(); return ReaderType.values();
} }
/** /**
* Get newest readerevent from any reader * Get newest readerevent from any reader
* @return * @return
...@@ -251,18 +251,18 @@ public class ReaderView extends GenericCDIView { ...@@ -251,18 +251,18 @@ public class ReaderView extends GenericCDIView {
ReaderEvent newestEvent = null; ReaderEvent newestEvent = null;
for(Integer rid : namecontainer.getReaders()) { for(Integer rid : namecontainer.getReaders()) {
ReaderEvent event = readerbean.getLastReaderEvent(rid); ReaderEvent event = readerbean.getLastReaderEvent(rid);
if(newestEvent == null || event.getUpdatetime().getTime() > newestEvent.getUpdatetime().getTime()) { if(newestEvent == null || event.getUpdatetime().getTime() > newestEvent.getUpdatetime().getTime()) {
newestEvent = event; newestEvent = event;
} }
} }
return newestEvent; return newestEvent;
} }
public ReaderEvent getReaderEvent() { public ReaderEvent getReaderEvent() {
if(namecontainer.isAutopoll()) { if(namecontainer.isAutopoll()) {
if(isNewCodes()) { if(isNewCodes()) {
return pollingCodeHandled(); return pollingCodeHandled();
...@@ -272,7 +272,7 @@ public class ReaderView extends GenericCDIView { ...@@ -272,7 +272,7 @@ public class ReaderView extends GenericCDIView {
return null; return null;
} }
} }
if (readerEventList == null) if (readerEventList == null)
return null; return null;
...@@ -293,13 +293,13 @@ public class ReaderView extends GenericCDIView { ...@@ -293,13 +293,13 @@ public class ReaderView extends GenericCDIView {
/** /**
* Mark pollingcode handled (for autoread-stuff) * Mark pollingcode handled (for autoread-stuff)
* *
* And also return last code, just in case. * And also return last code, just in case.
* @return * @return
*/ */
public ReaderEvent pollingCodeHandled() { public ReaderEvent pollingCodeHandled() {
lastReadEvent = getNewestEvent(); lastReadEvent = getNewestEvent();
return lastReadEvent; return lastReadEvent;
} }
...@@ -312,30 +312,30 @@ public class ReaderView extends GenericCDIView { ...@@ -312,30 +312,30 @@ public class ReaderView extends GenericCDIView {
public boolean isNewCodes() { public boolean isNewCodes() {
if (!namecontainer.isAutopoll()) if (!namecontainer.isAutopoll())
return false; return false;
for(Integer rid : namecontainer.getReaders()) { for(Integer rid : namecontainer.getReaders()) {
ReaderEvent event = readerbean.getLastReaderEvent(rid); ReaderEvent event = readerbean.getLastReaderEvent(rid);
if(event == null || event.getId() == null) { if(event == null || event.getId() == null) {
continue; continue;
} }
// found new code, and there is no previous code, that's true // found new code, and there is no previous code, that's true
if(lastReadEvent == null || lastReadEvent.getId() == null) if(lastReadEvent == null || lastReadEvent.getId() == null)
return true; return true;
// is new code newer than previous code? // is new code newer than previous code?
if(lastReadEvent.getUpdatetime().getTime() < event.getUpdatetime().getTime()) if(lastReadEvent.getUpdatetime().getTime() < event.getUpdatetime().getTime())
return true; return true;
} }
return false; return false;
} }
public String getUserInsertCode() { public String getUserInsertCode() {
return ""; return "";
} }
...@@ -351,22 +351,22 @@ public class ReaderView extends GenericCDIView { ...@@ -351,22 +351,22 @@ public class ReaderView extends GenericCDIView {
public void setPollingMode(boolean pollingMode) { public void setPollingMode(boolean pollingMode) {
if(!namecontainer.isAutopoll() && pollingMode) { if(!namecontainer.isAutopoll() && pollingMode) {
this.initializeForPolling(); this.initializeForPolling();
} }
namecontainer.setAutopoll(pollingMode); namecontainer.setAutopoll(pollingMode);
} }
public void changeReader() { public void changeReader() {
namecontainer.setReaderId(null); namecontainer.setReaderId(null);
navihandler.forward("/info/index"); navihandler.forward("/info/index");
} }
public Reader getCurrentReader() { public Reader getCurrentReader() {
return readerbean.getReader(namecontainer.getReaderId()); return readerbean.getReader(namecontainer.getReaderId());
} }
...@@ -380,5 +380,5 @@ public class ReaderView extends GenericCDIView { ...@@ -380,5 +380,5 @@ public class ReaderView extends GenericCDIView {
public void setEditReader(Reader editReader) { public void setEditReader(Reader editReader) {
this.editReader = editReader; this.editReader = editReader;
} }
} }
...@@ -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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.shop; package fi.codecrew.moya.web.cdiview.shop;
...@@ -52,7 +52,7 @@ import fi.codecrew.moya.web.helpers.LazyEntityDataModel; ...@@ -52,7 +52,7 @@ import fi.codecrew.moya.web.helpers.LazyEntityDataModel;
public class BillListView extends GenericCDIView { public class BillListView extends GenericCDIView {
/** /**
* *
*/ */
private static final long serialVersionUID = -4668803787903428161L; private static final long serialVersionUID = -4668803787903428161L;
...@@ -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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.shop; package fi.codecrew.moya.web.cdiview.shop;
...@@ -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);
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.shop; package fi.codecrew.moya.web.cdiview.shop;
...@@ -51,13 +51,13 @@ import fi.codecrew.moya.web.helpers.ProductShopItem; ...@@ -51,13 +51,13 @@ import fi.codecrew.moya.web.helpers.ProductShopItem;
public class FoodWaveFoodView extends GenericCDIView { public class FoodWaveFoodView extends GenericCDIView {
/** /**
* *
*/ */
private static final long serialVersionUID = 5723448087928988814L; private static final long serialVersionUID = 5723448087928988814L;
@EJB @EJB
private FoodWaveBeanLocal foodWaveBean; private FoodWaveBeanLocal foodWaveBean;
@Inject @Inject
private ProductShopItemHelper psiHelper; private ProductShopItemHelper psiHelper;
...@@ -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();
} }
...@@ -146,7 +146,7 @@ public class FoodWaveFoodView extends GenericCDIView { ...@@ -146,7 +146,7 @@ public class FoodWaveFoodView extends GenericCDIView {
/** /**
* Just create bills, they are nice <insert picture of bill gates here> * Just create bills, they are nice <insert picture of bill gates here>
* *
* @return * @return
*/ */
public Bill createBillFromShoppingcart() { public Bill createBillFromShoppingcart() {
...@@ -167,16 +167,16 @@ public class FoodWaveFoodView extends GenericCDIView { ...@@ -167,16 +167,16 @@ public class FoodWaveFoodView extends GenericCDIView {
return bill; return bill;
} }
public String buyAndPayWithCredits() { public String buyAndPayWithCredits() {
Bill b = createBillFromShoppingcart(); Bill b = createBillFromShoppingcart();
try { try {
billBean.markPaid(b, Calendar.getInstance(), true, Bill.BillPaymentSource.CREDITS); billBean.markPaid(b, Calendar.getInstance(), true, Bill.BillPaymentSource.CREDITS);
} catch (BillException e) { } catch (BillException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
super.addFaceMessage("foodwave.markPaid"); super.addFaceMessage("foodwave.markPaid");
return "/useradmin/edit"; return "/useradmin/edit";
} }
...@@ -184,14 +184,14 @@ public class FoodWaveFoodView extends GenericCDIView { ...@@ -184,14 +184,14 @@ public class FoodWaveFoodView extends GenericCDIView {
public String buyAndPay() public String buyAndPay()
{ {
Bill b = createBillFromShoppingcart(); Bill b = createBillFromShoppingcart();
try { try {
billBean.markPaid(b, Calendar.getInstance(), false, Bill.BillPaymentSource.CASH); billBean.markPaid(b, Calendar.getInstance(), false, Bill.BillPaymentSource.CASH);
} catch (BillException e) { } catch (BillException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
super.addFaceMessage("foodwave.markPaid"); super.addFaceMessage("foodwave.markPaid");
return "/useradmin/edit"; return "/useradmin/edit";
} }
...@@ -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;
} }
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.shop; package fi.codecrew.moya.web.cdiview.shop;
...@@ -107,8 +107,8 @@ public class FoodWaveView extends GenericCDIView { ...@@ -107,8 +107,8 @@ public class FoodWaveView extends GenericCDIView {
super.beginConversation(); super.beginConversation();
} }
} }
foodWaves = new ListDataModel<FoodWave>(foodWaveBean.getEventFoodWaves()); foodWaves = new ListDataModel<>(foodWaveBean.getEventFoodWaves());
} }
public String createFoodwave() { public String createFoodwave() {
...@@ -122,9 +122,9 @@ public class FoodWaveView extends GenericCDIView { ...@@ -122,9 +122,9 @@ public class FoodWaveView extends GenericCDIView {
return "/foodmanager/listFoodwaves"; return "/foodmanager/listFoodwaves";
} }
public void initListFoodwaves() public void initListFoodwaves()
{ {
if (super.requirePermissions(ShopPermission.SHOP_FOODWAVE) && template == null) if (super.requirePermissions(ShopPermission.SHOP_FOODWAVE) && template == null)
...@@ -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();
...@@ -171,8 +171,8 @@ public class FoodWaveView extends GenericCDIView { ...@@ -171,8 +171,8 @@ 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);
...@@ -216,10 +216,10 @@ public class FoodWaveView extends GenericCDIView { ...@@ -216,10 +216,10 @@ public class FoodWaveView extends GenericCDIView {
} }
return ret.negate(); return ret.negate();
} }
public BigDecimal getFoodwaveBuyInPrice() public BigDecimal getFoodwaveBuyInPrice()
{ {
...@@ -257,19 +257,19 @@ public class FoodWaveView extends GenericCDIView { ...@@ -257,19 +257,19 @@ public class FoodWaveView extends GenericCDIView {
return null; return null;
} }
public String markBillPaid() { public String markBillPaid() {
if (permbean.hasPermission(BillPermission.WRITE_ALL) && bills != null && bills.isRowAvailable()) { if (permbean.hasPermission(BillPermission.WRITE_ALL) && bills != null && bills.isRowAvailable()) {
Bill b = bills.getRowData(); Bill b = bills.getRowData();
try { try {
b = billbean.markPaid(b, Calendar.getInstance(), false, Bill.BillPaymentSource.CASH); b = billbean.markPaid(b, Calendar.getInstance(), false, Bill.BillPaymentSource.CASH);
} catch (BillException e) { } catch (BillException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
foodWaveId = selectedFoodWave.getId(); foodWaveId = selectedFoodWave.getId();
selectedFoodWave = null; selectedFoodWave = null;
...@@ -279,17 +279,17 @@ public class FoodWaveView extends GenericCDIView { ...@@ -279,17 +279,17 @@ public class FoodWaveView extends GenericCDIView {
return null; return null;
} }
public String markBillPaidWithCredits() { public String markBillPaidWithCredits() {
if (permbean.hasPermission(BillPermission.WRITE_ALL) && bills != null && bills.isRowAvailable()) { if (permbean.hasPermission(BillPermission.WRITE_ALL) && bills != null && bills.isRowAvailable()) {
Bill b = bills.getRowData(); Bill b = bills.getRowData();
try { try {
b = billbean.markPaid(b, Calendar.getInstance(), true, Bill.BillPaymentSource.CREDITS); b = billbean.markPaid(b, Calendar.getInstance(), true, Bill.BillPaymentSource.CREDITS);
} catch (BillException e) { } catch (BillException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
foodWaveId = selectedFoodWave.getId(); foodWaveId = selectedFoodWave.getId();
selectedFoodWave = null; selectedFoodWave = null;
...@@ -335,15 +335,15 @@ public class FoodWaveView extends GenericCDIView { ...@@ -335,15 +335,15 @@ public class FoodWaveView extends GenericCDIView {
} }
public void initFoodWaveOrderList() { public void initFoodWaveOrderList() {
if (super.requirePermissions(ShopPermission.MANAGE_FOODWAVES) && selectedFoodWave == null) { if (super.requirePermissions(ShopPermission.MANAGE_FOODWAVES) && selectedFoodWave == null) {
selectedFoodWave = foodWaveBean.findFoodwave(foodWaveId); selectedFoodWave = foodWaveBean.findFoodwave(foodWaveId);
logger.debug("Got foodwave {} with id {}", selectedFoodWave, foodWaveId); logger.debug("Got foodwave {} with id {}", selectedFoodWave, foodWaveId);
super.beginConversation(); super.beginConversation();
} }
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());
} }
...@@ -427,15 +427,15 @@ public class FoodWaveView extends GenericCDIView { ...@@ -427,15 +427,15 @@ public class FoodWaveView extends GenericCDIView {
public ListDataModel<FoodWave> getFoodWaves() { public ListDataModel<FoodWave> getFoodWaves() {
return foodWaves; return foodWaves;
} }
public ListDataModel<AccountEvent> getAccountEventLines() { public ListDataModel<AccountEvent> getAccountEventLines() {
return accountEventLines; return accountEventLines;
} }
/* /*
* public List<BillLine> getUnpaidBills() { return unpaidBills; } * public List<BillLine> getUnpaidBills() { return unpaidBills; }
* *
* public void setUnpaidBills(List<BillLine> unpaidBills) { this.unpaidBills * public void setUnpaidBills(List<BillLine> unpaidBills) { this.unpaidBills
* = unpaidBills; } * = unpaidBills; }
*/ */
......
...@@ -127,8 +127,8 @@ public class ProductShopView extends GenericCDIView { ...@@ -127,8 +127,8 @@ 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) {
psiHelper.updateProductShopItemCount(item); psiHelper.updateProductShopItemCount(item);
...@@ -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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
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
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.shop; package fi.codecrew.moya.web.cdiview.shop;
...@@ -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);
...@@ -182,7 +182,7 @@ public class ProductView extends GenericCDIView { ...@@ -182,7 +182,7 @@ public class ProductView extends GenericCDIView {
{ {
this.productOptionGroup = new ProductOptionGroup(); this.productOptionGroup = new ProductOptionGroup();
this.productOptionGroup.setProduct(product); this.productOptionGroup.setProduct(product);
return "/product/editProductOptionGroup"; return "/product/editProductOptionGroup";
} }
...@@ -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;
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.shop; package fi.codecrew.moya.web.cdiview.shop;
...@@ -49,8 +49,8 @@ public class SalespointListView extends GenericCDIView { ...@@ -49,8 +49,8 @@ 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);
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.shop; package fi.codecrew.moya.web.cdiview.shop;
...@@ -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() {
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.tournaments; package fi.codecrew.moya.web.cdiview.tournaments;
...@@ -30,7 +30,7 @@ import javax.inject.Named; ...@@ -30,7 +30,7 @@ import javax.inject.Named;
public class TournamentAddTeamView implements Serializable { public class TournamentAddTeamView implements Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -38,14 +38,14 @@ public class TournamentAddTeamView implements Serializable { ...@@ -38,14 +38,14 @@ public class TournamentAddTeamView implements Serializable {
public TournamentAddTeamView() { public TournamentAddTeamView() {
// Players // Players
setPlayers(new ArrayList<String>()); setPlayers(new ArrayList<>());
getPlayers().add("");
getPlayers().add(""); getPlayers().add("");
getPlayers().add(""); getPlayers().add("");
getPlayers().add(""); getPlayers().add("");
getPlayers().add(""); getPlayers().add("");
getPlayers().add("");
} }
public List<String> getPlayers() { public List<String> getPlayers() {
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.tournaments; package fi.codecrew.moya.web.cdiview.tournaments;
...@@ -38,19 +38,19 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView; ...@@ -38,19 +38,19 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView;
@ConversationScoped @ConversationScoped
public class TournamentParticipantsView extends GenericCDIView { public class TournamentParticipantsView extends GenericCDIView {
private static final long serialVersionUID = -6066216858686165211L; private static final long serialVersionUID = -6066216858686165211L;
private HashMap<Integer, String> eventUserGameID = null; private HashMap<Integer, String> eventUserGameID = null;
@EJB private UserBeanLocal userBean; @EJB private UserBeanLocal userBean;
@EJB private TournamentBeanLocal tournamentBean; @EJB private TournamentBeanLocal tournamentBean;
private Tournament tournament = null; private Tournament tournament = null;
public String showView(Integer tournamentId) { public String showView(Integer tournamentId) {
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());
if(gid != null) if(gid != null)
...@@ -65,18 +65,18 @@ public class TournamentParticipantsView extends GenericCDIView { ...@@ -65,18 +65,18 @@ public class TournamentParticipantsView extends GenericCDIView {
else else
return "/tournaments/admin/view_tournament_team.xhtml"; return "/tournaments/admin/view_tournament_team.xhtml";
} }
public void deleteParticipation(ActionEvent ae) { public void deleteParticipation(ActionEvent ae) {
try { try {
Integer id = (Integer)ae.getComponent().getAttributes().get("participantid"); Integer id = (Integer)ae.getComponent().getAttributes().get("participantid");
tournamentBean.deleteParticipationById(id); tournamentBean.deleteParticipationById(id);
this.tournament = tournamentBean.getTournamentById(this.tournament.getId()); this.tournament = tournamentBean.getTournamentById(this.tournament.getId());
} catch(Exception e) { } catch(Exception e) {
MessageHelper.err(e.getMessage()); MessageHelper.err(e.getMessage());
} }
} }
public String cancel() { public String cancel() {
this.endConversation(); this.endConversation();
return "/tournaments/admin/index.xhtml"; return "/tournaments/admin/index.xhtml";
...@@ -89,7 +89,7 @@ public class TournamentParticipantsView extends GenericCDIView { ...@@ -89,7 +89,7 @@ public class TournamentParticipantsView extends GenericCDIView {
public void setTournament(Tournament tournament) { public void setTournament(Tournament tournament) {
this.tournament = tournament; this.tournament = tournament;
} }
public HashMap<Integer, String> getEventUserGameID() { public HashMap<Integer, String> getEventUserGameID() {
return eventUserGameID; return eventUserGameID;
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.tournaments; package fi.codecrew.moya.web.cdiview.tournaments;
...@@ -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());
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.user; package fi.codecrew.moya.web.cdiview.user;
...@@ -70,7 +70,7 @@ public class CardView extends GenericCDIView { ...@@ -70,7 +70,7 @@ public class CardView extends GenericCDIView {
private static final Logger logger = LoggerFactory.getLogger(CardView.class); private static final Logger logger = LoggerFactory.getLogger(CardView.class);
private Integer clonedTemplateId; private Integer clonedTemplateId;
public void initCardCreate() { public void initCardCreate() {
if (super.requirePermissions(UserPermission.WRITE_ROLES)) if (super.requirePermissions(UserPermission.WRITE_ROLES))
{ {
...@@ -78,7 +78,7 @@ public class CardView extends GenericCDIView { ...@@ -78,7 +78,7 @@ public class CardView extends GenericCDIView {
super.beginConversation(); super.beginConversation();
} }
} }
public void initCardClone() { public void initCardClone() {
if (super.requirePermissions(UserPermission.WRITE_ROLES)) if (super.requirePermissions(UserPermission.WRITE_ROLES))
{ {
...@@ -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);
...@@ -156,10 +156,10 @@ public class CardView extends GenericCDIView { ...@@ -156,10 +156,10 @@ public class CardView extends GenericCDIView {
CardTemplate srcTemplate = cfbean.find(clonedTemplateId); CardTemplate srcTemplate = cfbean.find(clonedTemplateId);
cfbean.create(getCardTemplate()); cfbean.create(getCardTemplate());
CardTemplate dstTemplate = getCardTemplate(); CardTemplate dstTemplate = getCardTemplate();
List<CardObjectData> srcObjectDatas = cfbean.findCardObjectDatas(srcTemplate); List<CardObjectData> srcObjectDatas = cfbean.findCardObjectDatas(srcTemplate);
List<CardTextData> srcTextDatas = cfbean.findCardTextDatas(srcTemplate); List<CardTextData> srcTextDatas = cfbean.findCardTextDatas(srcTemplate);
for (CardTextData cardTextData : srcTextDatas) { for (CardTextData cardTextData : srcTextDatas) {
CardTextData dstTextData = new CardTextData(); CardTextData dstTextData = new CardTextData();
dstTextData.setCardTemplate(dstTemplate); dstTextData.setCardTemplate(dstTemplate);
...@@ -179,7 +179,7 @@ public class CardView extends GenericCDIView { ...@@ -179,7 +179,7 @@ public class CardView extends GenericCDIView {
logger.info("Saving cardTextData for cloned cardTemplate"); logger.info("Saving cardTextData for cloned cardTemplate");
dstTextData = cfbean.save(dstTextData); dstTextData = cfbean.save(dstTextData);
} }
for (CardObjectData cardObjectData : srcObjectDatas) { for (CardObjectData cardObjectData : srcObjectDatas) {
CardObjectData dstObjectData = new CardObjectData(); CardObjectData dstObjectData = new CardObjectData();
dstObjectData.setCardTemplate(dstTemplate); dstObjectData.setCardTemplate(dstTemplate);
...@@ -191,12 +191,12 @@ public class CardView extends GenericCDIView { ...@@ -191,12 +191,12 @@ public class CardView extends GenericCDIView {
logger.info("Saving cardObjectData for cloned cardTemplate"); logger.info("Saving cardObjectData for cloned cardTemplate");
dstObjectData = cfbean.save(dstObjectData); dstObjectData = cfbean.save(dstObjectData);
} }
cardTemplates = getCardTemplate().getEvent().getCardTemplates(); cardTemplates = getCardTemplate().getEvent().getCardTemplates();
} }
return "/useradmin/listCardTemplates"; return "/useradmin/listCardTemplates";
} }
public String saveTemplate() public String saveTemplate()
{ {
cardTemplate = cfbean.save(cardTemplate); cardTemplate = cfbean.save(cardTemplate);
...@@ -242,15 +242,15 @@ public class CardView extends GenericCDIView { ...@@ -242,15 +242,15 @@ public class CardView extends GenericCDIView {
public void setTemplateImage(UploadedFile templateImage) { public void setTemplateImage(UploadedFile templateImage) {
this.templateImage = templateImage; this.templateImage = templateImage;
} }
public CardTemplateDataType getTextDataType() { public CardTemplateDataType getTextDataType() {
return CardTemplateDataType.TEXT_DATA; return CardTemplateDataType.TEXT_DATA;
} }
public CardTemplateDataType getObjectDataType() { public CardTemplateDataType getObjectDataType() {
return CardTemplateDataType.OBJECT_DATA; return CardTemplateDataType.OBJECT_DATA;
} }
public Integer getClonedTemplateId() { public Integer getClonedTemplateId() {
return clonedTemplateId; return clonedTemplateId;
} }
...@@ -258,5 +258,5 @@ public class CardView extends GenericCDIView { ...@@ -258,5 +258,5 @@ public class CardView extends GenericCDIView {
public void setClonedTemplateId(Integer clonedTemplateId) { public void setClonedTemplateId(Integer clonedTemplateId) {
this.clonedTemplateId = clonedTemplateId; this.clonedTemplateId = clonedTemplateId;
} }
} }
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.user; package fi.codecrew.moya.web.cdiview.user;
...@@ -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())
{ {
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
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);
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.user; package fi.codecrew.moya.web.cdiview.user;
...@@ -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);
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.user; package fi.codecrew.moya.web.cdiview.user;
...@@ -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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
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
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.user; package fi.codecrew.moya.web.cdiview.user;
...@@ -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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.user; package fi.codecrew.moya.web.cdiview.user;
...@@ -54,25 +54,25 @@ public class UserOverviewView extends GenericCDIView { ...@@ -54,25 +54,25 @@ public class UserOverviewView extends GenericCDIView {
@EJB @EJB
private UserBeanLocal userBean; private UserBeanLocal userBean;
private ListDataModel<UserOverviewItem> userOverviewItems = null; private ListDataModel<UserOverviewItem> userOverviewItems = null;
private static final Logger logger = LoggerFactory.getLogger(UserOverviewView.class); private static final Logger logger = LoggerFactory.getLogger(UserOverviewView.class);
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"));
ovlist.add(uoi); ovlist.add(uoi);
} }
userOverviewItems = new ListDataModel<>(ovlist); userOverviewItems = new ListDataModel<>(ovlist);
super.beginConversation(); super.beginConversation();
} }
} }
public ListDataModel<UserOverviewItem> getUserOverviewItems() { public ListDataModel<UserOverviewItem> getUserOverviewItems() {
return userOverviewItems; return userOverviewItems;
} }
...@@ -91,9 +91,9 @@ public class UserOverviewView extends GenericCDIView { ...@@ -91,9 +91,9 @@ public class UserOverviewView extends GenericCDIView {
logger.info("rejectCard(): Rejecting card {}", cardItem.getPrintedCard()); logger.info("rejectCard(): Rejecting card {}", cardItem.getPrintedCard());
PrintedCard card = cardItem.getPrintedCard(); PrintedCard card = cardItem.getPrintedCard();
if(card != null) { if(card != null) {
MailMessage mail = null; MailMessage mail = null;
if(cardItem.isSendRejectionMail()) { if(cardItem.isSendRejectionMail()) {
mail = new MailMessage(); mail = new MailMessage();
...@@ -103,7 +103,7 @@ public class UserOverviewView extends GenericCDIView { ...@@ -103,7 +103,7 @@ public class UserOverviewView extends GenericCDIView {
mail.setSubject(cardItem.getRejectionMsgSubject()); mail.setSubject(cardItem.getRejectionMsgSubject());
mail.setMessage(cardItem.getRejectionMsgBody()); mail.setMessage(cardItem.getRejectionMsgBody());
} }
card = userBean.rejectPrintedCard(card, mail); card = userBean.rejectPrintedCard(card, mail);
cardItem.setPrintedCard(card); cardItem.setPrintedCard(card);
logger.info("rejectCard(): Rejected card {}, state {}", card, card.getCardState() ); logger.info("rejectCard(): Rejected card {}, state {}", card, card.getCardState() );
...@@ -127,7 +127,7 @@ public class UserOverviewView extends GenericCDIView { ...@@ -127,7 +127,7 @@ public class UserOverviewView extends GenericCDIView {
public String crop() public String crop()
{ {
UserOverviewItem cardItem = userOverviewItems.getRowData(); UserOverviewItem cardItem = userOverviewItems.getRowData();
if (cardItem == null || cardItem.getCroppedImage() == null ) if (cardItem == null || cardItem.getCroppedImage() == null )
return null; return null;
...@@ -147,7 +147,7 @@ public class UserOverviewView extends GenericCDIView { ...@@ -147,7 +147,7 @@ public class UserOverviewView extends GenericCDIView {
} }
return null; return null;
} }
public void setUserOverviewItems(ListDataModel<UserOverviewItem> userOverviewItems) { public void setUserOverviewItems(ListDataModel<UserOverviewItem> userOverviewItems) {
this.userOverviewItems = userOverviewItems; this.userOverviewItems = userOverviewItems;
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.user; package fi.codecrew.moya.web.cdiview.user;
...@@ -80,7 +80,7 @@ public class UserSearchView extends PaginationView<UserWrapper> { ...@@ -80,7 +80,7 @@ public class UserSearchView extends PaginationView<UserWrapper> {
} }
/** /**
* *
*/ */
private static final long serialVersionUID = -7131921062890234604L; private static final long serialVersionUID = -7131921062890234604L;
...@@ -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();
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.cdiview.voting; package fi.codecrew.moya.web.cdiview.voting;
...@@ -34,7 +34,7 @@ import fi.codecrew.moya.model.Vote; ...@@ -34,7 +34,7 @@ import fi.codecrew.moya.model.Vote;
public class EntryWrapper implements Serializable { public class EntryWrapper implements Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = -8261328741517788115L; private static final long serialVersionUID = -8261328741517788115L;
private Integer votetotal; private Integer votetotal;
...@@ -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() {
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.converter; package fi.codecrew.moya.web.converter;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.faces.component.UIComponent; import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.faces.convert.Converter; import javax.faces.convert.Converter;
import javax.inject.Named; 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,
String value) { String value) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public String getAsString(FacesContext context, UIComponent component, public String getAsString(FacesContext context, UIComponent component,
Object value) { Object value) {
if(value == null) { if(value == null) {
return ""; return "";
} }
else { else {
return "x"; return "x";
} }
} }
} }
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.converter; package fi.codecrew.moya.web.converter;
...@@ -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();
} }
} }
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.converter; package fi.codecrew.moya.web.converter;
...@@ -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);
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.converter; package fi.codecrew.moya.web.converter;
...@@ -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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.converter; package fi.codecrew.moya.web.converter;
...@@ -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;
} }
} }
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.converter; package fi.codecrew.moya.web.converter;
...@@ -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();
} }
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
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> {
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.converter; package fi.codecrew.moya.web.converter;
...@@ -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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.converter; package fi.codecrew.moya.web.converter;
...@@ -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;
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.flow; package fi.codecrew.moya.web.flow;
...@@ -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
...@@ -52,7 +51,7 @@ public class IncomingView extends GenericCDIView { ...@@ -52,7 +51,7 @@ public class IncomingView extends GenericCDIView {
private static final Logger logger = LoggerFactory.getLogger(IncomingView.class); private static final Logger logger = LoggerFactory.getLogger(IncomingView.class);
/* /*
* @Inject * @Inject
* *
* @SelectedUser private transient EventUser user; * @SelectedUser private transient EventUser user;
*/ */
@Inject @Inject
...@@ -248,7 +247,7 @@ public class IncomingView extends GenericCDIView { ...@@ -248,7 +247,7 @@ public class IncomingView extends GenericCDIView {
/** /**
* Try to get card filing info from the metadata. Empty string if not found. * Try to get card filing info from the metadata. Empty string if not found.
* *
* @return Card filing info String or empty string. * @return Card filing info String or empty string.
*/ */
public String getCardFiling() { public String getCardFiling() {
...@@ -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;
/** /**
......
/* /*
* Copyright Codecrew Ry * Copyright Codecrew Ry
* *
* All rights reserved. * All rights reserved.
* *
* This license applies to any software containing a notice placed by the * This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software. * copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software. * This license covers modification, distribution and use of the Software.
* *
* Any distribution and use in source and binary forms, with or without * Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the * modification is not permitted without explicit written permission from the
* copyright owner. * copyright owner.
* *
* A non-exclusive royalty-free right is granted to the copyright owner of the * A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in * Software to use, modify and distribute all modifications to the Software in
* future versions of the Software. * future versions of the Software.
* *
*/ */
package fi.codecrew.moya.web.helper; package fi.codecrew.moya.web.helper;
...@@ -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;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!