package nc.bs.pub.action;

import nc.bs.mmpac.pmo.pac0002.bp.PMOCommitBP;
import nc.bs.mmpac.pmo.pac0002.flowbiz.PMOCommitFlowCheckRule;
import nc.bs.mmpac.pmo.pac0002.pluginpoint.PMOPluginPoint;
import nc.bs.pubapp.pf.action.AbstractPfAction;
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
import nc.bs.mmpac.pmo.pac0002.bp.rule.saveBeforeCheckRule;

public class N_55A2_SAVE extends AbstractPfAction<PMOAggVO> {
	protected CompareAroundProcesser<PMOAggVO> getCompareAroundProcesserWithRules(Object userObj) {
		CompareAroundProcesser<PMOAggVO> processer = new CompareAroundProcesser<PMOAggVO>(PMOPluginPoint.COMMIT);

		addBeforeRule(processer);

		addAfterRule(processer);
		return processer;
	}

	private void addBeforeRule(CompareAroundProcesser<PMOAggVO> processer) {
		processer.addBeforeFinalRule(new PMOCommitFlowCheckRule());
		processer.addBeforeRule(new saveBeforeCheckRule());
	}

	private void addAfterRule(CompareAroundProcesser<PMOAggVO> processer) {
	}

	protected PMOAggVO[] processBP(Object userObj, PMOAggVO[] clientFullVOs, PMOAggVO[] originBills) {
		return (new PMOCommitBP()).commit(clientFullVOs, originBills);
	}
}
