package com.acme.model.domain.ejf.entity;


import com.acme.structure.BaseEntity;
import com.acme.structure.BaseEntityListener;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;


@Entity(name = "JobConfiguration")
@Table(name = "MAINJOBCONFIGURATION")
//this is for oracle db @SequenceGenerator(name = "JOBCONFIGURATION_SEQ", sequenceName = "JOBCONFIGURATION_SEQ", allocationSize = 1)
@EntityListeners( { BaseEntityListener.class })
public class JobConfiguration extends BaseEntity
{
    private String jndiName;
    private String methodName;
    private String jobName;
    private String triggerName;
    private String cronExpression;
    private String description;

    public JobConfiguration()
    {
        entityName = "JobConfiguration";
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO) //, this is for oracle db, generator = "JOBCONFIGURATION_SEQ")
    @Column(name = "ID")
    public int getId()
    {
        return id;
    }

    @Override
    public void setId(int id)
    {
        this.id = id;
    }

    @Column(name = "JNDINAME")
    public String getJndiName()
    {
        return jndiName;
    }

    public void setJndiName(String jndiName)
    {
        this.jndiName = jndiName;
    }

    @Column(name = "METHODNAME")
    public String getMethodName()
    {
        return methodName;
    }

    public void setMethodName(String methodName)
    {
        this.methodName = methodName;
    }

    @Column(name = "JOBNAME")
    public String getJobName()
    {
        return jobName;
    }

    public void setJobName(String jobName)
    {
        this.jobName = jobName;
    }

    @Column(name = "TRIGGERNAME")
    public String getTriggerName()
    {
        return triggerName;
    }

    public void setTriggerName(String triggerName)
    {
        this.triggerName = triggerName;
    }

    @Column(name = "CRONEXPRESSION")
    public String getCronExpression()
    {
        return cronExpression;
    }

    public void setCronExpression(String cronExpression)
    {
        this.cronExpression = cronExpression;
    }

    @Column(name = "DESCRIPTION")
    public String getDescription()
    {
        return description;
    }

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

    @Override
    public String toString()
    {
        StringBuilder strBuilder = new StringBuilder();
        strBuilder.append(getJndiName()).append(" - ").append(getMethodName()).append(" - ").append(getCronExpression());

        return strBuilder.toString();
    }

}
