Subversion Repositories SmartDukaan

Rev

Rev 23531 | Rev 23574 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23531 Rev 23556
Line 12... Line 12...
12
import javax.persistence.Id;
12
import javax.persistence.Id;
13
import javax.persistence.Table;
13
import javax.persistence.Table;
14
 
14
 
15
import org.hibernate.annotations.UpdateTimestamp;
15
import org.hibernate.annotations.UpdateTimestamp;
16
 
16
 
-
 
17
import com.spice.profitmandi.common.util.FormattingUtils;
17
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
18
import com.spice.profitmandi.dao.convertor.LocalDateTimeAttributeConverter;
18
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
19
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
19
 
20
 
20
/**
21
/**
21
 * This class basically contains recharge operator details
22
 * This class basically contains recharge operator details
Line 36... Line 37...
36
	@Id
37
	@Id
37
	@Column(name="operator_id", unique=true, updatable=false)
38
	@Column(name="operator_id", unique=true, updatable=false)
38
	//@GeneratedValue(strategy = GenerationType.IDENTITY)
39
	//@GeneratedValue(strategy = GenerationType.IDENTITY)
39
	private int operatorId;
40
	private int operatorId;
40
	
41
	
-
 
42
	@Column(name="our_commission")
-
 
43
	private float ourCommission;
-
 
44
	
-
 
45
	@Column(name="our_commission_type")
-
 
46
	@Enumerated(EnumType.STRING)
-
 
47
	private AmountType ourCommissionType;
-
 
48
	
-
 
49
	public float getOurCommission() {
-
 
50
		return ourCommission;
-
 
51
	}
-
 
52
 
-
 
53
	public void setOurCommission(float ourCommission) {
-
 
54
		this.ourCommission = ourCommission;
-
 
55
	}
-
 
56
 
-
 
57
	public AmountType getOurCommissionType() {
-
 
58
		return ourCommissionType;
-
 
59
	}
-
 
60
 
-
 
61
	public void setOurCommissionType(AmountType ourCommissionType) {
-
 
62
		this.ourCommissionType = ourCommissionType;
-
 
63
	}
-
 
64
 
41
	@Column(name="amount")
65
	@Column(name="amount")
42
	private float amount;
66
	private float amount;
43
	
67
	
44
	@Column(name = "amount_type")
68
	@Column(name = "amount_type")
45
	@Enumerated(EnumType.STRING)
69
	@Enumerated(EnumType.STRING)
46
	private AmountType amountType;
70
	private AmountType amountType;
47
	
71
	
-
 
72
	public String getFormattedAmount() {
-
 
73
		return FormattingUtils.formatDecimalTwoDigits(this.getAmount());
-
 
74
	}
-
 
75
	
48
	@Convert(converter = LocalDateTimeAttributeConverter.class)
76
	@Convert(converter = LocalDateTimeAttributeConverter.class)
49
	@Column(name="create_timestamp", updatable = false)
77
	@Column(name="create_timestamp", updatable = false)
50
	private LocalDateTime createTimestamp = LocalDateTime.now();
78
	private LocalDateTime createTimestamp = LocalDateTime.now();
51
	
79
	
52
	@Convert(converter = LocalDateTimeAttributeConverter.class)
80
	@Convert(converter = LocalDateTimeAttributeConverter.class)
Line 112... Line 140...
112
 
140
 
113
	@Override
141
	@Override
114
	public int hashCode() {
142
	public int hashCode() {
115
		final int prime = 31;
143
		final int prime = 31;
116
		int result = 1;
144
		int result = 1;
-
 
145
		result = prime * result + Float.floatToIntBits(amount);
-
 
146
		result = prime * result + ((amountType == null) ? 0 : amountType.hashCode());
-
 
147
		result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
117
		result = prime * result + operatorId;
148
		result = prime * result + operatorId;
-
 
149
		result = prime * result + Float.floatToIntBits(ourCommission);
-
 
150
		result = prime * result + ((ourCommissionType == null) ? 0 : ourCommissionType.hashCode());
-
 
151
		result = prime * result + ((updateTimestamp == null) ? 0 : updateTimestamp.hashCode());
118
		return result;
152
		return result;
119
	}
153
	}
120
 
154
 
121
	@Override
155
	@Override
122
	public boolean equals(Object obj) {
156
	public boolean equals(Object obj) {
Line 125... Line 159...
125
		if (obj == null)
159
		if (obj == null)
126
			return false;
160
			return false;
127
		if (getClass() != obj.getClass())
161
		if (getClass() != obj.getClass())
128
			return false;
162
			return false;
129
		RechargeCommission other = (RechargeCommission) obj;
163
		RechargeCommission other = (RechargeCommission) obj;
-
 
164
		if (Float.floatToIntBits(amount) != Float.floatToIntBits(other.amount))
-
 
165
			return false;
-
 
166
		if (amountType != other.amountType)
-
 
167
			return false;
-
 
168
		if (createTimestamp == null) {
-
 
169
			if (other.createTimestamp != null)
-
 
170
				return false;
-
 
171
		} else if (!createTimestamp.equals(other.createTimestamp))
-
 
172
			return false;
130
		if (operatorId != other.operatorId)
173
		if (operatorId != other.operatorId)
131
			return false;
174
			return false;
-
 
175
		if (Float.floatToIntBits(ourCommission) != Float.floatToIntBits(other.ourCommission))
-
 
176
			return false;
-
 
177
		if (ourCommissionType != other.ourCommissionType)
-
 
178
			return false;
-
 
179
		if (updateTimestamp == null) {
-
 
180
			if (other.updateTimestamp != null)
-
 
181
				return false;
-
 
182
		} else if (!updateTimestamp.equals(other.updateTimestamp))
-
 
183
			return false;
132
		return true;
184
		return true;
133
	}
185
	}
134
 
186
 
135
	@Override
187
	@Override
136
	public String toString() {
188
	public String toString() {
-
 
189
		return "RechargeCommission [operatorId=" + operatorId + ", ourCommission=" + ourCommission
137
		return "RechargeCommission [operatorId=" + operatorId + ", amount=" + amount + ", amountType=" + amountType
190
				+ ", ourCommissionType=" + ourCommissionType + ", amount=" + amount + ", amountType=" + amountType
138
				+ ", createTimestamp=" + createTimestamp + ", updateTimestamp=" + updateTimestamp + "]";
191
				+ ", createTimestamp=" + createTimestamp + ", updateTimestamp=" + updateTimestamp + "]";
139
	}
192
	}
140
        
193
        
141
}
194
}
142
195