Subversion Repositories SmartDukaan

Rev

Rev 35600 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
27878 amit.gupta 1
package com.spice.profitmandi.dao.model;
2
 
35600 amit 3
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4
 
27878 amit.gupta 5
import java.util.List;
6
import java.util.Objects;
7
 
35600 amit 8
@JsonIgnoreProperties(ignoreUnknown = true)
36081 amit 9
public class TargetSlab implements Comparable<TargetSlab>, java.io.Serializable {
10
    private static final long serialVersionUID = 1L;
27878 amit.gupta 11
 
12
	private int onwardsAmount;
13
	private String targetDescription;
14
	private List<ItemCriteriaPayout> itemCriteriaPayouts;
15
 
16
 
17
	public int getOnwardsAmount() {
18
		return onwardsAmount;
19
	}
20
 
21
	public int getRemainingAmount(int eligibleSale) {
22
		return onwardsAmount - eligibleSale;
23
	}
24
	public void setOnwardsAmount(int onwardsAmount) {
25
		this.onwardsAmount = onwardsAmount;
26
	}
27
 
28
	public boolean validate() {
29
		return this.itemCriteriaPayouts!= null;
30
	}
31
 
32
	public List<ItemCriteriaPayout> getItemCriteriaPayouts() {
33
		return itemCriteriaPayouts;
34
	}
35
 
36
	public void setItemCriteriaPayouts(List<ItemCriteriaPayout> itemCriteriaPayouts) {
37
		this.itemCriteriaPayouts = itemCriteriaPayouts;
38
	}
39
 
40
	@Override
41
	public int compareTo(TargetSlab targetSlab) {
42
		if(this.getOnwardsAmount() - targetSlab.getOnwardsAmount() > 0) {
43
			return 1;
44
		}else {
45
			return -1;
46
		}
47
	}
48
 
49
	@Override
50
	public boolean equals(Object obj) {
51
		if (this == obj)
52
			return true;
53
		if (obj == null)
54
			return false;
55
		if (getClass() != obj.getClass())
56
			return false;
57
		TargetSlab other = (TargetSlab) obj;
58
		if (itemCriteriaPayouts == null) {
59
			if (other.itemCriteriaPayouts != null)
60
				return false;
61
		} else if (!itemCriteriaPayouts.equals(other.itemCriteriaPayouts))
62
			return false;
63
		if (onwardsAmount != other.onwardsAmount)
64
			return false;
65
		if (targetDescription == null) {
66
			if (other.targetDescription != null)
67
				return false;
68
		} else if (!targetDescription.equals(other.targetDescription))
69
			return false;
70
		return true;
71
	}
72
 
73
	@Override
74
	public int hashCode() {
75
		final int prime = 31;
76
		int result = 1;
77
		result = prime * result + ((itemCriteriaPayouts == null) ? 0 : itemCriteriaPayouts.hashCode());
78
		result = prime * result + onwardsAmount;
79
		result = prime * result + ((targetDescription == null) ? 0 : targetDescription.hashCode());
80
		return result;
81
	}
82
 
83
	@Override
84
	public String toString() {
85
		return "TargetSlab [onwardsAmount=" + onwardsAmount + ", targetDescription=" + targetDescription
86
				+ ", itemCriteriaPayouts=" + itemCriteriaPayouts + "]";
87
	}
88
 
89
	public String getTargetDescription() {
90
		return targetDescription;
91
	}
92
 
93
	public void setTargetDescription(String targetDescription) {
94
		this.targetDescription = targetDescription;
95
	}
96
 
97
 
98
}