Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
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 28bfd68e
authored
May 11, 2013
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rest to jackson.
1 parent
c9b01cc0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
10 deletions
code/MoyaWeb/.settings/org.eclipse.ltk.core.refactoring.prefs
code/MoyaWeb/WebContent/WEB-INF/lib/jackson-jaxrs-1.9.12.jar
code/MoyaWeb/WebContent/WEB-INF/web.xml
code/MoyaWeb/src/fi/codecrew/moya/rest/PrinterRestView.java
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/CardRoot.java
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/PrintedCardRestPojo.java
code/MoyaWeb/.settings/org.eclipse.ltk.core.refactoring.prefs
0 → 100644
View file @
28bfd68
eclipse.preferences.version=1
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
code/MoyaWeb/WebContent/WEB-INF/lib/jackson-jaxrs-1.9.12.jar
0 → 100644
View file @
28bfd68
No preview for this file type
code/MoyaWeb/WebContent/WEB-INF/web.xml
View file @
28bfd68
This diff is collapsed.
Click to expand it.
code/MoyaWeb/src/fi/codecrew/moya/rest/PrinterRestView.java
View file @
28bfd68
package
fi
.
codecrew
.
moya
.
rest
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.RequestScoped
;
import
javax.ws.rs.Consumes
;
...
...
@@ -22,6 +20,7 @@ import fi.codecrew.moya.beans.CardTemplateBeanLocal;
import
fi.codecrew.moya.beans.UserBeanLocal
;
import
fi.codecrew.moya.enums.CardState
;
import
fi.codecrew.moya.model.PrintedCard
;
import
fi.codecrew.moya.rest.pojo.CardRoot
;
import
fi.codecrew.moya.rest.pojo.PrintedCardRestPojo
;
@RequestScoped
...
...
@@ -98,16 +97,16 @@ public class PrinterRestView {
@GET
@Path
(
"/ListUnprinted"
)
public
List
<
PrintedCardRestPojo
>
getUserCard
(
@QueryParam
(
"key"
)
String
key
)
throws
Exception
{
List
<
PrintedCardRestPojo
>
ret
=
PrintedCardRestPojo
.
parseCards
(
cardbean
.
getCardsByState
(
CardState
.
VALIDATED
));
public
CardRoot
getUserCard
(
@QueryParam
(
"key"
)
String
key
)
throws
Exception
{
CardRoot
ret
=
PrintedCardRestPojo
.
parseCards
(
cardbean
.
getCardsByState
(
CardState
.
VALIDATED
));
logger
.
info
(
"Returning card pojos: {} for key {}"
,
ret
,
key
);
return
ret
;
}
@GET
@Path
(
"/ListAll"
)
public
List
<
PrintedCardRestPojo
>
getAllCards
(
@QueryParam
(
"key"
)
String
key
)
throws
Exception
{
List
<
PrintedCardRestPojo
>
ret
=
PrintedCardRestPojo
.
parseCards
(
cardbean
.
getCardsByState
());
public
CardRoot
getAllCards
(
@QueryParam
(
"key"
)
String
key
)
throws
Exception
{
CardRoot
ret
=
PrintedCardRestPojo
.
parseCards
(
cardbean
.
getCardsByState
());
logger
.
info
(
"Returning card pojos: {} for key {}"
,
ret
,
key
);
return
ret
;
}
...
...
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/CardRoot.java
0 → 100644
View file @
28bfd68
package
fi
.
codecrew
.
moya
.
rest
.
pojo
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlElementWrapper
;
import
javax.xml.bind.annotation.XmlRootElement
;
@XmlRootElement
public
class
CardRoot
{
@XmlElementWrapper
(
name
=
"cards"
)
private
List
<
PrintedCardRestPojo
>
cards
;
public
List
<
PrintedCardRestPojo
>
getCards
()
{
return
cards
;
}
public
void
setCards
(
List
<
PrintedCardRestPojo
>
cards
)
{
this
.
cards
=
cards
;
}
}
code/MoyaWeb/src/fi/codecrew/moya/rest/pojo/PrintedCardRestPojo.java
View file @
28bfd68
...
...
@@ -4,12 +4,10 @@ import java.util.ArrayList;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
javax.xml.bind.annotation.XmlTransient
;
import
fi.codecrew.moya.model.PrintedCard
;
@XmlRootElement
(
name
=
"cards"
)
public
class
PrintedCardRestPojo
{
public
PrintedCardRestPojo
()
{
...
...
@@ -57,12 +55,14 @@ public class PrintedCardRestPojo {
return
card
.
getCardState
().
toString
();
}
public
static
List
<
PrintedCardRestPojo
>
parseCards
(
List
<
PrintedCard
>
cards
)
public
static
CardRoot
parseCards
(
List
<
PrintedCard
>
cards
)
{
ArrayList
<
PrintedCardRestPojo
>
ret
=
new
ArrayList
<
PrintedCardRestPojo
>();
for
(
PrintedCard
c
:
cards
)
{
ret
.
add
(
new
PrintedCardRestPojo
(
c
));
}
return
ret
;
CardRoot
root
=
new
CardRoot
();
root
.
setCards
(
ret
);
return
root
;
}
}
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