Commit 0fa769dc by Tuomas Riihimäki

Added print time setting in card state changing

1 parent a4086d50
...@@ -5,6 +5,7 @@ import java.io.ByteArrayInputStream; ...@@ -5,6 +5,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.List; import java.util.List;
import javax.annotation.security.DeclareRoles; import javax.annotation.security.DeclareRoles;
...@@ -32,6 +33,7 @@ import fi.codecrew.moya.model.LanEventPropertyKey; ...@@ -32,6 +33,7 @@ import fi.codecrew.moya.model.LanEventPropertyKey;
import fi.codecrew.moya.model.PrintedCard; import fi.codecrew.moya.model.PrintedCard;
import fi.codecrew.moya.model.Role; import fi.codecrew.moya.model.Role;
import fi.codecrew.moya.util.MailMessage; import fi.codecrew.moya.util.MailMessage;
rew.moya.util.MailMessage;
/** /**
* Session Bean implementation class CardTemplateBean * Session Bean implementation class CardTemplateBean
...@@ -278,6 +280,7 @@ public class CardTemplateBean implements CardTemplateBeanLocal { ...@@ -278,6 +280,7 @@ public class CardTemplateBean implements CardTemplateBeanLocal {
{ {
case PRINTED: case PRINTED:
card.setPrintCount(card.getPrintCount() + 1); card.setPrintCount(card.getPrintCount() + 1);
card.setPrintTime(Calendar.getInstance());
break; break;
case PRINTING_IN_PROGRESS: case PRINTING_IN_PROGRESS:
if (card.getCardState().equals(CardState.PRINTING_IN_PROGRESS) if (card.getCardState().equals(CardState.PRINTING_IN_PROGRESS)
......
package fi.codecrew.moya.rest.pojo; package fi.codecrew.moya.rest.pojo;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
...@@ -55,6 +56,15 @@ public class PrintedCardRestPojo { ...@@ -55,6 +56,15 @@ public class PrintedCardRestPojo {
return card.getCardState().toString(); return card.getCardState().toString();
} }
@XmlElement(name = "printTime")
public Date getPrintTime()
{
Date ret = null;
if (card.getPrintTime() != null)
ret = card.getPrintTime().getTime();
return ret;
}
public static CardRoot parseCards(List<PrintedCard> cards) public static CardRoot parseCards(List<PrintedCard> cards)
{ {
ArrayList<PrintedCardRestPojo> ret = new ArrayList<PrintedCardRestPojo>(); ArrayList<PrintedCardRestPojo> ret = new ArrayList<PrintedCardRestPojo>();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!