Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Max Mecklin
/
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 a41e11dc
authored
Aug 01, 2015
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'addCreatedToCsv' into 'master'
Add eventuser.created to csv See merge request !300
2 parents
fb29adf5
ce5b7435
Show 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 @
a41e11d
...
...
@@ -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