/* 
    ETRI IntraPMS Project
    전자결재  결재 경로 Class

    
*/


package com.etri.groupware.eda;

import java.util.*;

public class ApprovalCourse implements Comparable {
	
	private String docID;				//문서번호
	private String personID;			//결재자의 ID
	private int sequence;				//결재 순서
	private String conditionCode;			//결재 여부
	private String description;			//결재 의견
	private int type;				//결재 형태 지정 
	private String workDate;			//결재 일자.

	//ApprovalCourse와 ApprovalDocument에서 사용하는 변수로 결재 결과를 나타냄
	final static public String REJECT = "reject";		//반려
	final static public String APPROVAL = "approval";	//결재
	final static public String NOTCOMPLETE = "notcomplete";	//미결재
	final static public String EDASUBMIT = "submit";	//상신
	final static public String ABORT = "abort";		//상신취소
	
	//결재 형태를 나타냄(type)
	final static public int SUBMIT = 0 ;			//상신
	final static public int SUBMITAPPROVAL = 1 ;		//결재
	final static public int SUBMITINFORM = 2 ;		//통보
	
	/* default constructor . */
	public ApprovalCourse() {
		super();
	}

	public ApprovalCourse( String docID , String personID , int sequence , String conditionCode , int type) {
		this.docID = docID;
		this.personID = personID;
		this.sequence = sequence;
		this.conditionCode = conditionCode;
		this.type=type;
	}
	
	
	public ApprovalCourse( String docID , String personID , int sequence , String conditionCode 
 	 , String description, int type) {
		this.docID = docID;
		this.personID = personID;
		this.sequence = sequence;
		this.conditionCode = conditionCode;
		this.description = description;
		this.type = type;
	}

	public ApprovalCourse( String docID , String personID , int sequence , String conditionCode 
  	 , String description, int type, String workDate ) {
		this.docID = docID;
		this.personID = personID;
		this.sequence = sequence;
		this.conditionCode = conditionCode;
		this.description = description;
		this.type = type;
		this.workDate = workDate;
	}
	
	/* member variable의 get method */
	
	public String getdocID() {
		return docID;
	}

	public String getpersonID() {
		return personID;
	}

	public int getsequence() {
		return sequence;
	}
	
	public String getconditionCode(){
		return conditionCode;
	}
	
	public String getdescription(){
		return description;
	}
	
	public int gettype(){
		return type;
	}
	
	public String getworkDate(){
		return workDate;
	}
		
	/* member variable 의 set method */
	
	public void setdocID(String docID) {
		this.docID = docID;
	}
	
	public void setpersonID(String personID) {
		this.personID = personID;
	}
	
	public void setsequence(int sequence) {
		this.sequence = sequence;
	}
	
	public void setconditionCode(String conditionCode) {
		this.conditionCode = conditionCode;
	}
	
	public void setdescription(String description) {
		this.description = description;
	}
	
	public void settype(int type) {
		this.type = type;
	}
	
	public void setworkDate(String workDate){
		this.workDate = workDate;
	}
	
/*----------------------------------------------------------------- */
/**
 [메소드이름]: equals<br>
 [기능]: ApprovalCourse 간의 비교.<br>
 [파라미터]: ApprovalCourse temp<br>
 [호출자] : this<br>
 */
/*--------------------------------------------------------------- */
	public boolean equals( ApprovalCourse temp ){
		if( this.docID != temp.getdocID() )
			return false;
		else if( this.personID != temp.getpersonID() )
			return false;
		else if( this.sequence != temp.getsequence() )
			return false;
		else if( this.conditionCode != temp.getconditionCode() )
			return false;
		else if( this.description != temp.getdescription() )
			return false;
		else if( this.type != temp.gettype() )
			return false;
		else
			return true;
	}

/*----------------------------------------------------------------- */
/**
 [메소드이름]: compareTo<br>
 [기능]: ApprovalCourse간에 순서를 비교한다.<br>
 [파라미터]: Object pObj<br>
 [호출자] : this<br>
 */
/*--------------------------------------------------------------- */
	public int compareTo( Object pObj ){
		int val = ( ( ApprovalCourse) pObj ).getsequence();
		if( this.sequence < val )
			return -1;
		else if( this.sequence > val )
			return 1;
		else
			return 0;
	}
		
} 