Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4500 mandeep.dh 1
/**
2
 * 
3
 */
4
package in.shop2020.warehouse.domain;
5
 
6
import in.shop2020.warehouse.ScanType;
7
 
8
import java.util.Date;
9
 
10
/**
11
 * @author mandeep
12
 *
13
 */
14
public class Scan {
15
    private long id;
16
    private long inventoryItemId;
17
    private long quantity;
18
    private Long orderId; // The order that was fulfilled with thin scan!
19
    private long warehouseId;
20
    private ScanType type;
21
    private Date scannedAt;
22
 
23
    public static Scan create(in.shop2020.warehouse.Scan thriftScan) {
24
        Scan scan = new Scan();
25
        scan.id = thriftScan.getId();
26
        scan.inventoryItemId = thriftScan.getInventoryItemId();
27
        scan.quantity = thriftScan.getQuantity();
28
        scan.warehouseId = thriftScan.getWarehouseId();
29
        scan.type = thriftScan.getType();
30
        scan.scannedAt = new Date(thriftScan.getScannedAt());
31
 
32
        if (thriftScan.isSetOrderId()) {
33
            scan.orderId = thriftScan.getOrderId();
34
        }
35
 
36
        return scan;
37
    }
38
 
39
    public in.shop2020.warehouse.Scan convert() {
40
        in.shop2020.warehouse.Scan scan = new in.shop2020.warehouse.Scan();
41
        scan.setId(id);
42
        scan.setInventoryItemId(inventoryItemId);
43
        scan.setQuantity(quantity);
44
        scan.setWarehouseId(warehouseId);
45
        scan.setType(type);
46
        scan.setScannedAt(scannedAt.getTime());
47
 
48
        if (orderId != null) {
49
            scan.setOrderId(orderId);
50
        }
51
 
52
        return scan;
53
    }
54
 
55
    public long getId() {
56
        return id;
57
    }
58
    public void setId(long id) {
59
        this.id = id;
60
    }
61
    public long getInventoryItemId() {
62
        return inventoryItemId;
63
    }
64
    public void setInventoryItemId(long inventoryItemId) {
65
        this.inventoryItemId = inventoryItemId;
66
    }
67
    public long getQuantity() {
68
        return quantity;
69
    }
70
    public void setQuantity(long quantity) {
71
        this.quantity = quantity;
72
    }
73
    public Long getOrderId() {
74
        return orderId;
75
    }
76
    public void setOrderId(Long orderId) {
77
        this.orderId = orderId;
78
    }
79
    public long getWarehouseId() {
80
        return warehouseId;
81
    }
82
    public void setWarehouseId(long warehouseId) {
83
        this.warehouseId = warehouseId;
84
    }
85
    public ScanType getType() {
86
        return type;
87
    }
88
    public void setType(ScanType type) {
89
        this.type = type;
90
    }
91
    public Date getScannedAt() {
92
        return scannedAt;
93
    }
94
    public void setScannedAt(Date scannedAt) {
95
        this.scannedAt = scannedAt;
96
    }
97
}