PromoDiscountPart.java 6.22 KB
Newer Older
akbar fauzi's avatar
akbar fauzi committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
package com.eksad.masterdata.domain;

import com.eksad.ddms.common.util.object.EntityObject;
import com.eksad.ddms.common.util.status.DataStatus;
import com.eksad.masterdata.common.listEnum.SatuanType;
import jakarta.persistence.*;

import javax.validation.constraints.NotNull;
import java.util.Objects;

@Entity
@Table(name = "MST_PROMODISCOUNTPART")
public class PromoDiscountPart implements EntityObject<PromoDiscountPart> {

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    Integer id;

    @NotNull(message = "promo discount part id")
    private String promoDiscountPartID;

    @NotNull(message = "promo id cannot be null")
    private String promoID;

//    private String discountID; // this field from H3 no longger use

    @NotNull(message = "discount part id cannot be null")
    private String discountPartID;

    private String discountPartDesc;

    private String discountPartGroup;

    @Enumerated(EnumType.STRING)
    private SatuanType satuan;

    private Double nilaiDiscount;

    @Enumerated(EnumType.STRING)
    private DataStatus promoDiscountPartStatus;

    @Embedded
    private CreationalSpecification promoCreationalSpecification;

    public PromoDiscountPart(String promoDiscountPartID, String promoID, String discountPartID, String discountPartDesc, String discountPartGroup, SatuanType satuan, Double nilaiDiscount, DataStatus promoDiscountPartStatus, CreationalSpecification promoCreationalSpecification) {
        this.promoDiscountPartID = promoDiscountPartID;
        this.promoID = promoID;
//        this.discountID = discountID;
        this.discountPartID = discountPartID;
        this.discountPartDesc = discountPartDesc;
        this.discountPartGroup = discountPartGroup;
        this.satuan = satuan;
        this.nilaiDiscount = nilaiDiscount;
        this.promoDiscountPartStatus = promoDiscountPartStatus;
        this.promoCreationalSpecification = promoCreationalSpecification;
    }

    public PromoDiscountPart() {
    }

    public String getPromoDiscountPartID() {
        return promoDiscountPartID;
    }

    public void setPromoDiscountPartID(String promoDiscountPartID) {
        this.promoDiscountPartID = promoDiscountPartID;
    }

    public String getPromoID() {
        return promoID;
    }

    public void setPromoID(String promoID) {
        this.promoID = promoID;
    }

    public String getDiscountPartID() {
        return discountPartID;
    }

    public void setDiscountPartID(String discountPartID) {
        this.discountPartID = discountPartID;
    }

    public DataStatus getPromoDiscountPartStatus() {
        return promoDiscountPartStatus;
    }

    public void setPromoDiscountPartStatus(DataStatus promoDiscountPartStatus) {
        this.promoDiscountPartStatus = promoDiscountPartStatus;
    }

    public CreationalSpecification getPromoCreationalSpecification() {
        return promoCreationalSpecification;
    }

    public void setPromoCreationalSpecification(CreationalSpecification promoCreationalSpecification) {
        this.promoCreationalSpecification = promoCreationalSpecification;
    }

    public String getDiscountPartDesc() {
        return discountPartDesc;
    }

    public void setDiscountPartDesc(String discountPartDesc) {
        this.discountPartDesc = discountPartDesc;
    }

    public SatuanType getSatuan() {
        return satuan;
    }

    public void setSatuan(SatuanType satuan) {
        this.satuan = satuan;
    }

    public Double getNilaiDiscount() {
        return nilaiDiscount;
    }

    public void setNilaiDiscount(Double nilaiDiscount) {
        this.nilaiDiscount = nilaiDiscount;
    }

//    public String getDiscountID() {
//        return discountID;
//    }
//
//    public void setDiscountID(String discountID) {
//        this.discountID = discountID;
//    }

    public String getDiscountPartGroup() {
        return discountPartGroup;
    }

    public void setDiscountPartGroup(String discountPartGroup) {
        this.discountPartGroup = discountPartGroup;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 29 * hash + Objects.hashCode(this.promoDiscountPartID);
        hash = 29 * hash + Objects.hashCode(this.promoID);
//        hash = 29 * hash + Objects.hashCode(this.discountID);
        hash = 29 * hash + Objects.hashCode(this.discountPartID);
        hash = 29 * hash + Objects.hashCode(this.discountPartDesc);
        hash = 29 * hash + Objects.hashCode(this.satuan);
        hash = 29 * hash + Objects.hashCode(this.nilaiDiscount);
        hash = 29 * hash + Objects.hashCode(this.promoDiscountPartStatus);
        hash = 29 * hash + Objects.hashCode(this.promoCreationalSpecification);
        hash = 29 * hash + Objects.hashCode(this.discountPartGroup);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final PromoDiscountPart other = (PromoDiscountPart) obj;
        if (!Objects.equals(this.promoDiscountPartID, other.promoDiscountPartID)) {
            return false;
        }
        if (!Objects.equals(this.promoID, other.promoID)) {
            return false;
        }
//        if (!Objects.equals(this.discountID, other.discountID)) {
//            return false;
//        }
        if (!Objects.equals(this.discountPartID, other.discountPartID)) {
            return false;
        }
        if (!Objects.equals(this.discountPartDesc, other.discountPartDesc)) {
            return false;
        }
        if (this.satuan != other.satuan) {
            return false;
        }
        if (!Objects.equals(this.nilaiDiscount, other.nilaiDiscount)) {
            return false;
        }
        if (this.promoDiscountPartStatus != other.promoDiscountPartStatus) {
            return false;
        }
        if (!Objects.equals(this.promoCreationalSpecification, other.promoCreationalSpecification)) {
            return false;
        }
        if (!Objects.equals(this.discountPartGroup, other.discountPartGroup)) {
            return false;
        }
        return true;
    }

    @Override
    public boolean sameIdentityAs(PromoDiscountPart t) {
        return this.equals(t);
    }
}