/*
このファイルの中身は、NTT オープンソースライセンス　バージョン 1.0（「本
契約」という）の適用を受けます。
本契約を遵守しない限り、このファイルを使用してはなりません。
本契約のコピーは、次のＵＲＬから入手できます。
【配布サイトのURL】 http://www.oss.ecl.ntt.co.jp/lms/

本契約に基づき頒布されるソフトウェアは、現状のまま、明示又は黙示のあらゆ
る種類の保証なしで、頒布されます。本契約に基づく権利及び制限を律する特定
の文言については、本契約を参照してください。

「オリジナルコード」は、 NTT Cyber Space Laboratories Code です。 
「オリジナルコード」の「初期開発者」は、日本電信電話株式会社です。  
日本電信電話株式会社により創作された部分は、Copyright (C) 2004 
日本電信電話株式会社 です。
全ての権利が留保されます。 
「コントリビュータ」：_____________________________________ 


The contents of this file are subject to the NTT Opensource License
Version 1.0 (the License); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
【配布サイトのURL】 http://www.oss.ecl.ntt.co.jp/lms/

Software distributed under the License is distributed on an AS IS
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.

The Original Code is NTT Cyber Space Laboratories Code .

The Initial Developer of the Original Code is NIPPON TELEGRAPH AND 
TELEPHONE CORPORATION.
Portions created by the NIPPON TELEGRAPH AND TELEPHONE CORPORATION 
are Copyright (C) 2004 NIPPON TELEGRAPH AND TELEPHONE CORPORATION. 
All Rights Reserved.

Contributor(s) ______________________________________.
*/

//
//	SequencingException
//	変更履歴
//		2004.02.01	新規作成
//

package jp.co.ntt.lms.lo.scorm.kernel.exception;

/**
 *  SequencingException<BR>
 *
 *  Sequencing例外<BR>
 *  シーケンシングに失敗した場合に発生する例外<BR>
 *  Control Mode, Limit Condition, Sequencing Ruleの評価等以外に<BR>
 *  遷移に失敗した場合に発生する例外<BR>
 */
public abstract class SequencingException extends Exception {

	/**
	 *    デフォルトコンストラクタ <BR>
	 */
	public SequencingException() {
		super();
	}

	/**
	 *    コンストラクタ <BR>
	 *
	 *    @param    message メッセージ
	 */
	public SequencingException(String message) {
		super(message);
	}

	/**
	 *    コンストラクタ <BR>
	 *
	 *    @param    message メッセージ
	 *    @param    cause   発生済みの例外
	 */
	public SequencingException(String message, Throwable cause) {
		super(message, cause);
	}

	/**
	 *    コンストラクタ <BR>
	 *
	 *    @param    cause   発生済みの例外
	 */
	public SequencingException(Throwable cause) {
		super(cause);
	}

