KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > dotmarketing > portlets > discountcode > model > DiscountCode


1 package com.dotmarketing.portlets.discountcode.model;
2
3 import java.util.List JavaDoc;
4
5 import com.dotmarketing.beans.Inode;
6 import com.dotmarketing.factories.InodeFactory;
7 import com.dotmarketing.util.WebKeys;
8 import com.dotmarketing.portlets.product.model.ProductFormat;
9
10 public class DiscountCode extends Inode {
11
12     public static final int percentageDiscountType = 0;
13     public static final int amountDiscountType = 1;
14     
15     private static final long serialVersionUID = 1L;
16     //private long inode; //persistent
17
private int discountType; //persistent
18
private java.util.Date JavaDoc startDate; //persistent
19
private java.util.Date JavaDoc endDate; //persistent
20
private String JavaDoc codeId; //persistent
21
private String JavaDoc codeDescription; //persistent
22
private boolean freeShipping; //persistent
23
private boolean noBulkDisc; //persistent
24
private float discountAmount; //persistent
25
private int minOrder; //persistent
26

27     public DiscountCode(int discountType, java.util.Date JavaDoc startDate, java.util.Date JavaDoc endDate, String JavaDoc codeId, String JavaDoc codeDescription, boolean freeShipping, boolean noBulkDisc, int discountAmount, int minOrder) {
28         this.discountType = discountType;
29         this.startDate = startDate;
30         this.endDate = endDate;
31         this.codeId = codeId;
32         this.codeDescription = codeDescription;
33         this.freeShipping = freeShipping;
34         this.noBulkDisc = noBulkDisc;
35         this.discountAmount = discountAmount;
36         this.minOrder = minOrder;
37     }
38
39     public DiscountCode() {
40     }
41
42     //public long getInode() {
43
// return this.inode;
44
//}
45

46     //public void setInode(long inode) {
47
// this.inode = inode;
48
//}
49

50     public int getDiscountType() {
51         return this.discountType;
52     }
53
54     public void setDiscountType(int discountType) {
55         this.discountType = discountType;
56     }
57     public java.util.Date JavaDoc getStartDate() {
58         return this.startDate;
59     }
60
61     public void setStartDate(java.util.Date JavaDoc startDate) {
62         this.startDate = startDate;
63     }
64     public java.util.Date JavaDoc getEndDate() {
65         return this.endDate;
66     }
67
68     public void setEndDate(java.util.Date JavaDoc endDate) {
69         this.endDate = endDate;
70     }
71     public String JavaDoc getCodeId() {
72         return this.codeId;
73     }
74
75     public void setCodeId(String JavaDoc codeId) {
76         this.codeId = codeId;
77     }
78     public String JavaDoc getCodeDescription() {
79         return this.codeDescription;
80     }
81
82     public void setCodeDescription(String JavaDoc codeDescription) {
83         this.codeDescription = codeDescription;
84     }
85     public boolean getFreeShipping() {
86         return this.freeShipping;
87     }
88
89     public void setFreeShipping(boolean freeShipping) {
90         this.freeShipping = freeShipping;
91     }
92     public boolean getNoBulkDisc() {
93         return this.noBulkDisc;
94     }
95
96     public void setNoBulkDisc(boolean noBulkDisc) {
97         this.noBulkDisc = noBulkDisc;
98     }
99     public float getDiscountAmount() {
100         return this.discountAmount;
101     }
102
103     public void setDiscountAmount(float discountAmount) {
104         this.discountAmount = discountAmount;
105     }
106     public int getMinOrder() {
107         return this.minOrder;
108     }
109
110     public void setMinOrder(int minOrder) {
111         this.minOrder = minOrder;
112     }
113     
114     public List JavaDoc<ProductFormat> getProductFormatApplicable()
115     {
116         return InodeFactory.getParentsOfClassByRelationType(this,ProductFormat.class,WebKeys.DISCOUNTCODE_PRODUCT_FORMAT);
117     }
118
119     @Override JavaDoc
120     public boolean equals(Object JavaDoc other)
121     {
122         DiscountCode otherDiscountCode = (DiscountCode) other;
123         boolean returnValue = (this.inode == otherDiscountCode.getInode() ? true : false);
124         return returnValue;
125     }
126 }
127
Popular Tags