Subversion Repositories SmartDukaan

Rev

Rev 1050 | Rev 1153 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1050 rajveer 1
package in.shop2020.metamodel.core;
2
 
3
import in.shop2020.metamodel.util.ReusableMetaModelComponent;
4
 
5
import java.util.Calendar;
6
import java.util.Date;
7
 
8
public class EntityState extends ReusableMetaModelComponent{
9
 
10
	/**
11
	 * 
12
	 */
13
	private static final long serialVersionUID = 1L;
14
 
15
	private EntityStatus status;
16
 
17
	private String createdBy;
18
	private String assignedBy;
19
	private String assignedTo;
20
	private String completedBy;
21
	private String markedReadyBy;
22
 
23
	private Date createdOn;
24
	private Date assignedOn;
25
	private Date completedOn;
26
	private Date markedReadyOn;
27
 
28
 
29
	/*
30
	private class ActionLog{
31
		Action action;
32
		String user;
33
		Date date;
34
 
35
		ActionLog(Action action, String user){
36
			this.action = action;
37
			this.user = user;
38
			this.date = new Date();
39
		}
40
	}
41
 
42
	private List<ActionLog> historyActions = new ArrayList<ActionLog>();
43
	private ActionLog currentAction;
44
 
45
	//this.currentAction = new ActionLog(Action.CREATE, createdBy);
46
	 * 
47
	 * 	//this.currentAction = new ActionLog(Action.CREATE, createdBy);
48
	*/
49
 
50
	public EntityState(long newID, String createdBy){
51
		super(newID);
52
		this.status = EntityStatus.UNASSIGNED;
53
		this.createdBy = createdBy;
54
		this.createdOn = getCurrentTime(); 
55
	}
56
 
57
	public void assignEntity(String assignedBy, String assignedTo){
58
		this.status = EntityStatus.ASSIGNED;
59
		this.assignedBy = assignedBy;
60
		this.assignedTo = assignedTo;
61
		this.assignedOn = getCurrentTime();
62
	}
63
 
64
	public void completeEntity(String completedBy) {
65
		this.status = EntityStatus.COMPLETE;
66
		this.completedBy = completedBy;
67
		this.completedOn = getCurrentTime();
68
	}
69
 
70
	public void readyEntity(String markedReadyBy) {
71
		this.status = EntityStatus.READY;
72
		this.markedReadyBy = markedReadyBy;
73
		this.markedReadyOn = getCurrentTime();
74
	}
75
 
76
	public void setStatus(EntityStatus status) {
77
		this.status = status;
78
	}
79
 
80
	public EntityStatus getStatus() {
81
		return status;
82
	}
83
 
84
	public void setCreatedBy(String createdBy) {
85
		this.createdBy = createdBy;
86
	}
87
 
88
	public String getCreatedBy() {
89
		return createdBy;
90
	}
91
 
92
	public void setAssignedBy(String assignedBy) {
93
		this.assignedBy = assignedBy;
94
	}
95
 
96
	public String getAssignedBy() {
97
		return assignedBy;
98
	}
99
 
100
	public void setAssignedTo(String assignedTo) {
101
		this.assignedTo = assignedTo;
102
	}
103
 
104
	public String getAssignedTo() {
105
		return assignedTo;
106
	}
107
 
108
	public void setCompletedBy(String completedBy) {
109
		this.completedBy = completedBy;
110
	}
111
 
112
	public String getCompletedBy() {
113
		return completedBy;
114
	}
115
 
116
	public void setMerkedReadyBy(String merkedReadyBy) {
117
		this.markedReadyBy = merkedReadyBy;
118
	}
119
 
120
	public String getMerkedReadyBy() {
121
		return markedReadyBy;
122
	}
123
 
124
	public void setCreatedOn(Date createdOn) {
125
		this.createdOn = createdOn;
126
	}
127
 
128
	public Date getCreatedOn() {
129
		return createdOn;
130
	}
131
 
132
	public void setAssignedOn(Date assignedOn) {
133
		this.assignedOn = assignedOn;
134
	}
135
 
136
	public Date getAssignedOn() {
137
		return assignedOn;
138
	}
139
 
140
	public void setCompletedOn(Date completedOn) {
141
		this.completedOn = completedOn;
142
	}
143
 
144
	public Date getCompletedOn() {
145
		return completedOn;
146
	}
147
 
148
	public void setMerkedReadyOn(Date merkedReadyOn) {
149
		this.markedReadyOn = merkedReadyOn;
150
	}
151
 
152
	public Date getMerkedReadyOn() {
153
		return markedReadyOn;
154
	}
155
 
156
	private static Date getCurrentTime(){
157
	    Calendar cal = Calendar.getInstance();
158
	    return cal.getTime();
159
	}
160
}