Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Riina Antikainen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit ce5b7435
authored
Jul 31, 2015
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add eventuser.created to csv export. We don't want to export these all the time from database...
1 parent
dc1b0140
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/user/UserCartView.java
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/user/UserCartView.java
View file @
ce5b743
...
...
@@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream;
import
java.nio.charset.Charset
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
javax.enterprise.context.ConversationScoped
;
...
...
@@ -33,6 +34,7 @@ import org.primefaces.model.StreamedContent;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.GroupMembership
;
import
fi.codecrew.moya.model.LanEvent
;
...
...
@@ -94,8 +96,15 @@ public class UserCartView extends GenericCDIView {
sb
.
append
(
"Zip"
).
append
(
CSV_SEPARATOR
);
sb
.
append
(
"City"
).
append
(
CSV_SEPARATOR
);
sb
.
append
(
"Places"
).
append
(
CSV_SEPARATOR
);
sb
.
append
(
"Created"
).
append
(
CSV_SEPARATOR
);
LanEvent
event
=
null
;
if
(
usercart
!=
null
&&
!
usercart
.
isEmpty
())
{
event
=
usercart
.
get
(
0
).
getEvent
();
}
sb
.
append
(
"\n"
);
SimpleDateFormat
createtimeFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm"
);
for
(
EventUser
uc
:
usercart
)
{
sb
.
append
(
uc
.
getFirstnames
()).
append
(
CSV_SEPARATOR
);
...
...
@@ -117,11 +126,18 @@ public class UserCartView extends GenericCDIView {
}
}
sb
.
append
(
CSV_SEPARATOR
);
if
(
uc
.
getCreated
()
!=
null
)
{
sb
.
append
(
createtimeFormat
.
format
(
uc
.
getCreated
().
getTime
()));
}
sb
.
append
(
CSV_SEPARATOR
);
sb
.
append
(
"\n"
);
}
DefaultStreamedContent
ret
=
new
DefaultStreamedContent
(
new
ByteArrayInputStream
(
sb
.
toString
().
getBytes
(
UTF8
)));
ret
.
setContentType
(
"text/csv"
);
SimpleDateFormat
filenameDateformat
=
new
SimpleDateFormat
(
"yyyy-MM-dd_HH-mm"
);
ret
.
setName
(
event
.
getName
()
+
"-userexport-"
+
filenameDateformat
.
format
(
new
Date
())
+
".csv"
);
return
ret
;
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment