1 package com.srv4pos.server.api.activation; 2 3 import com.srv4pos.server.api.infrastructure.Info; 4 import org.springframework.roo.addon.javabean.RooJavaBean; 5 import org.springframework.roo.addon.json.RooJson; 6 import org.springframework.roo.addon.tostring.RooToString; 7 8 import javax.validation.Valid; 9 import javax.validation.constraints.NotNull; 10 import javax.validation.constraints.Size; 11 import java.util.Date; 12 import java.util.HashSet; 13 14 /** 15 * Represents server-side entity available. 16 * <p>User: Kirill, Date: 05.08.13 17:59</p> 17 */ 18 @RooJavaBean 19 @RooToString 20 @RooJson(deepSerialize = true) 21 public class ActivationInfo implements Info { 22 private Long id; 23 24 /** 25 * This field is set by activation server internal logic every time we do an action with the activation, 26 * so it's read-only field, any input will be ignored. 27 */ 28 @NotNull 29 private ActivationStatus status = ActivationStatus.ISSUED; 30 31 /** 32 * It's read-only field. 33 */ 34 private Date issued; 35 36 /** 37 * This field is set by customer when ordering. 38 */ 39 private ControlUnitLocation controlUnitLocation = ControlUnitLocation.REMOTE; 40 41 /** 42 * This field is set a) when customer makes an order and suggest the date he wish; b) when sales person approves an activation he is able to change it. 43 */ 44 @NotNull 45 private Date validFrom; 46 47 /** 48 * This field is set a) when customer makes an order and suggest the date he wish; b) when sales person approves an activation he is able to change it. 49 */ 50 @NotNull 51 private Date validTo; 52 53 /** 54 * This field is set when customer makes an order: 55 * <ul> 56 * <li>control unit is not required by the application, then this field is null</li> 57 * <li>If {@link ActivationDetailsInfo#controlUnitLocation} == {@link ControlUnitLocation#REMOTE}, then one of the connected control units will be 58 * selected automatically</li> 59 * <li>If {@link ActivationDetailsInfo#controlUnitLocation} == {@link ControlUnitLocation#DEVICE}, then 60 * <ul> 61 * <li>control unit will be selected by {@link com.srv4pos.server.api.activation.ActivationDetailsInfo#controlUnitSerialNumber}</li> 62 * <li>or null if customer wants to order a new one</li> 63 * </ul> 64 * </li> 65 * </ul>. 66 * This field can be changed by sales person when he activates an activation. 67 */ 68 @Size(max = 20, min = 1) 69 private String controlUnitSerial; 70 71 /** 72 * Where device (with control unit) is located. This information is sent to taxation authority 73 * This field is set when customer makes an order and {@link ActivationDetailsInfo#controlUnitLocation} == {@link ControlUnitLocation#DEVICE}. 74 * If this field is set and sales person makes an activation, he must check it's validity because it's content will be copied to controlUnit.geolocation 75 * and will be applied for all the sellers connected to this control unit. 76 */ 77 @Valid 78 private GeolocationInfo controlUnitGeolocation; 79 80 /** 81 * This field is set when customer to tell sales person his contact data. 82 */ 83 @Valid 84 private ContactInfo contact; 85 86 /** 87 * This field is set when customer makes an order to send a custom message to sales person. For instance "I've broken my device with already 88 * activated license. Please reactivate this new device for free". 89 */ 90 @Size(max = 1024) 91 private String comment; 92 93 /** 94 * Set of features, see {@link Feature} for more info. 95 */ 96 @NotNull 97 private java.util.Set<Feature> features = new HashSet<Feature>(); 98 }