Commit a50c8682 by Antti Tönkyrä

cardstate added to printedcard, see sql alter from wiki

1 parent 0dd8c8a6
...@@ -14,6 +14,8 @@ import javax.faces.model.ListDataModel; ...@@ -14,6 +14,8 @@ import javax.faces.model.ListDataModel;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
...@@ -26,6 +28,8 @@ import javax.persistence.UniqueConstraint; ...@@ -26,6 +28,8 @@ import javax.persistence.UniqueConstraint;
import org.eclipse.persistence.annotations.OptimisticLocking; import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType; import org.eclipse.persistence.annotations.OptimisticLockingType;
import fi.codecrew.moya.enums.CardState;
/** /**
* *
*/ */
...@@ -73,6 +77,10 @@ public class PrintedCard extends GenericEntity { ...@@ -73,6 +77,10 @@ public class PrintedCard extends GenericEntity {
@JoinColumn(nullable = false, name = "card_template_id", referencedColumnName = CardTemplate.ID_COLUMN) @JoinColumn(nullable = false, name = "card_template_id", referencedColumnName = CardTemplate.ID_COLUMN)
@ManyToOne(optional = false) @ManyToOne(optional = false)
private CardTemplate template; private CardTemplate template;
@Column(name="card_state", nullable=false)
@Enumerated(EnumType.STRING)
private CardState cardState = CardState.PENDING_VALIDATION;
public PrintedCard(EventUser usr, CardTemplate templ, Calendar printTime, boolean cardEnabled) { public PrintedCard(EventUser usr, CardTemplate templ, Calendar printTime, boolean cardEnabled) {
super(); super();
...@@ -195,6 +203,14 @@ public class PrintedCard extends GenericEntity { ...@@ -195,6 +203,14 @@ public class PrintedCard extends GenericEntity {
return gamepoints; return gamepoints;
} }
public CardState getCardState() {
return cardState;
}
public void setCardState(CardState cardState) {
this.cardState = cardState;
}
@Transient @Transient
private transient ListDataModel<ReaderEvent> revents; private transient ListDataModel<ReaderEvent> revents;
......
package fi.codecrew.moya.enums;
public enum CardState {
PENDING_VALIDATION,
REJECTED,
VALIDATED,
PENDING_PRINT,
PRINTING_IN_PROGRESS,
PRINTED
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!