Commit 3b050320 by Tuomas Riihimäki

Moar import. Some random fixes not to create user automatically

1 parent 1a4f03e3
......@@ -26,6 +26,8 @@ import fi.codecrew.moya.model.ApiApplicationInstance;
import fi.codecrew.moya.model.ApplicationPermission;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.LanEvent;
import fi.codecrew.moya.model.LanEventProperty;
import fi.codecrew.moya.model.LanEventPropertyKey;
import fi.codecrew.moya.model.Role;
import fi.codecrew.moya.model.User;
import fi.codecrew.moya.utilities.PasswordFunctions;
......@@ -60,6 +62,8 @@ public class JaasBean implements MoyaRealmBeanRemote {
private ApiApplicationFacade appfacade;
@EJB
private ApiApplicationInstanceFacade appInstanceFacade;
@EJB
private EventBean eventorgbean;
public EventUser tryLogin(String username, String password) {
......@@ -82,7 +86,13 @@ public class JaasBean implements MoyaRealmBeanRemote {
eventUser = null;
user = null;
}
if (user != null && eventUser == null)
LanEventProperty inviteonly = eventbean.getProperty(LanEventPropertyKey.INVITE_ONLY_EVENT);
boolean createEventuser = true;
if (inviteonly != null && inviteonly.isBooleanValue()) {
createEventuser = false;
}
if (createEventuser && user != null && eventUser == null)
{
LanEvent event = eventbean.getCurrentEvent();
eventUser = new EventUser(user, event, null);
......
......@@ -160,7 +160,6 @@ public class ReaderBean implements ReaderBeanLocal {
readerfacade.flush();
logger.info("Creating new accountevent from autoproduct {}", createAc);
event.setNotes("Created automatic account event from reader. " + createAc);
}
event = readerEventFacade.create(event);
......
......@@ -635,18 +635,19 @@ public class UserBean implements UserBeanLocal {
}
@Override
public EventUser getEventUser(User user) {
public EventUser getEventUser(User user, boolean create) {
if (user == null || user.getId() == null) {
return null;
}
user = userFacade.find(user.getId());
EventUser ret = eventUserFacade.find(user);
if (ret == null)
if (create && ret == null)
{
ret = new EventUser(user, eventBean.getCurrentEvent(), permbean.getCurrentUser());
eventUserFacade.create(ret);
eventUserFacade.flush();
ret.setCreator(permbean.getCurrentUser());
}
return ret;
}
......@@ -657,7 +658,7 @@ public class UserBean implements UserBeanLocal {
EventUser ret = null;
if (user != null)
{
ret = this.getEventUser(user);
ret = this.getEventUser(user, false);
}
return ret;
}
......@@ -667,9 +668,9 @@ public class UserBean implements UserBeanLocal {
{
User user = userFacade.findByLogin(username);
EventUser ret = null;
if (user.checkPassword(password))
if (user != null && user.checkPassword(password))
{
ret = this.getEventUser(user);
ret = this.getEventUser(user, false);
}
return ret;
......@@ -793,7 +794,7 @@ public class UserBean implements UserBeanLocal {
public User getUser(Integer id) {
User ret = userFacade.find(id);
if (!permbean.getCurrentUser().getUser().equals(ret) && permbean.hasPermission(UserPermission.VIEW_ALL)) {
if (!permbean.getCurrentUser().getUser().equals(ret) && !permbean.hasPermission(UserPermission.VIEW_ALL)) {
throw new EJBAccessException("Tried to fetch user with id " + id + " from database without sufficient permissions");
}
......
......@@ -72,12 +72,13 @@ public interface UserBeanLocal {
List<Role> findUsersRoles(EventUser u);
/**
* NOTICE! If the user parameter is a persisted object the returned EventUser has a reloaded user, eg changes to the User object are lost!
* NOTICE! If the user parameter is a persisted object the returned
* EventUser has a reloaded user, eg changes to the User object are lost!
*
* @param user
* @return
*/
EventUser getEventUser(User user);
EventUser getEventUser(User user, boolean create);
EventUser validateUser(String username, String password);
......
package fi.codecrew.moya.model;
public enum LanEventPropertyKey {
EVENT_LOGO(Type.DATA, null),
INVITEMAIL_SUBJECT(Type.TEXT, "Invitation to Moya Online Youth Accumulator"),
INVITEMAIL_CONTENT(Type.TEXT, "You have been invited to an event by {1}.\n\nYou can register to intranet at: {0}."),
BILL_PAID_MAIL_SUBJECT(Type.TEXT, "[{0}] Lasku merkitty maksetuksi"),
BILL_PAID_MAIL_CONTENT(Type.TEXT, "Laskusi numero {0} on merkitty maksetuksi. Voit nyt siirtyä lippukauppaan varamaan haluamasi paikat. Tervetuloa tapahtumaan!"),
PORTAL_EMAIL_ADDRESS(Type.TEXT, "moya@codecrew.fi"),
PORTAL_EMAIL_NAME(Type.TEXT, "Moya Online Youth Accumulator"),
EVENT_LOGO(Type.DATA, null),
INVITEMAIL_SUBJECT(Type.TEXT, "Invitation to Moya Online Youth Accumulator"),
INVITEMAIL_CONTENT(Type.TEXT, "You have been invited to an event by {1}.\n\nYou can register to intranet at: {0}."),
BILL_PAID_MAIL_SUBJECT(Type.TEXT, "[{0}] Lasku merkitty maksetuksi"),
BILL_PAID_MAIL_CONTENT(Type.TEXT, "Laskusi numero {0} on merkitty maksetuksi. Voit nyt siirtyä lippukauppaan varamaan haluamasi paikat. Tervetuloa tapahtumaan!"),
PORTAL_EMAIL_ADDRESS(Type.TEXT, "moya@codecrew.fi"),
PORTAL_EMAIL_NAME(Type.TEXT, "Moya Online Youth Accumulator"),
ADMIN_MAIL(Type.TEXT, "moya@codecrew.fi"),
EVENT_LAYOUT(Type.TEXT, "template1"),
SHOP_DEFAULT_CASH(Type.BOOL, null),
PLACECODE_FROM_USER(Type.BOOL, "1"),
PLACECODE_PRINT_ONLY_OWN(Type.BOOL, null),
CHECK_BILL_STATS_PERMISSION(Type.BOOL, null),
GATHER_OTHER_BILL_INFO(Type.BOOL, null),
ALLOW_BILLING(Type.BOOL, null),
BILL_EXPIRE_HOURS(Type.LONG, "168"),
TEMPLATE_PROPERTY1(Type.TEXT, null),
TEMPLATE_PROPERTY2(Type.TEXT, null),
TEMPLATE_PROPERTY3(Type.TEXT, null),
TEMPLATE_PROPERTY4(Type.TEXT, null),
TEMPLATE_PROPERTY5(Type.TEXT, null),
ADMIN_MAIL(Type.TEXT, "moya@codecrew.fi"),
EVENT_LAYOUT(Type.TEXT, "template1"),
SHOP_DEFAULT_CASH(Type.BOOL, null),
PLACECODE_FROM_USER(Type.BOOL, "1"),
PLACECODE_PRINT_ONLY_OWN(Type.BOOL, null),
CHECK_BILL_STATS_PERMISSION(Type.BOOL, null),
GATHER_OTHER_BILL_INFO(Type.BOOL, null),
ALLOW_BILLING(Type.BOOL, null),
BILL_EXPIRE_HOURS(Type.LONG, "168"),
TEMPLATE_PROPERTY1(Type.TEXT, null),
TEMPLATE_PROPERTY2(Type.TEXT, null),
TEMPLATE_PROPERTY3(Type.TEXT, null),
TEMPLATE_PROPERTY4(Type.TEXT, null),
TEMPLATE_PROPERTY5(Type.TEXT, null),
INVITE_ONLY_EVENT(Type.BOOL, null),
;
;
private enum Type {
TEXT, DATE, DATA, BOOL, LONG
};
private enum Type {
TEXT, DATE, DATA, BOOL, LONG
};
private final String defaultvalue;
private final Type type;
private final String defaultvalue;
private final Type type;
public boolean isText() {
return Type.TEXT.equals(type);
}
public boolean isText() {
return Type.TEXT.equals(type);
}
public boolean isDate() {
return Type.DATE.equals(type);
}
public boolean isDate() {
return Type.DATE.equals(type);
}
public boolean isData() {
return Type.DATA.equals(type);
}
public boolean isData() {
return Type.DATA.equals(type);
}
public boolean isBoolean() {
return Type.BOOL.equals(type);
}
public boolean isLong() {
return Type.LONG.equals(type);
}
public boolean isBoolean() {
return Type.BOOL.equals(type);
}
private LanEventPropertyKey(Type t, String def)
{
this.type = t;
defaultvalue = def;
}
public boolean isLong() {
return Type.LONG.equals(type);
}
public String getDefaultvalue() {
return defaultvalue;
}
private LanEventPropertyKey(Type t, String def)
{
this.type = t;
defaultvalue = def;
}
public Type getType() {
return type;
}
public String getDefaultvalue() {
return defaultvalue;
}
public Type getType() {
return type;
}
}
......@@ -9,7 +9,7 @@
<composite:implementation>
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
<p:dataTable id="user" value="#{userSearchView.results}" var="user" >
<p:dataTable id="user" value="#{userSearchView.results}" var="wra" >
<p:column>
<f:facet name="header">
<h:link value="#{i18n['user.nick']}" includeViewParams="true">
......@@ -17,7 +17,7 @@
<f:param name="page" value="0" />
</h:link>
</f:facet>
<h:outputText styleClass="hoverable" value="#{(empty user.nick)?'----':user.nick}" />
<h:outputText styleClass="hoverable" value="#{(empty wra.user.nick)?'----':wra.user.nick}" />
</p:column>
<p:column>
<f:facet name="header">
......@@ -26,7 +26,7 @@
<f:param name="page" value="0" />
</h:link>
</f:facet>
<h:outputText value="#{user.firstnames}" />
<h:outputText value="#{wra.user.firstnames}" />
</p:column>
<p:column>
<f:facet name="header">
......@@ -35,29 +35,33 @@
</h:link>
</f:facet>
<h:outputText value="#{user.lastname}" />
<h:outputText value="#{wra.user.lastname}" />
</p:column>
<p:column>
<h:link outcome="/useradmin/edit" value="#{i18n['user.edit']}">
<f:param name="userid" value="#{user.id}" />
<h:link rendered="#{!empty wra.eventuser}" outcome="/useradmin/edit" value="#{i18n['user.edit']}">
<f:param name="userid" value="#{wra.user.id}" />
</h:link>
<h:link rendered="#{empty wra.eventuser}" outcome="/useradmin/edit" value="#{i18n['user.addToEvent']}" onclick="return confirm('#{i18n['user.confirmUserToEventAdding']}')">
<f:param name="userid" value="#{wra.user.id}" />
</h:link>
<!-- <p:commandButton onClick="location.replace('#{request.contextPath}/useradmin/edit.jsf?userid=#{user.id}')">#{i18n['user.edit']}</p:commandButton>
<!-- <p:commandButton onClick="location.replace('#{request.contextPath}/useradmin/edit.jsf?userid=#{wra.user.id}')">#{i18n['user.edit']}</p:commandButton>
<p:overlayPanel for="userinfoBtn">
<h:panelGrid columns="2">
<img style="width:100px;" src="#{request.contextPath}/dydata/userimage/#{user.currentImage.id}.img" alt="image" />
<img style="width:100px;" src="#{request.contextPath}/dydata/userimage/#{wra.user.currentImage.id}.img" alt="image" />
<h:panelGroup>
<h:outputText value="#{user.nick}"/> <br />
<h:outputText value="#{user.firstnames} #{user.lastname}"/> <br />
<h:outputText value="#{wra.user.nick}"/> <br />
<h:outputText value="#{wra.user.firstnames} #{wra.user.lastname}"/> <br />
<hr />
<h:outputText value="#{user.address}"/> <br />
<h:outputText value="#{user.zip} #{user.postalTown}"/> <br />
<h:outputText value="#{wra.user.address}"/> <br />
<h:outputText value="#{wra.user.zip} #{wra.user.postalTown}"/> <br />
<br />
<h:outputText value="#{user.phone}"/> <br />
<h:outputText value="#{user.email}"/> <br />
<h:outputText value="#{wra.user.phone}"/> <br />
<h:outputText value="#{wra.user.email}"/> <br />
</h:panelGroup>
</h:panelGrid>
</p:overlayPanel>
......
......@@ -8,34 +8,37 @@
<ui:define name="content">
<h:form id="wrapform">
<h:dataTable id="tbl" border="1" value="#{importView.wrapper}" var="wra">
<h:column>
<h:selectBooleanCheckbox id="skip" value="#{wra.skip}" />
</h:column>
<h:column>
<h:outputText value="#{wra.user.login}" />
</h:column>
<h:column>
<h:outputText value="#{wra.user.firstnames}" />
</h:column>
<h:column>
<h:outputText value="#{wra.user.lastname}" />
</h:column>
<h:column>
<h:outputText value="#{wra.user.email}" />
</h:column>
<h:column>
<h:outputText value="#{wra.user.accountBalance}" />
</h:column>
<h:column>
<h:selectOneRadio id="selected" value="#{wra.selected}" layout="pageDirection" converter="#{userConverter}">
<f:selectItems var="pot" value="#{wra.potential}" itemLabel="#{pot.id}/#{pot.login}/#{pot.firstnames}/#{pot.lastname}" />
</h:selectOneRadio>
</h:column>
</h:dataTable>
<h:commandButton action="#{importView.commitImport}" value="#{i18n['userImport.commit']}" />
</h:form>
<h:dataTable id="tbl" border="1" value="#{importView.users}" var="wra">
<h:column>
<h:outputText value="#{wra.user.login}" />
</h:column>
<h:column>
<h:outputText value="#{wra.user.firstnames}" />
</h:column>
<h:column>
<h:outputText value="#{wra.user.lastname}" />
</h:column>
<h:column>
<h:outputText value="#{wra.user.email}" />
</h:column>
<h:column>
<h:outputText value="#{wra.user.email}" />
</h:column>
<h:column>
<h:outputText value="#{wra.user.email}" />
</h:column>
<h:column>
<h:outputText value="#{wra.eventuser.id}" />
</h:column>
</h:dataTable>
</ui:define>
</ui:composition>
</h:body>
......
......@@ -12,11 +12,6 @@
<h:form enctype="multipart/form-data">
<h:panelGrid columns="3">
<h:outputLabel for="templ" value="#{i18n['importuser.template']}" />
<h:selectOneMenu id="templ" value="#{importView.template}" converter="#{cardTemplateConverter}">
<f:selectItems value="#{importView.templates}" var="templ" itemLabel="#{templ.name}" />
</h:selectOneMenu>
<h:message for="templ" />
<h:outputLabel for="file" value="#{i18n['importuser.file']}"/>
<p:fileUpload id="file" value="#{importView.file}" mode="simple" />
......
......@@ -138,7 +138,7 @@ public class PlaceView extends GenericCDIView {
public String reserveForUser() {
try {
EventUser user = userbean.getEventUser(userlist.getRowData());
EventUser user = userbean.getEventUser(userlist.getRowData(), true);
if (placebean.reservePlace(place, user)) {
PlaceGroup newgroup = placebean.buySelectedPlaces(user);
for (Place p : newgroup.getPlaces()) {
......
......@@ -19,7 +19,7 @@ public class UserCardWrapper implements Serializable {
private transient final ListDataModel<PrintedCard> printedCards;
public UserCardWrapper(User u, UserBeanLocal userbean) {
user = userbean.getEventUser(u);
user = userbean.getEventUser(u, false);
List<PrintedCard> cards = null;
if (user != null) {
cards = user.getPrintedCards();
......
package fi.codecrew.moya.web.cdiview.user;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
import javax.inject.Named;
import org.primefaces.model.UploadedFile;
import fi.codecrew.moya.beans.UserBeanLocal;
import fi.codecrew.moya.enums.apps.UserPermission;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.User;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
@Named
......@@ -10,23 +21,24 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView;
public class ImportView extends GenericCDIView {
private static final long serialVersionUID = -6212627607244029512L;
//
// private static final long serialVersionUID = -6212627607244029512L;
//
// private String content;
//
// private static final Logger logger =
// LoggerFactory.getLogger(ImportView.class);
//
// @EJB
// private UserBeanLocal userbean;
@EJB
private UserBeanLocal userbean;
// @EJB
// private EventBeanLocal eventbean;
// @EJB
// private ProductBeanLocal prodbean;
//
// private UploadedFile file;
private UploadedFile file;
private ArrayList<ImportWrapper> users;
private Charset UTF8 = Charset.forName("UTF8");
//
// private ArrayList<ImportWrapper> wrapper;
//
......@@ -36,156 +48,68 @@ public class ImportView extends GenericCDIView {
//
// private List<CardTemplate> templates;
//
// public void initImport() {
// if (requirePermissions(UserPermission.MODIFY))
// {
// templates = templatebean.findAll();
// super.beginConversation();
// }
//
// }
//
// public String parse() throws IOException
// {
//
// setWrapper(new ArrayList<ImportWrapper>());
// logger.warn("Got file {} from upload", file);
//
// LanEvent event = eventbean.getCurrentEvent();
//
// if (file == null)
// {
// return null;
// }
//
// BufferedReader str = new BufferedReader(new
// InputStreamReader(file.getInputstream(), Charset.forName("ISO-8859-1")));
//
// for (String line = ""; line != null; line = str.readLine())
// {
//
// if (line == null || line.isEmpty() || line.matches("^id\\t"))
// {
// logger.info("skipping line {}", line);
// continue;
// }
// // logger.warn("Parsing line {}", line);
// User usr = new User();
//
// String[] limatch = line.split("\\|");
// if (limatch.length != 19)
// {
// logger.warn("SPlictcount != 19: {}", limatch.length);
// }
//
// for (int i = 0; limatch.length > i; ++i)
// {
// String field = limatch[i];
// // logger.info("Matched loop {}, val {}", i, field);
//
// switch (i)
// {
// case 5:
// usr.setEmail(field);
// break;
// case 9:
// usr.setPassword(field);
// break;
// case 10:
// String[] spl = field.split(" ", 2);
// if (spl.length != 2) {
// usr.setFirstnames(field);
// } else {
// usr.setFirstnames(spl[0]);
// usr.setLastname(spl[1]);
// }
//
// break;
//
// case 11:
// if (field != null && !field.isEmpty() && !field.equals("NULL"))
// {
// PrintedCard card = new PrintedCard(usr, template, Calendar.getInstance(),
// true);
// card.setRfidUid(field);
// usr.setPrintedCards(new ArrayList<PrintedCard>());
// usr.getPrintedCards().add(card);
// }
// break;
// case 12:
// usr.setPhone(field);
// break;
// case 13:
// usr.setNotes(new ArrayList<UserNote>());
// UserNote note = new UserNote();
// note.setContent(field);
// note.setEvent(event);
// note.setNotetype(UserNoteType.BANKACCOUNT);
// note.setUser(usr);
// usr.getNotes().add(note);
//
// break;
// case 14:
// usr.setNick(field);
// usr.setLogin(field);
// break;
// case 17:
// UserNote note2 = new UserNote();
// note2.setContent(field);
// note2.setEvent(event);
// note2.setNotetype(UserNoteType.ORGNOTE);
// note2.setUser(usr);
// usr.getNotes().add(note2);
// break;
//
// case 18:
// if (field == null || field.isEmpty() || field.equals("NULL")) {
// break;
// }
// if (usr.getAccountEvents() == null) {
// usr.setAccountEvents(new ArrayList<AccountEvent>());
// }
//
// try {
// AccountEvent ac = new AccountEvent(usr, prodbean.findCreditProduct(), new
// BigDecimal(field), BigDecimal.ONE, Calendar.getInstance());
// usr.getAccountEvents().add(ac);
// } catch (Throwable t) {
// logger.warn("Error parsing count: {}", t);
// }
//
// break;
// default:
// break;
// }
// if (i > 18)
// {
// logger.warn("cols not 18, {}", i);
// break;
// }
//
// }
//
// ImportWrapper wrap = new ImportWrapper(usr);
// getWrapper().add(wrap);
//
// SearchResult<User> srch = null;
// if (usr.getNick() != null && !usr.getNick().isEmpty())
// {
// srch = userbean.getUsers(0, 0, null, usr.getNick());
// wrap.add(srch.getResults());
// }
// if (usr.getEmail() != null && !usr.getEmail().isEmpty())
// {
// srch = userbean.getUsers(0, 0, null, usr.getEmail());
// wrap.add(srch.getResults());
// }
//
// } // end for split lines
// return "/user/commitImport";
//
// }
//
public void initImport() {
if (requirePermissions(UserPermission.MODIFY_ACCOUNTEVENTS)) {
}
}
public String parse()
{
ArrayList<ImportWrapper> ret = new ArrayList<ImportWrapper>();
byte[] bytes = file.getContents();
if (bytes == null && file.getSize() > 0)
{
bytes = new byte[(int) file.getSize()];
try {
file.getInputstream().read(bytes);
} catch (IOException e) {
super.addFaceMessage("import.erroruploading");
return null;
}
}
String content = new String(bytes, UTF8);
String[] splittedIds = content.split(";");
for (String idstr : splittedIds) {
int id = 0;
if (idstr != null && !idstr.isEmpty() && (id = Integer.parseInt(idstr)) > 0)
{
User user = userbean.getUser(id);
if (user != null)
{
ret.add(new ImportWrapper(user, userbean.getEventUser(user, false)));
}
}
}
users = ret;
return "commitImport";
}
public static class ImportWrapper
{
private final EventUser eventuser;
private final User user;
public ImportWrapper(User user, EventUser eventUser) {
this.user = user;
this.eventuser = eventUser;
}
public EventUser getEventuser() {
return eventuser;
}
public User getUser() {
return user;
}
}
// public String commitImport()
// {
// for (ImportWrapper w : wrapper)
......@@ -239,44 +163,21 @@ public class ImportView extends GenericCDIView {
// return null;
// }
//
// public String getContent() {
// return content;
// }
//
// public void setContent(String content) {
// this.content = content;
// }
//
// public UploadedFile getFile() {
// return file;
// }
//
// public void setFile(UploadedFile file) {
// this.file = file;
// }
//
// public ArrayList<ImportWrapper> getWrapper() {
// return wrapper;
// }
//
// public void setWrapper(ArrayList<ImportWrapper> wrapper) {
// this.wrapper = wrapper;
// }
//
// public List<CardTemplate> getTemplates() {
// return templates;
// }
//
// public void setTemplates(List<CardTemplate> templates) {
// this.templates = templates;
// }
//
// public CardTemplate getTemplate() {
// return template;
// }
//
// public void setTemplate(CardTemplate template) {
// this.template = template;
// }
public ArrayList<User> getUsers() {
return users;
}
public void setUsers(ArrayList<User> users) {
this.users = users;
}
public UploadedFile getFile() {
return file;
}
public void setFile(UploadedFile file) {
this.file = file;
}
}
......@@ -70,7 +70,7 @@ public class RoleView extends GenericCDIView {
public void addUser()
{
EventUser eu = userbean.getEventUser(addableUser);
EventUser eu = userbean.getEventUser(addableUser, false);
role = rolebean.addRole(eu, role);
addableUser = null;
}
......
package fi.codecrew.moya.web.cdiview.user;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -18,11 +19,44 @@ import fi.codecrew.moya.model.User;
import fi.codecrew.moya.util.UserSearchQuery;
import fi.codecrew.moya.utilities.SearchQuery.QuerySortOrder;
import fi.codecrew.moya.utilities.SearchResult;
import fi.codecrew.moya.utilities.jpa.ModelInterface;
import fi.codecrew.moya.web.cdiview.PaginationView;
import fi.codecrew.moya.web.cdiview.user.UserSearchView.UserWrapper;
@Named
@ConversationScoped
public class UserSearchView extends PaginationView<User> {
public class UserSearchView extends PaginationView<UserWrapper> {
public static class UserWrapper implements ModelInterface {
private final User user;
private final EventUser eventuser;
public UserWrapper(User u, EventUser eventUser) {
this.user = u;
this.eventuser = eventUser;
}
public User getUser() {
return user;
}
public EventUser getEventuser() {
return eventuser;
}
@Override
public Integer getId() {
return user.getId();
}
@Override
public void setId(Integer id) {
user.setId(id);
}
}
/**
*
......@@ -99,7 +133,14 @@ public class UserSearchView extends PaginationView<User> {
this.setEventUserResults(eventusers.getResults());
}
else {
super.setResult(userbean.getUsers(getSearchQuery()));
SearchResult<User> result = userbean.getUsers(getSearchQuery());
setResultcount(result.getResultcount());
ArrayList<UserWrapper> res = new ArrayList<UserWrapper>();
for (User u : result.getResults()) {
res.add(new UserWrapper(u, userbean.getEventUser(u, false)));
}
setResults(res);
}
super.beginConversation();
}
......
......@@ -141,7 +141,7 @@ public class UserView extends GenericCDIView {
ByteArrayInputStream data = new ByteArrayInputStream(captureEvent.getData());
UserImage img = userbean.uploadImage(user, "image/png", data, "userimage.png", "Uploaded image");
user = userbean.getEventUser(img.getUser());
user = userbean.getEventUser(img.getUser(), false);
// super.navihandler.forward("/admin/adduser/capturesuccess");
if (getCaptureForwardUrl() != null && !getCaptureForwardUrl().isEmpty())
super.navihandler.forward(getCaptureForwardUrl());
......@@ -199,7 +199,7 @@ public class UserView extends GenericCDIView {
croppedImage.getLeft(), croppedImage.getTop(),
croppedImage.getWidth(), croppedImage.getHeight());
user = userbean.getEventUser(newImage.getUser());
user = userbean.getEventUser(newImage.getUser(), false);
} catch (IOException e) {
logger.info("Error converting image", e);
super.addFaceMessage("user.errorConvertingImage");
......@@ -246,7 +246,7 @@ public class UserView extends GenericCDIView {
InputStream istr = getImage().getInputstream();
UserImage userimage = userbean.uploadImage(user, getImage().getContentType(), getImage().getInputstream(), getImage().getFileName(), "");
user = userbean.getEventUser(userimage.getUser());
user = userbean.getEventUser(userimage.getUser(), false);
super.addFaceMessage("user.imageUploaded");
}
printedCard = null;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!