
package nc.bs.pub.action;

import nc.bs.framework.common.NCLocator;
import nccloud.bs.ic.ic.aggbusi.plugin.bpplugin.NccsynergyPluginPoint;
import nc.bs.pubapp.pf.action.AbstractPfAction;
import nc.bs.pubapp.pub.rule.UncommitStatusCheckRule;
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
import nc.itf.ic.ic.INccsynergyMaintain;
import nc.vo.sap.syproconfig.AggSyProConfigVO;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;

public class N_4008_UNSAVEBILL extends AbstractPfAction<AggSyProConfigVO> {

        @Override
        protected CompareAroundProcesser<AggSyProConfigVO> getCompareAroundProcesserWithRules(
                        Object userObj) {
                CompareAroundProcesser<AggSyProConfigVO> processor = new CompareAroundProcesser<AggSyProConfigVO>(
                                NccsynergyPluginPoint.UNSEND_APPROVE);
                // TODO 在此处添加前后规则
                processor.addBeforeRule(new UncommitStatusCheckRule());

                return processor;
        }

        @Override
        protected AggSyProConfigVO[] processBP(Object userObj,
                        AggSyProConfigVO[] clientFullVOs, AggSyProConfigVO[] originBills) {
                INccsynergyMaintain operator = NCLocator.getInstance().lookup(
                                INccsynergyMaintain.class);
                AggSyProConfigVO[] bills = null;
                try {
                        bills = operator.unsave(clientFullVOs, originBills);
                } catch (BusinessException e) {
                        ExceptionUtils.wrappBusinessException(e.getMessage());
                }
                return bills;
        }

}
