package com.eactive.eai.rms.onl.common.vo;

import java.io.Serializable;

import org.apache.commons.collections.Factory;
import org.apache.log4j.Logger;

public class BaseForm
        implements Serializable {
    private String transaction = null;
    private int pageNum = 0;
    private int totalCount = 0;
    
    private static Logger logger = Logger.getLogger(BaseForm.class);

    /**
     * DTO Factory
     * 
     * @author pksup
     * @since 1.0
     */
    protected class DtoFactory
            implements Factory {
        private Class clazz = null;

        public DtoFactory(Class clazz) {
            this.clazz = clazz;
        }

        public Object create() {
            Object obj = null;
            try {
                obj = clazz.newInstance();
            } catch (Exception e) {
            	//취약점소스 수정 2020.08.24
            	logger.error(" error", e); 
            }
            return obj;
        }
    }

    /**
     * @author pksup
     * @since 1.0
     * @param clazz
     * @return
     */
    protected Factory getDtoFactory(Class clazz) {
        return new DtoFactory(clazz);
    }

    public boolean hasTransaction() {
        if (transaction == null) {
            return false;
        } else if (transaction.equals("")) {
            return false;
        } else {
            return true;
        }
    }

    public boolean hasTransaction(String transaction) {
        if (hasTransaction()) {
            return this.getTransaction().equals(transaction);
        } else {
            return false;
        }
    }

    /** @return Returns the transaction. */
    public String getTransaction() {
        return transaction;
    }

    /** @param transaction The transaction to set. */
    public void setTransaction(String transaction) {
        this.transaction = transaction;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }
}
