package com.cim.idm.mwmsextend.generic.util;

/*import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

import kr.co.aim.nanoframe.IDMFrameServiceProxy;
import kr.co.aim.nanotrack.generic.exception.DuplicateNameSignal;
import kr.co.aim.nanotrack.generic.exception.FrameworkErrorSignal;
import kr.co.aim.nanotrack.generic.exception.NotFoundSignal;

import org.apache.commons.collections.MapIterator;
import org.apache.commons.collections.map.ListOrderedMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class NameGenerateUtilForProduct implements ApplicationContextAware {

	private ApplicationContext applicationContext;

	private String lastSerialNo = null;
	private String lastSplitlNo = null;
	private String prefix = null;

	
	* Name : TempRuleAttrDef
	* Desc : This function is TempRuleAttrDef
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private class TempRuleAttrDef {
		public String getRuleName() {
			return ruleName;
		}

		public void setRuleName(String ruleName) {
			this.ruleName = ruleName;
		}

		public String getPrefix() {
			return prefix;
		}

		public void setPrefix(String prefix) {
			this.prefix = prefix;
		}

		public String getSectionValue() {
			return sectionValue;
		}

		public void setSectionValue(String sectionValue) {
			this.sectionValue = sectionValue;
		}

		public long getSectionLength() {
			return sectionLength;
		}

		public void setSectionLength(long sectionLength) {
			this.sectionLength = sectionLength;
		}

		public String getExceptionalCharacter() {
			return exceptionalCharacter;
		}

		public void setExceptionalCharacter(String exceptionalCharacter) {
			this.exceptionalCharacter = exceptionalCharacter;
		}

		public String getSectionType() {
			return sectionType;
		}

		public void setSectionType(String sectionType) {
			this.sectionType = sectionType;
		}

		String ruleName;
		String prefix;
		String sectionValue;
		long sectionLength;
		String exceptionalCharacter;
		String sectionType;
	}

	
	* Name : setApplicationContext
	* Desc : This function is setApplicationContext
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	@Override
	public void setApplicationContext(ApplicationContext arg0)
			throws BeansException {
		// TODO Auto-generated method stub

	}

	
	* Name : generateName
	* Desc : This function is generateName
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	public ArrayList<String> generateName(String ruleName, String quantity,
			String lotName, String updateFlag) {

		this.lastSerialNo = null;
		this.lastSplitlNo = null;

		ArrayList<TempRuleAttrDef> productList = new ArrayList<TempRuleAttrDef>();

		String usrSql = "SELECT RULENAME, SECTIONNAME, POSITION, SECTIONCATEGORY, SECTIONTYPE, SECTIONLENGTH, SECTIONVALUE, EXCEPTIONALCHARACTER "
				+ "FROM NAMEGENERATORRULEATTRDEF where ruleName = ? ";

		String[] Sqlargs = new String[] { ruleName };

		List resultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(
				usrSql, Sqlargs);

		for (int i = 0; i < resultList.size(); i++) {
			ListOrderedMap orderMap = (ListOrderedMap) resultList.get(i);
			MapIterator map = orderMap.mapIterator();

			TempRuleAttrDef tmpRuleAttrDef = new TempRuleAttrDef();

			while (map.hasNext()) {
				String Key = (String) map.next();

				if (StringUtils.equals(Key, "RULENAME"))
					tmpRuleAttrDef.ruleName = (String) map.getValue();
				else if (StringUtils.equals(Key, "SECTIONLENGTH"))
					tmpRuleAttrDef.sectionLength = Long.parseLong(String
							.valueOf(map.getValue()));
				else if (StringUtils.equals(Key, "SECTIONVALUE"))
					tmpRuleAttrDef.sectionValue = (String) map.getValue();
				else if (StringUtils.equals(Key, "SECTIONTYPE"))
					tmpRuleAttrDef.sectionType = (String) map.getValue();
				else if (StringUtils.equals(Key, "EXCEPTIONALCHARACTER"))
					tmpRuleAttrDef.exceptionalCharacter = (String) map
							.getValue();
			}
			// tmpRuleAttrDef.prefix = lotName;
			productList.add(tmpRuleAttrDef);
		}

		ArrayList<String> nameList = new ArrayList<String>();
		TempRuleAttrDef tmpRuleAttrDef = new TempRuleAttrDef();

		List<String> args = new ArrayList<String>();
		args.add(lotName);

		updateSectionValue(productList, args);

		for (int i = 0; i < Integer.parseInt(quantity); i++) {
			StringBuilder nameBuilder = new StringBuilder();

			for (int j = 0; j < resultList.size(); j++) {
				tmpRuleAttrDef = productList.get(j);
				if (StringUtils.equals(tmpRuleAttrDef.sectionType, "Serial")) {

					String serialNo = this.nextSerialNo(tmpRuleAttrDef,
							updateFlag);
					nameBuilder.append(serialNo);
				} else if (StringUtils.equals(tmpRuleAttrDef.sectionType,
						"Split")) {

					String serialNo = this.nextSplitNo(tmpRuleAttrDef,
							updateFlag);
					nameBuilder.append(serialNo);
				}
			}
			nameList.add(nameBuilder.toString());
		}
		return nameList;

	}

	
	* Name : nextSerialNo
	* Desc : This function is nextSerialNo
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private String nextSerialNo(TempRuleAttrDef tmpRuleAttrDef,
			String updateFlag) throws FrameworkErrorSignal, NotFoundSignal,
			DuplicateNameSignal {

		String currentSequence = null;

		String usrSql = "SELECT RULENAME ,PREFIX ,LASTSERIALNO  FROM NAMEGENERATORSERIAL "
				+ "WHERE RULENAME = ? AND PREFIX = ?";

		String[] args = new String[] { tmpRuleAttrDef.ruleName, this.prefix };

		List resultList = null;

		resultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(
				usrSql, args);

		if (resultList.size() == 0) {

			if (this.lastSerialNo == null) {
				currentSequence = initializeNewSerialNo(
						tmpRuleAttrDef.sectionValue,
						tmpRuleAttrDef.sectionLength);
				this.lastSerialNo = currentSequence;

				if (StringUtils.equals(updateFlag, "1")) {
					String insSql = "insert  into nameGeneratorSerial (rulename, prefix, lastserialno)  values (?,?,?)";
					String[] args1 = new String[] { tmpRuleAttrDef.ruleName,
							this.prefix, currentSequence };
					IDMFrameServiceProxy.getSqlTemplate()
							.update(insSql, args1);
					this.lastSerialNo = null;
				}

				return (this.prefix + currentSequence);
			}

		} else {
			ListOrderedMap orderMap = (ListOrderedMap) resultList.get(0);
			MapIterator map = orderMap.mapIterator();

			if (this.lastSerialNo == null) {
				while (map.hasNext()) {
					String Key = (String) map.next();
					if (StringUtils.equals(Key, "LASTSERIALNO"))
						this.lastSerialNo = (String) map.getValue();
				}
			}
		}
		// Generate Name

		if (StringUtils.equals(tmpRuleAttrDef.sectionValue, "Numeric")) {
			currentSequence = nextNumeric(this.lastSerialNo, tmpRuleAttrDef);
		}

		else if (StringUtils.equals(tmpRuleAttrDef.sectionValue,
				"AlphaNumeric1st36Notation")) {
			currentSequence = nextAlphaNumeric1st36(this.lastSerialNo,
					tmpRuleAttrDef, true);
		}

		else if (StringUtils.equals(tmpRuleAttrDef.sectionValue,
				"AlphaNumeric1st36NotationExA00")) {
			currentSequence = nextAlphaNumeric1st36(this.lastSerialNo,
					tmpRuleAttrDef, false);
		}

		else if (StringUtils.equals(tmpRuleAttrDef.sectionValue,
				"AlphaNumericNotation")) {
			currentSequence = nextAlphaNumeric(this.lastSerialNo,
					tmpRuleAttrDef, true);
		}

		else if (StringUtils.equals(tmpRuleAttrDef.sectionValue,
				"AlphaNumericNotationExA00")) {
			currentSequence = nextAlphaNumeric(this.lastSerialNo,
					tmpRuleAttrDef, false);
		}

		else if (StringUtils.equals(tmpRuleAttrDef.sectionValue, "Alpha")) {
			currentSequence = nextAlphabet(this.lastSerialNo, tmpRuleAttrDef);
		}

		if (StringUtils.equals(updateFlag, "1")) {
			String uptSql = "update nameGeneratorSerial set lastserialno=? where rulename =? and prefix = ?";
			String[] args1 = new String[] { currentSequence,
					tmpRuleAttrDef.ruleName, this.prefix };
			IDMFrameServiceProxy.getSqlTemplate().update(uptSql, args1);
			this.lastSerialNo = null;
		}

		else {
			this.lastSerialNo = currentSequence;
		}

		return (this.prefix + currentSequence);

	}

	
	* Name : initializeNewSerialNo
	* Desc : This function is initializeNewSerialNo
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private String initializeNewSerialNo(String sectionValue, long sectionLength) {

		StringBuilder serialNo = new StringBuilder();
		if (StringUtils.equals(sectionValue, "Alpha")) {
			for (int i = 0; i < sectionLength - 1; i++) {
				serialNo.append("A");
			}
			serialNo.append("A");
		} else {
			for (int i = 0; i < sectionLength - 1; i++) {
				serialNo.append("0");
			}
			serialNo.append("1");
		}
		return serialNo.toString();

	}

	
	* Name : nextAlphabet
	* Desc : This function is nextAlphabet
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private String nextAlphabet(String serialNo, TempRuleAttrDef tempRuleAttrDef)
			throws FrameworkErrorSignal {

		if (checkAllZ(serialNo, tempRuleAttrDef.sectionLength)) {
			throw new FrameworkErrorSignal("");
		}

		char[] cs = serialNo.toCharArray();
		for (int i = cs.length - 1; i >= 0; i--) {
			if (isAlphabet(cs[0]) && cs[i] == 'Z') {
				cs[i] = 'A';
			} else {
				cs[i] += 1;
				cs[i] = checkException(cs[i],
						tempRuleAttrDef.exceptionalCharacter);
				break;
			}
		}
		return new String(cs);
	}

	
	* Name : nextNumeric
	* Desc : This function is nextNumeric
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private String nextNumeric(String serialNo, TempRuleAttrDef tempRuleAttrDef)
			throws FrameworkErrorSignal {

		if (checkAllNine(serialNo, tempRuleAttrDef.sectionLength)) {
			throw new FrameworkErrorSignal("Over Number count");
		}

		char[] cs = serialNo.toCharArray();
		for (int i = cs.length - 1; i >= 0; i--) {
			if (cs[i] == '9') {
				cs[i] = '0';
			} else {
				cs[i] += 1;
				cs[i] = checkException(cs[i],
						tempRuleAttrDef.exceptionalCharacter);
				break;
			}
		}
		return new String(cs);

	}

	
	* Name : createSplitNo
	* Desc : This function is createSplitNo
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private String createSplitNo(TempRuleAttrDef tmpRuleAttrDef,
			String updateFlag) throws FrameworkErrorSignal, DuplicateNameSignal {

		StringBuilder splitNoBuilder = new StringBuilder(
				(int) tmpRuleAttrDef.sectionLength);
		for (int i = 0; i < tmpRuleAttrDef.sectionLength; i++) {
			splitNoBuilder.append('0');
		}
		this.lastSplitlNo = splitNoBuilder.toString();

		if (StringUtils.equals(updateFlag, "1")) {
			String insSql = "insert  into nameGeneratorSplit (rulename, prefix, lastsplitno)  values (?,?,?)";
			String[] args1 = new String[] { tmpRuleAttrDef.ruleName,
					this.prefix, this.lastSplitlNo };
			IDMFrameServiceProxy.getSqlTemplate().update(insSql, args1);
			this.lastSerialNo = null;
		}

		return this.lastSplitlNo;

	}

	
	* Name : nextSplitNo
	* Desc : This function is nextSplitNo
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private String nextSplitNo(TempRuleAttrDef tmpRuleAttrDef, String updateFlag)
			throws FrameworkErrorSignal, NotFoundSignal, DuplicateNameSignal {

		String usrSql = "SELECT RULENAME ,PREFIX ,LASTSPLITNO  FROM NAMEGENERATORSPLIT "
				+ "WHERE RULENAME = ? AND PREFIX = ?";

		String currentSequence = null;

		String[] args = new String[] { tmpRuleAttrDef.ruleName, this.prefix };

		List resultList = IDMFrameServiceProxy.getSqlTemplate().queryForList(
				usrSql, args);

		if (resultList.size() == 0) {

			if (this.lastSplitlNo == null) {
				currentSequence = createSplitNo(tmpRuleAttrDef, updateFlag);
				this.lastSplitlNo = currentSequence;

				if (StringUtils.equals(updateFlag, "1")) {
					String insSql = "insert  into nameGeneratorSplit (rulename, prefix, lastSplitNo)  values (?,?,?)";
					String[] args1 = new String[] { tmpRuleAttrDef.ruleName,
							this.prefix, currentSequence };
					IDMFrameServiceProxy.getSqlTemplate()
							.update(insSql, args1);
					this.lastSplitlNo = null;
				}

				return (this.prefix + currentSequence);
			}

		} else {
			ListOrderedMap orderMap = (ListOrderedMap) resultList.get(0);
			MapIterator map = orderMap.mapIterator();

			if (this.lastSplitlNo == null) {
				while (map.hasNext()) {
					String Key = (String) map.next();
					if (StringUtils.equals(Key, "LASTSPLITNO"))
						this.lastSplitlNo = (String) map.getValue();
				}
			}
		}

		char[] cs = lastSplitlNo.toCharArray();
		for (int i = cs.length - 1; i >= 0; i--) {
			if (cs[i] == '9') {
				cs[i] = '0';
			} else {
				cs[i] += 1;
				break;
			}
		}
		currentSequence = String.valueOf(cs);

		if (StringUtils.equals(updateFlag, "1")) {
			String uptSql = "update NAMEGENERATORSPLIT set LASTSPLITNO=? where rulename =? and prefix = ?";
			String[] args1 = new String[] { currentSequence,
					tmpRuleAttrDef.ruleName, this.prefix };
			IDMFrameServiceProxy.getSqlTemplate().update(uptSql, args1);
			this.lastSplitlNo = null;
		}

		else {
			this.lastSplitlNo = currentSequence;
		}

		return this.prefix + currentSequence;
	}

	
	* Name : nextAlphaNumeric1st36
	* Desc : This function is nextAlphaNumeric1st36
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private String nextAlphaNumeric1st36(String serialNo,
			TempRuleAttrDef tempRuleAttrDef, boolean endByZero)
			throws FrameworkErrorSignal {

		if (tempRuleAttrDef.sectionLength == 1) {
			if ("9".equals(serialNo)) {
				throw new FrameworkErrorSignal("Over Serial Numbner");
			}
		} else if (checkAllNine(serialNo.substring(1),
				tempRuleAttrDef.sectionLength - 1)) {
			if (serialNo.charAt(0) == '9') {
				return createAlphaNemericStartWithAlphabet(
						tempRuleAttrDef.sectionLength, endByZero);
			} else if (serialNo.charAt(0) == 'Z') {
				throw new FrameworkErrorSignal("Over Alphabet Count");
			}
		}

		char[] cs = serialNo.toCharArray();
		for (int i = serialNo.length() - 1; i >= 0; i--) {
			if (cs[i] == '9') {
				cs[i] = '0';
			} else {
				cs[i] += 1;
				cs[i] = checkException(cs[i],
						tempRuleAttrDef.exceptionalCharacter);
				break;
			}
		}
		return new String(cs);

	}

	
	* Name : nextAlphaNumeric
	* Desc : This function is nextAlphaNumeric
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private String nextAlphaNumeric(String serialNo,
			TempRuleAttrDef tempRuleAttrDef, boolean endByZero)
			throws FrameworkErrorSignal {

		if (tempRuleAttrDef.sectionLength == 1) {
			if ("Z".equals(serialNo)) {
				throw new FrameworkErrorSignal("Over Alphabet count");
			}
		} else if (checkAllZ(serialNo.substring(1),
				tempRuleAttrDef.sectionLength - 1)) {
			if (serialNo.charAt(0) == '9') {
				return createAlphaNemericStartWithAlphabet(
						tempRuleAttrDef.sectionLength, endByZero);
			} else if (serialNo.charAt(0) == 'Z') {
				throw new FrameworkErrorSignal("Over Alphabet count");
			}
		}

		char[] cs = serialNo.toCharArray();
		for (int i = cs.length - 1; i >= 0; i--) {
			if (cs[i] == 'Z') {
				cs[i] = '0';
			} else if (cs[i] == '9') {
				cs[i] = 'A';
				break;
			} else {
				cs[i] += 1;
				cs[i] = checkException(cs[i],
						tempRuleAttrDef.exceptionalCharacter);
				break;
			}
		}
		return new String(cs);

	}

	
	* Name : nextAlphaNumeric
	* Desc : This function is nextAlphaNumeric
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private String createAlphaNemericStartWithAlphabet(long sectionLength,
			boolean endByZero) {

		if (sectionLength == 1)
			return "A";

		StringBuilder snBuilder = new StringBuilder((int) sectionLength);
		snBuilder.append("A");
		for (int i = 1; i < sectionLength - 1; i++) {
			snBuilder.append("0");
		}

		if (endByZero)
			snBuilder.append("0");
		else
			snBuilder.append("1");

		return snBuilder.toString();

	}

	
	* Name : checkAllNine
	* Desc : This function is checkAllNine
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private boolean checkAllNine(String tmpString, long tmpStringLength) {

		for (int i = 0; i < tmpStringLength; i++) {
			if (tmpString.charAt(i) != '9')
				return false;
		}
		return true;
	}

	
	* Name : checkAllZ
	* Desc : This function is checkAllZ
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private boolean checkAllZ(String tmpString, long tmpStringLength) {

		for (int i = 0; i < tmpStringLength; i++) {
			if (tmpString.charAt(i) != 'Z')
				return false;
		}
		return true;
	}

	
	* Name : isAlphabet
	* Desc : This function is isAlphabet
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private boolean isAlphabet(char tmpString) {
		return (StringUtils.isAlpha(String.valueOf(tmpString)));
	}

	
	* Name : checkException
	* Desc : This function is checkException
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private char checkException(char tmpString, String exceptionString) {

		if (StringUtils.equals(String.valueOf(tmpString), exceptionString))
			return exceptionString.charAt(0);
		else
			return tmpString;
	}

	
	* Name : updateSectionValue
	* Desc : This function is updateSectionValue
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private void updateSectionValue(ArrayList<TempRuleAttrDef> allRuleAttrDefs,
			List<String> argSeq) throws FrameworkErrorSignal {

		int argCnt = 0;

		TempRuleAttrDef tmpRuleAttrDef;

		for (int j = 0; j < allRuleAttrDefs.size(); j++) {
			tmpRuleAttrDef = allRuleAttrDefs.get(j);

			if (StringUtils.equals(tmpRuleAttrDef.sectionType, "Argument")) {
				String arg = argSeq.get(argCnt++);
				updateArgumentSectionValue(tmpRuleAttrDef, arg);
			} else if (StringUtils.equals(tmpRuleAttrDef.sectionType,
					"Constant")) {
				updateConstantSectionValue(tmpRuleAttrDef);
			} else if (StringUtils.equals(tmpRuleAttrDef.sectionType, "Year")) {
				updateYearSectionValue(tmpRuleAttrDef);
			} else if (StringUtils.equals(tmpRuleAttrDef.sectionType, "Month")) {
				updateMonthSectionValue(tmpRuleAttrDef);
			} else if (StringUtils.equals(tmpRuleAttrDef.sectionType, "Day")) {
				updateDaySectionValue(tmpRuleAttrDef);
			}
		}

	}

	
	* Name : updateArgumentSectionValue
	* Desc : This function is updateArgumentSectionValue
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private void updateArgumentSectionValue(TempRuleAttrDef ruleAttrDef,
			String arg) throws FrameworkErrorSignal {

		if (StringUtils.isEmpty(ruleAttrDef.getSectionValue())) {

			if (arg.length() < ruleAttrDef.getSectionLength()) {
				throw new FrameworkErrorSignal("Over data Length");

			}

			this.prefix = (arg.substring(0, (int) ruleAttrDef
					.getSectionLength()));

		} else if (ruleAttrDef.getSectionValue().toLowerCase().startsWith(
				"substr")) {

			int begin = Integer.parseInt(ruleAttrDef.getSectionValue()
					.substring(6));

			if (arg.length() < begin + ruleAttrDef.getSectionLength()) {
				throw new FrameworkErrorSignal("Section Length is smaller than argument value");

			}

			this.prefix = (arg.substring(begin, begin
					+ (int) ruleAttrDef.getSectionLength()));

		}
	}

	
	* Name : updateConstantSectionValue
	* Desc : This function is updateConstantSectionValue
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private void updateConstantSectionValue(TempRuleAttrDef ruleAttrDef)
			throws FrameworkErrorSignal {
		if (ruleAttrDef.getSectionValue().length() < ruleAttrDef
				.getSectionLength()) {
			throw new FrameworkErrorSignal("Section Value's length is smaller than Section Length");

		}

		this.prefix = (ruleAttrDef.getSectionValue().substring(0,
				(int) ruleAttrDef.getSectionLength()));
	}

	
	* Name : updateYearSectionValue
	* Desc : This function is updateYearSectionValue
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private void updateYearSectionValue(TempRuleAttrDef ruleAttrDef)
			throws FrameworkErrorSignal {

		if (ruleAttrDef.getSectionLength() > 4) {
			throw new FrameworkErrorSignal("Section Length is bigger than 4");

		}

		String year = "" + Calendar.getInstance().get(Calendar.YEAR);
		int secLength = (int) ruleAttrDef.getSectionLength();
		this.prefix = (year.substring(4 - secLength, secLength));
	}

	
	* Name : updateMonthSectionValue
	* Desc : This function is updateMonthSectionValue
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private void updateMonthSectionValue(TempRuleAttrDef ruleAttrDef)
			throws FrameworkErrorSignal {

		if (ruleAttrDef.getSectionLength() > 2) {
			throw new FrameworkErrorSignal("Section Length is bigger than 2");

		}

		int month = Calendar.getInstance().get(Calendar.MONTH) + 1;
		if (ruleAttrDef.getSectionLength() == 1) {
			if (month < 10) {
				this.prefix = ("" + month);
			} else {
				char c = ruleAttrDef.getSectionValue().charAt(month - 10);
				c = checkException(c, ruleAttrDef.getExceptionalCharacter());
				this.prefix = (new String(new char[] { c }));
			}
		} else {
			if (month < 10) {
				this.prefix = ("0" + month);
			} else {
				this.prefix = ("" + month);
			}
		}
	}

	
	* Name : updateDaySectionValue
	* Desc : This function is updateDaySectionValue
	* Author : ZXY IDM Team
	* Date : 2011.04.05
	
	private void updateDaySectionValue(TempRuleAttrDef ruleAttrDef)
			throws FrameworkErrorSignal {

		if (ruleAttrDef.getSectionLength() > 2) {
			throw new FrameworkErrorSignal("Section Length is bigger than 2");

		}

		int day = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
		if (ruleAttrDef.getSectionLength() == 1) {
			if (day < 10) {
				this.prefix = ("" + day);
			} else {
				char c = 'A';
				c += (day - 10 + 1);
				c = checkException(c, ruleAttrDef.getExceptionalCharacter());
				this.prefix = (new String(new char[] { c }));
			}
		} else {
			if (day < 10) {
				this.prefix = ("0" + day);
			} else {
				this.prefix = ("" + day);
			}
		}
	}
}
*/