package com.kingdee.eas.basedata.org.app;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.dao.IObjectValue;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.eas.basedata.org.PositionInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.synctask.SyncTranForOAFacadeFactory;
import org.apache.log4j.Logger;

public class PositionControllerBeanEx extends PositionControllerBean{

    private static Logger logger =
            Logger.getLogger(PositionControllerBeanEx.class);

    @Override
    protected IObjectPK _addnew(Context ctx, IObjectValue model) throws BOSException, EASBizException {
        logger.error("PositionControllerBeanEx--------------------_addnew");
        IObjectPK iObjectPK = super._addnew(ctx, model);
        PositionInfo info = (PositionInfo) model;
        String id = info.getId().toString();
        //同步岗位到OA
        SyncTranForOAFacadeFactory.getLocalInstance(ctx).syncPositionToOA(id, null);
        return iObjectPK;
    }

    @Override
    protected void _update(Context ctx, IObjectPK pk, IObjectValue model) throws BOSException, EASBizException {
        super._update(ctx, pk, model);
        logger.error("PositionControllerBeanEx--------------------_update");
        //同步岗位到OA
        SyncTranForOAFacadeFactory.getLocalInstance(ctx).syncPositionToOA(pk.toString(), null);
    }

    @Override
    protected void _updatePartial(Context ctx, IObjectValue model, SelectorItemCollection selector) throws BOSException, EASBizException {
        super._updatePartial(ctx, model, selector);
        logger.error("PositionControllerBeanEx--------------------_updatePartial");
        PositionInfo info = (PositionInfo) model;
        String id = info.getId().toString();
        //同步岗位到OA
        SyncTranForOAFacadeFactory.getLocalInstance(ctx).syncPositionToOA(id, null);
    }
}
