//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.kingdee.shr.preentry.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.eas.common.EASBizException;
import com.kingdee.eas.hr.emp.app.util.SHREmpCheckCredentialsTypeUtil;
import com.kingdee.shr.preentry.PEPersonCredentialsTypeInfo;
import org.apache.log4j.Logger;

public class PEPersonCredentialsTypeControllerBean extends AbstractPEPersonCredentialsTypeControllerBean {
    private static Logger logger = Logger.getLogger("com.kingdee.shr.preentry.app.PEPersonCredentialsTypeControllerBean");

    public PEPersonCredentialsTypeControllerBean() {
    }

    protected IObjectPK _addnew(Context ctx, IObjectValue model) throws BOSException, EASBizException {
        PEPersonCredentialsTypeInfo info = (PEPersonCredentialsTypeInfo)model;
        this.checkCredentialsTypeAndNo(ctx, info);
        return super._addnew(ctx, info);
    }

    protected void _update(Context ctx, IObjectPK pk, IObjectValue model) throws BOSException, EASBizException {
        PEPersonCredentialsTypeInfo info = (PEPersonCredentialsTypeInfo)model;
        this.checkCredentialsTypeAndNo(ctx, info);
        super._update(ctx, pk, model);
    }

    protected void _delete(Context ctx, IObjectPK pk) throws BOSException, EASBizException {
        super._delete(ctx, pk);
    }

    public void checkCredentialsTypeAndNo(Context ctx, PEPersonCredentialsTypeInfo info) throws EASBizException, BOSException {
        //SHREmpCheckCredentialsTypeUtil.checkCredentialsTypeUnique(ctx, info, info.getTalent());
        String excludePreEntryBillId = info.getId() == null ? "" : info.getId().toString();
        SHREmpCheckCredentialsTypeUtil.checkCredentiaslTypeForEmp(ctx, info, excludePreEntryBillId);
        SHREmpCheckCredentialsTypeUtil.checkCredentialsTypeNoByOSF(ctx, info);
    }
}