	/**
	 *    コンストラクタ <BR>
	 *
	 *    @param    errorCode エラーコード
	 *    @param    errorData エラーデータ
	 *    @param    e Exception
	 */
	public static SequencingException getInstance(String errorCode, String errorData, Throwable e) throws SystemException {
		if (errorCode.equalsIgnoreCase("NB.2.1-1")) {
			return new AlreadyCurrentActivityDefinedException("Current Activity is already defined. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("NB.2.1-2")) {
			return new NotDefinedCurrentActivityException("Current Activity is not defined. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("NB.2.1-3")) {
			return new NotDefinedSuspendedActivityException("Suspended Activity is not defined. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("NB.2.1-4")) {
			return new FlowException("Flow Sequencing Control Mode violation. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("NB.2.1-5")) {
			return new FlowOrForwardOnlyException("Flow or Forward Only Sequencing Control Mode violation. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("NB.2.1-6")) {
			return new CannotPreviousException("No activity is 'previous' to the root. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("NB.2.1-7")) {
			return new UnsupportedNavigationException("Unsupported navigation request. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("NB.2.1-8")) {
			return new ChoiceExitException("Choice Exit Sequencing Control Mode violation. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("NB.2.1-9")) {
			return new NoActivityToConsiderException("No activities to consider. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("NB.2.1-10")) {
			return new ChoiceException("Choice Sequencing Control Mode violation. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("NB.2.1-11")) {
			return new ActivityNotExistException("Target activity does not exist. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("NB.2.1-12")) {
			return new AlreadyCurrentActivityTerminatedException("Current Activity already terminated. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("NB.2.1-13")) {
			return new UndefinedNavigationException("Undefined navigation request. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("TB.2.3-1")) {
			return new NotDefinedCurrentActivityException("Current Activity is not defined. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("TB.2.3-2")) {
			return new AlreadyCurrentActivityTerminatedException("Current Activity already terminated. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("TB.2.3-3")) {
			return new CannotSuspendException("Cannot suspend an inactive root. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("TB.2.3-4")) {
			return new RootHasNoParentException("Activity tree root has no parent. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("TB.2.3-5")) {
			return new NothingToSuspendException("Nothing to suspend; No active activities. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("TB.2.3-6")) {
			return new NothingAbandonException("Nothing to abandon; No active activities. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("TB.2.3-7")) {
			return new UndefinedTerminationException("Undefined termination request. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.1-1")) {
			return new LastActivityException("Last activity in the tree. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.1-2")) {
			return new ClusterHasNoAvalilableException("Cluster has no available children. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.1-3")) {
			return new CannotPreviousException("No activity is ‘previous’ to the root. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.1-4")) {
			return new ForwardOnlySequencingException("Forward Only Sequencing Control Mode violation. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.2-1")) {
			return new FlowSequencingException("Flow Sequencing Control Mode violation. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.2-2")) {
			return new ActivityUnavailableException("Activity unavailable. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.4-1")) {
			return new ForwardBlockedTraversalException("Forward Traversal Blocked. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.4-2")) {
			return new ForwardOnlySequencingException("Forward Only Sequencing Control Mode violation. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.4-3")) {
			return new CannotPreviousException("No activity is ‘previous’ to the root. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.5-1")) {
			return new AlreadyCurrentActivityDefinedException("Current Activity is already defined. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.6-1")) {
			return new AlreadyCurrentActivityDefinedException("Current Activity is already defined. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.6-2")) {
			return new NoSuspendedActivityDefinedException("No Suspended Activity defined. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.7-1")) {
			return new NotDefinedCurrentActivityException("Current Activity is not defined. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.7-2")) {
			return new FlowSequencingException("Flow Sequencing Control Mode violation. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.8-1")) {
			return new NotDefinedCurrentActivityException("Current Activity is not defined. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.8-2")) {
			return new FlowSequencingException("Flow Sequencing Control Mode violation. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.9-1")) {
			return new NoTargetForChoiceException("No target for Choice. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.9-2")) {
			return new TargetActivityUnavailableException("Target activity does not exist or is unavailable. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.9-3")) {
			return new TargetActivityHiddenException("Target activity hidden from choice. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.9-4")) {
			return new ChoiceSequencingException("Choice Sequencing Control Mode violation. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.9-5")) {
			return new NoActivityToConsiderException("No activities to consider. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.9-6")) {
			return new UnableActivateException("Unable to activate target; target is not a child of the Current Activity. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.9-7")) {
			return new ChoiceExitSequencingException("Choice Exit Sequencing Control Mode violation. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.9-8")) {
			return new UnableChoiceException("Unable to choice target activity - constrained choice. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.9-9")) {
			return new PreventedException("Choice request prevented by Flow-only activity. [ErrorCode:" + errorCode + "]" + errorData, e);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.10-1")) {
			return new NotDefinedCurrentActivityException("Current Activity is not defined. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.10-2")) {
			return new ActiveOrSuspendedException("Current Activity is active or suspended. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.10-3")) {
			return new FlowSequencingException("Flow Sequencing Control Mode violation. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.11-1")) {
			return new NotDefinedCurrentActivityException("Current Activity is not defined. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.11-2")) {
			return new CurrentActivityNotTerminatedException("Current Activity has not been terminated. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("SB.2.12-1")) {
			return new UndefinedSequencingException("Undefined sequencing request. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("DB.1.1-1")) {
			return new NonLeafActivityException("Cannot deliver a non-leaf activity. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("DB.1.1-2")) {
			return new NothingToDeliverException("Nothing to deliver. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("DB.1.1-3")) {
			return new ActivityUnavailableException("Activity unavailable. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("DB.2-1")) {
			return new AlreadyActiveException("Identified activity is already active. [ErrorCode:" + errorCode + "]" + errorData);
		}
		else if (errorCode.equalsIgnoreCase("PseudoCodeException")){
			return new PseudoCodeException("Pseudo Code Exception. [ErrorCode:" + errorCode + "]" + errorData);
		}
		throw new SystemException("Illegal error code. [ErrorCode:" + errorCode + "]");
	}
}
