Subversion Repositories SmartDukaan

Rev

Rev 29785 | Rev 30670 | Go to most recent revision | 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
 
3
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
4
import com.spice.profitmandi.service.offers.ItemCriteria;
5
import com.spice.profitmandi.service.offers.PayoutSlab;
6
 
30651 amit.gupta 7
import java.util.List;
8
 
27878 amit.gupta 9
public class ItemCriteriaPayout {
10
	private AmountType amountType;
30651 amit.gupta 11
	private ItemCriteria itemCriteria;
12
	private List<PayoutSlab> payoutSlabs;
13
	private String itemCriteriaString;
14
	private long achievedValue;
15
	private long shortValue;
16
	private PayoutSlab currentSlab;
17
	private PayoutSlab nextSlab;
27878 amit.gupta 18
 
30651 amit.gupta 19
	public String getCurretPayoutString() {
20
		String templateString = null;
21
		if (this.getAmountType().equals(AmountType.FIXED)) {
22
			templateString = "Rs. %f per pc";
23
		} else if (this.getAmountType().equals(AmountType.PERCENTAGE)) {
24
			templateString = "%f %%";
25
		} else {
26
			templateString = "%f %%";
27
		}
28
		return String.format(templateString, this.getCurrentSlab().getPayoutAmount());
29
	}
30
 
31
	public long getShortValue() {
29785 amit.gupta 32
		return shortValue;
33
	}
34
 
35
 
36
	public void setShortValue(long shortValue) {
37
		this.shortValue = shortValue;
38
	}
39
 
40
 
41
	public PayoutSlab getCurrentSlab() {
42
		return currentSlab;
43
	}
44
 
45
 
46
	public void setCurrentSlab(PayoutSlab currentSlab) {
47
		this.currentSlab = currentSlab;
48
	}
49
 
50
 
51
	public PayoutSlab getNextSlab() {
52
		return nextSlab;
53
	}
54
 
55
 
56
	public void setNextSlab(PayoutSlab nextSlab) {
57
		this.nextSlab = nextSlab;
58
	}
59
 
60
 
61
	public ItemCriteria getItemCriteria() {
27878 amit.gupta 62
        return itemCriteria;
63
    }
64
 
65
 
66
	public AmountType getAmountType() {
67
		return amountType;
68
	}
69
 
70
 
71
 
72
	public void setAmountType(AmountType amountType) {
73
		this.amountType = amountType;
74
	}
75
 
76
 
77
 
29785 amit.gupta 78
	public long getAchievedValue() {
79
		return achievedValue;
80
	}
81
 
82
 
83
	public void setAchievedValue(long achievedValue) {
84
		this.achievedValue = achievedValue;
85
	}
86
 
87
 
27878 amit.gupta 88
	public String getItemCriteriaString() {
89
        return itemCriteriaString;
90
    }
91
 
92
    public void setItemCriteriaString(String itemCriteriaString) {
93
        this.itemCriteriaString = itemCriteriaString;
94
    }
95
 
96
    @Override
97
	public int hashCode() {
98
		final int prime = 31;
99
		int result = 1;
100
		result = prime * result + ((amountType == null) ? 0 : amountType.hashCode());
29785 amit.gupta 101
		result = prime * result + ((currentSlab == null) ? 0 : currentSlab.hashCode());
27878 amit.gupta 102
		result = prime * result + ((itemCriteria == null) ? 0 : itemCriteria.hashCode());
103
		result = prime * result + ((itemCriteriaString == null) ? 0 : itemCriteriaString.hashCode());
104
		return result;
105
	}
106
 
107
 
108
 
109
	@Override
110
	public boolean equals(Object obj) {
111
		if (this == obj)
112
			return true;
113
		if (obj == null)
114
			return false;
115
		if (getClass() != obj.getClass())
116
			return false;
117
		ItemCriteriaPayout other = (ItemCriteriaPayout) obj;
118
		if (amountType != other.amountType)
119
			return false;
29785 amit.gupta 120
		if (currentSlab == null) {
121
			if (other.currentSlab != null)
122
				return false;
123
		} else if (!currentSlab.equals(other.currentSlab))
124
			return false;
27878 amit.gupta 125
		if (itemCriteria == null) {
126
			if (other.itemCriteria != null)
127
				return false;
128
		} else if (!itemCriteria.equals(other.itemCriteria))
129
			return false;
130
		if (itemCriteriaString == null) {
131
			if (other.itemCriteriaString != null)
132
				return false;
133
		} else if (!itemCriteriaString.equals(other.itemCriteriaString))
134
			return false;
135
		return true;
136
	}
137
 
138
    public void setItemCriteria(ItemCriteria itemCriteria) {
139
        this.itemCriteria = itemCriteria;
140
    }
141
 
142
    public List<PayoutSlab> getPayoutSlabs() {
143
        return payoutSlabs;
144
    }
145
 
146
    public void setPayoutSlabs(List<PayoutSlab> payoutSlabs) {
147
        this.payoutSlabs = payoutSlabs;
148
    }
149
 
150
 
151
 
152
	@Override
153
	public String toString() {
154
		return "ItemCriteriaPayout [amountType=" + amountType + ", itemCriteria=" + itemCriteria + ", payoutSlabs="
29785 amit.gupta 155
				+ payoutSlabs + ", itemCriteriaString=" + itemCriteriaString + ", achievedValue=" + achievedValue
156
				+ ", shortValue=" + shortValue + ", currentSlab=" + currentSlab + ", nextSlab=" + nextSlab + "]";
27878 amit.gupta 157
	}
158
 
159
 
160
 
161
 
162
}