public MRuleRewardDTO toDTO() { MRuleRewardDTO dto = new MRuleRewardDTO(); dto.setId(getId()); dto.setRuleId(getRuleId()); dto.setRewardValue(getRewardValue()); dto.setRewardProduct(getRewardProduct()); dto.setRewardType(getRewardType()); dto.setMaxRewards(getMaxRewards()); dto.setCurrentRewards(getCurrentRewards()); dto.setRewardsPerPerson(getRewardsPerPerson()); dto.setStatus(getStatus()); dto.setCreateUser(getCreateUser()); dto.setCreateTimestamp(getCreateTimestamp()); dto.setUpdateUser(getUpdateUser()); dto.setUpdateTimestamp(getUpdateTimestamp()); return dto; }
public static RuleReward fromDTO(MRuleRewardDTO dto) { if (dto == null) { return null; } RuleReward data = new RuleReward(); data.setId(dto.getId()); data.setRuleId(dto.getRuleId()); data.setRewardValue(dto.getRewardValue()); data.setRewardProduct(dto.getRewardProduct()); data.setRewardType(dto.getRewardType()); data.setMaxRewards(dto.getMaxRewards()); data.setCurrentRewards(dto.getCurrentRewards()); data.setRewardsPerPerson(dto.getRewardsPerPerson()); data.setStatus(dto.getStatus()); data.setCreateUser(dto.getCreateUser()); data.setCreateTimestamp(dto.getCreateTimestamp()); data.setUpdateUser(dto.getUpdateUser()); data.setUpdateTimestamp(dto.getUpdateTimestamp()); RewardType theType = RewardType.valueOf(data.getRewardType()); data.setRewardable(RewardFactory.newInstance(theType)); data.setSituation(getRewardSituation(theType)); return data; }
public void setRewardType(RewardType rewardType) { super.setRewardType(rewardType.toString()); }