All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.quamto.jira.data.time.entity.UnavailableDatesEntity Maven / Gradle / Ivy

The newest version!
package com.quamto.jira.data.time.entity;

import com.quamto.entity.BaseEntity;
import com.quamto.jira.data.common.JEnumerators;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by QUAMTO-DEV2 on 16/09/2016.
 */
public class UnavailableDatesEntity extends BaseEntity {
    /**
     * uda_id_owner, uda_id_user, uda_start_date, uda_time
     * uda_repeat_pattern, uda_finish_date
     */

    private String idUser = null;
    private Timestamp startDate = null;
    private Double time = null;
    private RepeatPatterns repeatPattern = null;
    private Timestamp finishDate = null;
    private String description = null;
    private Timestamp endDate = null;

    private Long idOwner = null;

    public String getDescription() { return description; }

    public void setDescription(String description) { this.description = description;  }

    public Timestamp getEndDate() { return endDate; }

    public void setEndDate(Timestamp endDate) { this.endDate = endDate; }

    public String getIdUser() {
        return idUser;
    }

    public void setIdUser(String idUser) {
        this.idUser = idUser;
    }

    public Timestamp getStartDate() {
        return startDate;
    }

    public void setStartDate(Timestamp startDate) {
        this.startDate = startDate;
    }

    public Double getTime() {
        return time;
    }

    public void setTime(Double time) {
        this.time = time;
    }

    public RepeatPatterns getRepeatPattern() {
        return repeatPattern;
    }

    public void setRepeatPattern(RepeatPatterns repeatPattern) {
        this.repeatPattern = repeatPattern;
    }

    public Timestamp getFinishDate() {
        return finishDate;
    }

    public void setFinishDate(Timestamp finishDate) {
        this.finishDate = finishDate;
    }

    public int getRepeatPatternInt() {
        return repeatPattern.getInt();
    }

    public Long getIdOwner() {
        return idOwner;
    }

    public void setIdOwner(Long idOwner) {
        this.idOwner = idOwner;
    }

    /**
     * Define the Jhagi Modules
     *
     * @author jholguin
     *
     */
    public enum RepeatPatterns{

        None(0),
        Daily(1),
        Weekly(2),
        Monthly(3);

        private final int intValue;
        private final String description;

        private RepeatPatterns(int value){
            this.intValue = value;

            switch (value) {
                case 0:
                    this.description = "None";
                    break;
                case 1:
                    this.description = "Daily";
                    break;
                case 2:
                    this.description = "Weekly";
                    break;
                case 3:
                    this.description = "Monthly";
                    break;
                default:
                    this.description = "";
                    break;
            }
        }

        public int getInt(){
            return intValue;
        }

        public String getDescription(){
            return description;
        }

        /**
         * Gets enum value mapped from integer value
         * @param value Integer Value
         * @return Enum value mapped
         */
        public RepeatPatterns getEnumValue(int value){

            RepeatPatterns enumValue = null;

            switch (value) {
                case 0:
                    enumValue = None;
                    break;
                case 1:
                    enumValue = Daily;
                    break;
                case 2:
                    enumValue = Weekly;
                    break;
                case 3:
                    enumValue = Monthly;
                    break;
            }
            return enumValue;
        }

        /**
         *
         * @return Gets a Map with the enum values and descriptions
         */
        public Map getMapEnumValues(){

            Map mapEnum = new HashMap();

            for (RepeatPatterns type : RepeatPatterns.values()) {
                mapEnum.put(type, type.getDescription());
            }
            return mapEnum;
        }

        /**
         *
         * @return Gets a Map with the integer values and descriptions
         */
        public Map getMapIntValues(){

            Map mapEnum = new HashMap();

            for (RepeatPatterns type : RepeatPatterns.values()) {
                mapEnum.put(type.getInt(), type.getDescription());
            }
            return mapEnum;
        }

        /**
         * @return Gets a Hashmap with the string values
         */
        public List> getListEnum(){

            List> list = new ArrayList>();

            for (RepeatPatterns moduleIdentifier : RepeatPatterns.values()) {

                HashMap mapEnum = new HashMap();
                mapEnum.put("name", moduleIdentifier.name());
                mapEnum.put("description", moduleIdentifier.getDescription());
                list.add(mapEnum);
            }
            return list;
        }

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy