Commit 2b19d7ba by Tuomas Riihimäki

User preference fixes

1 parent db4acc8b
...@@ -13,4 +13,7 @@ public interface UserPropertyBeanLocal { ...@@ -13,4 +13,7 @@ public interface UserPropertyBeanLocal {
List<EventUserproperty> getPropertiesForUser(EventUser user); List<EventUserproperty> getPropertiesForUser(EventUser user);
List<UsersEventUserproperty> getUserPropertiesForUser(EventUser user); List<UsersEventUserproperty> getUserPropertiesForUser(EventUser user);
UsersEventUserproperty saveUserproperty(UsersEventUserproperty object);
} }
...@@ -29,12 +29,7 @@ import java.math.BigDecimal; ...@@ -29,12 +29,7 @@ import java.math.BigDecimal;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.security.DeclareRoles; import javax.annotation.security.DeclareRoles;
import javax.annotation.security.PermitAll; import javax.annotation.security.PermitAll;
...@@ -233,7 +228,9 @@ public class UserBean implements UserBeanLocal { ...@@ -233,7 +228,9 @@ public class UserBean implements UserBeanLocal {
throw new EJBAccessException("Not enough rights to find roles"); throw new EJBAccessException("Not enough rights to find roles");
} }
return new ArrayList<Role>(localFindUsersRoles(u)); ArrayList<Role> ret = new ArrayList<>(localFindUsersRoles(u));
ret.sort((o1, o2) -> o1.getId().compareTo(o2.getId()));
return ret;
} }
......
...@@ -45,14 +45,29 @@ public class UserPropertyBean implements UserPropertyBeanLocal { ...@@ -45,14 +45,29 @@ public class UserPropertyBean implements UserPropertyBeanLocal {
} }
@Override @Override
public List<EventUserproperty> getPropertiesForUser(EventUser user){ public List<EventUserproperty> getPropertiesForUser(EventUser user) {
return eventPropertyFacade.findForUser(user); return eventPropertyFacade.findForUser(user);
} }
@Override @Override
public List<UsersEventUserproperty> getUserPropertiesForUser(EventUser user){ public List<UsersEventUserproperty> getUserPropertiesForUser(EventUser user) {
return userPropertyFacade.findForUser(user); return userPropertyFacade.findForUser(user);
} }
@Override
public UsersEventUserproperty saveUserproperty(UsersEventUserproperty prop) {
if (prop == null) {
return null;
}
if (prop.getId() == null) {
userPropertyFacade.create(prop);
} else {
prop = userPropertyFacade.merge(prop);
}
return prop;
}
} }
...@@ -199,7 +199,7 @@ public class EventUserFacade extends IntegerPkGenericFacade<EventUser> { ...@@ -199,7 +199,7 @@ public class EventUserFacade extends IntegerPkGenericFacade<EventUser> {
listQ.setFirstResult(query.getPage() * query.getPagesize()); listQ.setFirstResult(query.getPage() * query.getPagesize());
listQ.setMaxResults(query.getPagesize()); listQ.setMaxResults(query.getPagesize());
} }
return new SearchResult<EventUser>(listQ.getResultList(), countQ.getSingleResult()); return new SearchResult<>(listQ.getResultList(), countQ.getSingleResult());
} }
......
...@@ -28,7 +28,9 @@ import javax.persistence.criteria.CriteriaBuilder; ...@@ -28,7 +28,9 @@ import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Path; import javax.persistence.criteria.Path;
import javax.persistence.criteria.Root; import javax.persistence.criteria.Root;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set;
@Stateless @Stateless
@LocalBean @LocalBean
...@@ -45,11 +47,14 @@ public class EventUserpropertyFacade extends IntegerPkGenericFacade<EventUserpro ...@@ -45,11 +47,14 @@ public class EventUserpropertyFacade extends IntegerPkGenericFacade<EventUserpro
CriteriaBuilder cq = getEm().getCriteriaBuilder(); CriteriaBuilder cq = getEm().getCriteriaBuilder();
CriteriaQuery<EventUserproperty> cb = cq.createQuery(EventUserproperty.class); CriteriaQuery<EventUserproperty> cb = cq.createQuery(EventUserproperty.class);
Root<EventUserproperty> root = cb.from(EventUserproperty.class); Root<EventUserproperty> root = cb.from(EventUserproperty.class);
Set<Role> roles = userbean.localFindUsersRoles(user);
if(roles == null || roles.isEmpty()){
return Collections.emptyList();
}
Path<Role> rolePath = root.get(EventUserproperty_.forRole); Path<Role> rolePath = root.get(EventUserproperty_.forRole);
cb.where( cb.where(
cq.equal(root.get(EventUserproperty_.event), user.getEvent()), cq.equal(root.get(EventUserproperty_.event), user.getEvent()),
cq.or(cq.isNull(rolePath), rolePath.in(userbean.localFindUsersRoles(user))) cq.or(cq.isNull(rolePath), rolePath.in(roles))
); );
return getEm().createQuery(cb).getResultList(); return getEm().createQuery(cb).getResultList();
......
...@@ -157,18 +157,16 @@ ...@@ -157,18 +157,16 @@
</p:fieldset> </p:fieldset>
</h:form> </h:form>
<p:fieldset legend="#{i18n['user.meta.box.title']}" toggleable="true" collapsed="true" rendered="#{not empty userView.meta}"> <p:fieldset legend="#{i18n['user.meta.box.title']}" toggleable="true" collapsed="true" rendered="#{userView.metaAvailable}">
<div id="usermetaview"><pre><h:outputText value="#{userView.prettyMeta}" /></pre></div> <div id="usermetaview"><pre><h:outputText value="#{userView.prettyMeta}" /></pre></div>
</p:fieldset> </p:fieldset>
</p:panelGrid> </p:panelGrid>
<p:fieldset toggleable="true" collapsed="true" legend="#{i18n['user.eventproperties']}"> <p:fieldset toggleable="true" collapsed="true" legend="#{i18n['user.eventproperties']}" rendered="${!empty userEventPropertyView.properties}" style="max-width: 800px;">
<h:form id="eventpropertyview"> <h:form id="eventpropertyview">
<p:growl id="msgs" showDetail="true"/> <p:growl id="msgs" showDetail="true"/>
<p:dataTable id="userpropertytable" value="#{userEventPropertyView.properties}" var="property" editable="true"> <p:dataTable id="userpropertytable" widgetVar="userpropertytable" value="#{userEventPropertyView.properties}" var="property" editable="true" rowIndexVar="rowIndex">
<p:ajax event="rowEdit" listener="#{userEventPropertyView.onRowEdit}" update="@form:msgs"/> <p:ajax event="rowEdit" listener="#{userEventPropertyView.onRowEdit}" update="@form:msgs"/>
<p:ajax event="rowEditCancel" listener="#{userEventPropertyView.onRowCancel}" update="@form:msgs"/> <p:ajax event="rowEditCancel" listener="#{userEventPropertyView.onRowCancel}" update="@form:msgs"/>
...@@ -180,11 +178,14 @@ ...@@ -180,11 +178,14 @@
</p:ajax--> </p:ajax-->
<p:cellEditor> <p:cellEditor>
<f:facet name="output"><h:outputText value="#{property.textvalue}"/></f:facet> <f:facet name="output"><h:outputText value="#{property.textvalue}"/></f:facet>
<f:facet name="input"><p:inputText value="#{property.textvalue}" style="width:96%"/></f:facet> <f:facet name="input"><p:inputText onkeydown="PF('userpropertytable').onKeyDown(event)"
onkeyup="PF('userpropertytable').onKeyUp(event, #{rowIndex})"
value="#{property.textvalue}"
style="width:96%"/></f:facet>
</p:cellEditor> </p:cellEditor>
</p:column> </p:column>
<p:column style="width:32px"> <p:column style="width:32px">
<p:rowEditor/> <p:rowEditor />
</p:column> </p:column>
</p:dataTable> </p:dataTable>
</h:form> </h:form>
...@@ -216,6 +217,40 @@ ...@@ -216,6 +217,40 @@
</h:form> </h:form>
<script type="text/javascript">
$(function() {
$.extend(PF("userpropertytable"), {
onKeyDown : function(e) {
var key = e.which,
keyCode = $.ui.keyCode;
if((key === keyCode.ENTER||key === keyCode.NUMPAD_ENTER)) {
e.preventDefault();
}
},
onKeyUp : function(e, rowIndex) {
var key = e.which,
keyCode = $.ui.keyCode;
if((key === keyCode.ENTER||key === keyCode.NUMPAD_ENTER)) {
this.tbody
.find('.ui-row-editor .ui-icon-check')
.eq(rowIndex)
.click();
}
if (key === keyCode.ESCAPE) {
this.tbody
.find('.ui-row-editor .ui-icon-close')
.eq(rowIndex)
.click();
}
}
});
});
</script>
</composite:implementation> </composite:implementation>
</html> </html>
...@@ -180,7 +180,7 @@ public class HostnameFilter implements Filter { ...@@ -180,7 +180,7 @@ public class HostnameFilter implements Filter {
if (httpRequest.getUserPrincipal() == null) { if (httpRequest.getUserPrincipal() == null) {
// Check if we are can login in with rest alternative methods ( appkey, basic auth, etc.. ) // Check if we are can login in with rest alternative methods ( appkey, basic auth, etc.. )
if (RestApplicationEntrypoint.REST_PATH.equals(httpRequest.getServletPath()) if (RestApplicationEntrypoint.REST_PATH.equals(httpRequest.getServletPath())
|| "/dydata".equals(httpRequest.getServletPath())) { || "/dydata".equals(httpRequest.getServletPath()) || "/graphql".equals(httpRequest.getServletPath())) {
authtype = AuthType.REST; authtype = AuthType.REST;
......
...@@ -10,16 +10,13 @@ import java.math.BigInteger; ...@@ -10,16 +10,13 @@ import java.math.BigInteger;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import static graphql.Scalars.*; import static graphql.Scalars.*;
import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition; import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
import static graphql.schema.GraphQLObjectType.newObject; import static graphql.schema.GraphQLObjectType.newObject;
public class EntityGQLBuilder<T> { public class EntityGQLBuilder<T> implements GQLEntityContainer {
private final GraphQLObjectType.Builder builder; private final GraphQLObjectType.Builder builder;
...@@ -35,6 +32,12 @@ public class EntityGQLBuilder<T> { ...@@ -35,6 +32,12 @@ public class EntityGQLBuilder<T> {
} }
public GraphQLFieldDefinition.Builder addField(GraphQLOutputType type) {
return addField()
.type(type)
.name(type.getName().toLowerCase());
}
public GraphQLFieldDefinition.Builder addField() { public GraphQLFieldDefinition.Builder addField() {
if (builtObject != null) { if (builtObject != null) {
throw new AlreadyBuiltException("This method can not be called after 'build()'-function has been called"); throw new AlreadyBuiltException("This method can not be called after 'build()'-function has been called");
...@@ -79,9 +82,11 @@ public class EntityGQLBuilder<T> { ...@@ -79,9 +82,11 @@ public class EntityGQLBuilder<T> {
} }
private GraphQLOutputType typeForClass(Class<?> type) { private GraphQLOutputType typeForClass(Class<?> type) {
if (Map.Entry.class.isAssignableFrom(type)) {
return parent.getMapEntryType();
}
if (Boolean.class.isAssignableFrom(type) || boolean.class.isAssignableFrom(type)) { if (Boolean.class.isAssignableFrom(type) || boolean.class.isAssignableFrom(type)) {
return GraphQLBoolean; return GraphQLBoolean;
} }
...@@ -129,7 +134,7 @@ public class EntityGQLBuilder<T> { ...@@ -129,7 +134,7 @@ public class EntityGQLBuilder<T> {
} }
@Override
public GraphQLObjectType build() { public GraphQLObjectType build() {
if (builtObject == null) { if (builtObject == null) {
fields.forEach(f -> builder.field(f)); fields.forEach(f -> builder.field(f));
...@@ -148,7 +153,9 @@ public class EntityGQLBuilder<T> { ...@@ -148,7 +153,9 @@ public class EntityGQLBuilder<T> {
return this; return this;
} }
public GraphQLType getRef() { public GraphQLTypeReference getRef() {
return parent.typeFor(typeName); return parent.typeFor(typeName);
} }
} }
package fi.codecrew.moya.graphql;
import graphql.schema.GraphQLObjectType;
public interface GQLEntityContainer {
GraphQLObjectType build();
}
...@@ -7,10 +7,13 @@ import org.slf4j.LoggerFactory; ...@@ -7,10 +7,13 @@ import org.slf4j.LoggerFactory;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static graphql.Scalars.GraphQLString;
import static graphql.schema.GraphQLEnumType.newEnum; import static graphql.schema.GraphQLEnumType.newEnum;
import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
import static graphql.schema.GraphQLObjectType.newObject;
public class GraphQLBuilder { public class GraphQLBuilder {
private final Map<String, EntityGQLBuilder<?>> entities = new HashMap<>(); private final Map<String, GQLEntityContainer> entities = new HashMap<>();
private final Map<String, GraphQLEnumType> enums = new HashMap<>(); private final Map<String, GraphQLEnumType> enums = new HashMap<>();
private final Set<String> uncheckedTypes = new HashSet<>(); private final Set<String> uncheckedTypes = new HashSet<>();
private static final Logger logger = LoggerFactory.getLogger(GraphQLBuilder.class); private static final Logger logger = LoggerFactory.getLogger(GraphQLBuilder.class);
...@@ -25,6 +28,24 @@ public class GraphQLBuilder { ...@@ -25,6 +28,24 @@ public class GraphQLBuilder {
return ret; return ret;
} }
public GraphQLList getMapEntryType() {
if (!entities.containsKey("MapEntry")) {
entities.put("MapEntry", new GQLEntityContainer() {
@Override
public GraphQLObjectType build() {
return type.build();
}
final GraphQLObjectType.Builder type = newObject()
.name("MapEntry")
.field(newFieldDefinition().name("key").type(GraphQLString))
.field(newFieldDefinition().name("value").type(GraphQLString));
}
);
}
return GraphQLList.list(typeFor("MapEntry"));
}
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());
...@@ -38,7 +59,7 @@ public class GraphQLBuilder { ...@@ -38,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);
} }
......
...@@ -47,7 +47,6 @@ import fi.codecrew.moya.model.LanEventProperty; ...@@ -47,7 +47,6 @@ import fi.codecrew.moya.model.LanEventProperty;
import fi.codecrew.moya.model.LanEventPropertyKey; import fi.codecrew.moya.model.LanEventPropertyKey;
/** /**
*
* @author tuukka * @author tuukka
*/ */
@Named() @Named()
...@@ -85,7 +84,7 @@ public class SessionHandler { ...@@ -85,7 +84,7 @@ public class SessionHandler {
retStr = ret.toLanguageTag(); retStr = ret.toLanguageTag();
} }
if(retStr.trim().equals("")) if (retStr.trim().equals(""))
retStr = "fi_FI"; retStr = "fi_FI";
return retStr; return retStr;
...@@ -93,7 +92,7 @@ public class SessionHandler { ...@@ -93,7 +92,7 @@ public class SessionHandler {
public String getTheme() { public String getTheme() {
if(theme == null) { if (theme == null) {
theme = eventbean.getCurrentEvent().getTheme(); theme = eventbean.getCurrentEvent().getTheme();
} }
if (theme == null || theme.trim().isEmpty()) { if (theme == null || theme.trim().isEmpty()) {
...@@ -104,7 +103,7 @@ public class SessionHandler { ...@@ -104,7 +103,7 @@ public class SessionHandler {
} }
public void setTheme(String theme) { public void setTheme(String theme) {
logger.debug("Setting theme to: "+theme); logger.debug("Setting theme to: " + theme);
} }
public String getFullscreen() { public String getFullscreen() {
...@@ -122,12 +121,11 @@ public class SessionHandler { ...@@ -122,12 +121,11 @@ public class SessionHandler {
return template; return template;
} }
public String getTemplateName() public String getTemplateName() {
{
if (template == null) { if (template == null) {
template = eventbean.getPropertyString(LanEventPropertyKey.EVENT_LAYOUT); template = eventbean.getPropertyString(LanEventPropertyKey.EVENT_LAYOUT);
} }
if(template != null){ if (template != null) {
template = template.trim().toLowerCase(); template = template.trim().toLowerCase();
} }
...@@ -137,8 +135,7 @@ public class SessionHandler { ...@@ -137,8 +135,7 @@ public class SessionHandler {
return template; return template;
} }
public String getTemplatePath() public String getTemplatePath() {
{
return "/resources/templates/" + getTemplateName(); return "/resources/templates/" + getTemplateName();
...@@ -150,8 +147,7 @@ public class SessionHandler { ...@@ -150,8 +147,7 @@ public class SessionHandler {
private EnumMap<LanEventPropertyKey, Boolean> boolPropertyCache = new EnumMap<>(LanEventPropertyKey.class); private EnumMap<LanEventPropertyKey, Boolean> boolPropertyCache = new EnumMap<>(LanEventPropertyKey.class);
public boolean isEventBoolProperty(String property) public boolean isEventBoolProperty(String property) {
{
LanEventPropertyKey prop = LanEventPropertyKey.valueOf(property); LanEventPropertyKey prop = LanEventPropertyKey.valueOf(property);
if (!prop.isBoolean()) { if (!prop.isBoolean()) {
throw new RuntimeException("Trying to fetch boolean value for non-boolean property!"); throw new RuntimeException("Trying to fetch boolean value for non-boolean property!");
...@@ -206,18 +202,15 @@ public class SessionHandler { ...@@ -206,18 +202,15 @@ public class SessionHandler {
// return permbean.hasPermission(perm); // return permbean.hasPermission(perm);
// } // }
public String getDateFormat() public String getDateFormat() {
{
return "dd.MM.yyyy"; return "dd.MM.yyyy";
} }
public String getDatetimeFormat() public String getDatetimeFormat() {
{
return "dd.MM.yyyy HH:mm"; return "dd.MM.yyyy HH:mm";
} }
public String getShortDatetimeFormat() public String getShortDatetimeFormat() {
{
return "dd.MM HH:MM:ss"; return "dd.MM HH:MM:ss";
} }
...@@ -247,7 +240,8 @@ public class SessionHandler { ...@@ -247,7 +240,8 @@ public class SessionHandler {
} }
public String flushCache() { public String flushCache() {
return eventbean.flushCache(); eventbean.flushCache();
return "";
} }
...@@ -257,13 +251,10 @@ public class SessionHandler { ...@@ -257,13 +251,10 @@ public class SessionHandler {
private String preurlString; private String preurlString;
public String getRequestPreUrl() public String getRequestPreUrl() {
{ if (preurlString == null) {
if (preurlString == null)
{
Object ext = FacesContext.getCurrentInstance().getExternalContext().getRequest(); Object ext = FacesContext.getCurrentInstance().getExternalContext().getRequest();
if (ext instanceof HttpServletRequest) if (ext instanceof HttpServletRequest) {
{
StringBuffer url = ((HttpServletRequest) ext).getRequestURL(); StringBuffer url = ((HttpServletRequest) ext).getRequestURL();
preurlString = url.substring(0, url.indexOf("/", 8)); preurlString = url.substring(0, url.indexOf("/", 8));
......
...@@ -98,7 +98,7 @@ public class UserAllergyView extends GenericCDIView { ...@@ -98,7 +98,7 @@ public class UserAllergyView extends GenericCDIView {
this.freetext = freetext; this.freetext = freetext;
} }
public void saveAllergies() { public void saveAllergies() {
if(freetext != null && !freetext.isEmpty()) { if(freetext != null) {
EventUser usr = userview.getSelectedUser(); EventUser usr = userview.getSelectedUser();
usr.getUser().setMetaStringValue(ALLERGIES_METAKEY, freetext); usr.getUser().setMetaStringValue(ALLERGIES_METAKEY, freetext);
userview.saveUser(); userview.saveUser();
......
...@@ -52,12 +52,13 @@ public class UserEventPropertyView extends GenericCDIView { ...@@ -52,12 +52,13 @@ public class UserEventPropertyView extends GenericCDIView {
private List<UsersEventUserproperty> properties; private List<UsersEventUserproperty> properties;
private UsersEventUserproperty selectedProperty; private UsersEventUserproperty selectedProperty;
public void saveProperty(){ public void saveProperty() {
logger.warn("Selected property {}, value: {}",selectedProperty, selectedProperty != null ? selectedProperty.getTextvalue():"NULL"); logger.warn("Selected property {}, value: {}", selectedProperty, selectedProperty != null ? selectedProperty.getTextvalue() : "NULL");
} }
public List<UsersEventUserproperty> getProperties() { public List<UsersEventUserproperty> getProperties() {
if (properties == null) { if (properties == null) {
super.beginConversation();
EventUser selectedUser = userview.getSelectedUser(); EventUser selectedUser = userview.getSelectedUser();
List<UsersEventUserproperty> userprops = propBean.getUserPropertiesForUser(userview.getSelectedUser()); List<UsersEventUserproperty> userprops = propBean.getUserPropertiesForUser(userview.getSelectedUser());
...@@ -75,13 +76,18 @@ public class UserEventPropertyView extends GenericCDIView { ...@@ -75,13 +76,18 @@ public class UserEventPropertyView extends GenericCDIView {
} }
public void onRowEdit(RowEditEvent event) { public void onRowEdit(RowEditEvent event) {
logger.warn("onRowEdit, {} {}", event, event.getObject());
FacesMessage msg = new FacesMessage("Car Edited"); final UsersEventUserproperty oldObj = (UsersEventUserproperty) event.getObject();
int objPoint = properties.indexOf(oldObj);
UsersEventUserproperty newObj = propBean.saveUserproperty(oldObj);
properties.set(objPoint, newObj);
FacesMessage msg = new FacesMessage("Property saved");
FacesContext.getCurrentInstance().addMessage(null, msg); FacesContext.getCurrentInstance().addMessage(null, msg);
} }
public void onRowCancel(RowEditEvent event) { public void onRowCancel(RowEditEvent event) {
logger.warn("Cancel Event {}, {}", event, event.getObject());
FacesMessage msg = new FacesMessage("Edit Cancelled"); FacesMessage msg = new FacesMessage("Edit Cancelled");
FacesContext.getCurrentInstance().addMessage(null, msg); FacesContext.getCurrentInstance().addMessage(null, msg);
} }
......
...@@ -189,7 +189,7 @@ public class UserView extends GenericCDIView { ...@@ -189,7 +189,7 @@ public class UserView extends GenericCDIView {
FacesContext.getCurrentInstance().addMessage(null, msg); FacesContext.getCurrentInstance().addMessage(null, msg);
UploadedFile f = event.getFile(); UploadedFile f = event.getFile();
if (f != null) if (f != null)
logger.info("Received file {}, {}, {}", new Object[] { f.getContentType(), f.getFileName(), f.getSize() }); logger.info("Received file {}, {}, {}", new Object[]{f.getContentType(), f.getFileName(), f.getSize()});
} }
...@@ -635,6 +635,11 @@ public class UserView extends GenericCDIView { ...@@ -635,6 +635,11 @@ public class UserView extends GenericCDIView {
return shirtEnabled; return shirtEnabled;
} }
public boolean isMetaAvailable(){
JsonObject meta = getSelectedUser().getUser().getMeta();
return meta != null && !meta.isEmpty();
}
/** /**
* Get metadata from the User (not EventUser). The data is shown in ui. * Get metadata from the User (not EventUser). The data is shown in ui.
* *
...@@ -646,19 +651,17 @@ public class UserView extends GenericCDIView { ...@@ -646,19 +651,17 @@ public class UserView extends GenericCDIView {
User user = eventUser.getUser(); User user = eventUser.getUser();
if (user != null) { if (user != null) {
JsonObject meta = user.getMeta(); JsonObject meta = user.getMeta();
if (meta != null) { if (meta != null && !meta.isEmpty()) {
if (meta.keySet().size() > 0) {
return meta.toString(); return meta.toString();
} }
} }
} }
}
return ""; return "";
} }
public String getPrettyMeta(){ public String getPrettyMeta() {
JsonObject meta = getSelectedUser().getUser().getMeta(); JsonObject meta = getSelectedUser().getUser().getMeta();
if(meta == null){ if (meta == null) {
return ""; return "";
} }
......
...@@ -597,7 +597,7 @@ incomingflow.giveplace = Mark given ...@@ -597,7 +597,7 @@ incomingflow.giveplace = Mark given
incomingflow.groupmemberships = Computer places and tickets incomingflow.groupmemberships = Computer places and tickets
incomingflow.invalidbarcode.message = Nothing found with the barcode, you can now add it to the user incomingflow.invalidbarcode.message = Nothing found with the barcode, you can now add it to the user
incomingflow.invalidbarcode.title = Invalid code incomingflow.invalidbarcode.title = Invalid code
incomingflow.markEverythingGiven=Give all ungiven tickets incomingflow.markEverythingGiven =Give all ungiven tickets
incomingflow.multisearch = Multisearch incomingflow.multisearch = Multisearch
incomingflow.placesummary = Place summary incomingflow.placesummary = Place summary
incomingflow.printedCard = Card incomingflow.printedCard = Card
...@@ -608,6 +608,7 @@ incomingflow.usereditor = User ...@@ -608,6 +608,7 @@ incomingflow.usereditor = User
incomingflow.usereditor.info = User incomingflow.usereditor.info = User
incomingflow.usereditor.picture = New picture incomingflow.usereditor.picture = New picture
index.title = Frontpage
infoview.back = Back infoview.back = Back
infoview.computerplace = Computer places infoview.computerplace = Computer places
infoview.multisearch = User search infoview.multisearch = User search
...@@ -1873,43 +1874,45 @@ voting.create.voteEnd = Voting close ...@@ -1873,43 +1874,45 @@ voting.create.voteEnd = Voting close
voting.create.voteStart = Voting start voting.create.voteStart = Voting start
yes = Yes yes = Yes
page.product.shopClosed.header=Shop is closed! page.product.shopClosed.header =Shop is closed!
page.product.shopClosed.notOpenYet=Shop is not opened. Try again later. page.product.shopClosed.notOpenYet =Shop is not opened. Try again later.
page.product.shopClosed.alreadyClosed=Shop is closed, welcome back in next event! page.product.shopClosed.alreadyClosed =Shop is closed, welcome back in next event!
queuemgmt.inDatabase=Value in database queuemgmt.inDatabase =Value in database
queuemgmt.biggestFirst=Biggest group first queuemgmt.biggestFirst =Biggest group first
queuemgmt.biggestIsFirst=Bigger group automaticly rises up in queue. queuemgmt.biggestIsFirst =Bigger group automaticly rises up in queue.
reservequeue.reservingTimeIsUpAlert=Timeslot for your place reservation has timeouted. Pleace go back to queue to continue. reservequeue.reservingTimeIsUpAlert =Timeslot for your place reservation has timeouted. Pleace go back to queue to continue.
mapView.reserveTimeLeft=Time to reserve places mapView.reserveTimeLeft =Time to reserve places
queuemgmt.queueEnabled=Queue is ENABLED queuemgmt.queueEnabled =Queue is ENABLED
queuemgmt.queueDisabled=Queue is DISABLED (enable from Edit event -page) queuemgmt.queueDisabled =Queue is DISABLED (enable from Edit event -page)
product.dependency.add=Add product dependency product.dependency.add =Add product dependency
product.dependency.create=Create product.dependency.create =Create
product.dependency.supporter=Depended product product.dependency.supporter =Depended product
product.dependency.type=Dependency type product.dependency.type =Dependency type
product.dependency.priority=Priority product.dependency.priority =Priority
product.dependency.delete=Delete product.dependency.delete =Delete
product.dependency.multiplier=Multiplier product.dependency.multiplier =Multiplier
product.dependency.MAX_SUPPORTED_COUNT=Only up to same number of products can be bought product.dependency.MAX_SUPPORTED_COUNT =Only up to same number of products can be bought
placemove.alreadyTaken=Moving the places was cancelled because place {0} was already taken. placemove.alreadyTaken =Moving the places was cancelled because place {0} was already taken.
placegroupview.moveUsersPlaces=Move users places placegroupview.moveUsersPlaces =Move users places
submenu.neomap.moveplaces=Change places submenu.neomap.moveplaces =Change places
mapEdit.removeSelectedPlaces=Delete places mapEdit.removeSelectedPlaces =Delete places
bortalApplication.map.MOVE_PLACES = Selfservice place moving bortalApplication.map.MOVE_PLACES = Selfservice place moving
bill.list.header = Orders bill.list.header = Orders
placemove.noMovablePlaces = No movable places placemove.noMovablePlaces = No movable places
deliver=Deliver deliver =Deliver
placegroupview.noProductsToDeliver=No deliverable products placegroupview.noProductsToDeliver =No deliverable products
placegroupview.productName=Product name placegroupview.productName =Product name
incomingflow.giveAccountEvent=Mark given incomingflow.giveAccountEvent =Mark given
incomingflow.ungiveAccountEvent=Mark not given incomingflow.ungiveAccountEvent =Mark not given
incomingflow.deliverableProducts=Products to deliver incomingflow.deliverableProducts =Products to deliver
placegroupview.accountEventDescription=Description placegroupview.accountEventDescription =Description
incomingflow.ungivenProducts=User has ungiven deliverable products incomingflow.ungivenProducts =User has ungiven deliverable products
placegroupview.count=Count placegroupview.count =Count
user.allergies=Allergies / diets user.allergies =Allergies / diets
allergies.save=Save allergies allergies.save =Save allergies
\ No newline at end of file user.eventproperties = Event specific properties
submenu.permissionDenied = Access denied
\ No newline at end of file
...@@ -1901,3 +1901,5 @@ placegroupview.count=Kpl ...@@ -1901,3 +1901,5 @@ placegroupview.count=Kpl
user.allergies=Allergiat / ruokavaliot user.allergies=Allergiat / ruokavaliot
allergies.save=Tallenna allergiat allergies.save=Tallenna allergiat
user.eventproperties = Tapahtumakohtaiset tiedot
submenu.permissionDenied = Pääsy kielletty
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!