package com.cim.idm.mwmsextend.checkrecord.management.action;

import java.util.HashMap;

import com.cim.idm.framework.action.info.ValidationFormat;
import com.cim.idm.framework.data.EventInfo;
import com.cim.idm.framework.data.TransitionInfo;
import com.cim.idm.framework.exception.ext.DuplicateNameSignal;
import com.cim.idm.framework.exception.ext.FrameworkErrorSignal;
import com.cim.idm.framework.orm.info.DataInfo;
import com.cim.idm.mwmsextend.checkrecord.CheckRecordServiceProxy;
import com.cim.idm.mwmsextend.checkrecord.management.data.CheckRecord;
import com.cim.idm.mwmsextend.checkrecord.management.data.CheckRecordKey;
import com.cim.idm.mwmsextend.checkrecord.management.info.CreateInfo;
import com.cim.idm.wmspackage.action.CommonAction;

public class RemoveAction extends CommonAction{
	public void remove(DataInfo oldCheckRecordData,
			DataInfo newCheckRecordData, EventInfo eventInfo,
			TransitionInfo transitionInfo,
			HashMap<String, ValidationFormat> validationList)
			throws DuplicateNameSignal, FrameworkErrorSignal {
		CheckRecord checkRecord = (CheckRecord) newCheckRecordData;
		CheckRecordKey key = checkRecord.getKey();
		CheckRecordServiceProxy.getCheckRecordService().delete(key);
	}

	public void remove(DataInfo[] oldCheckRecordDataArray, DataInfo[] newCheckRecordDataArray,
			EventInfo eventInfo, TransitionInfo[] transitionInfoArray,
			HashMap<String, ValidationFormat> validationList)
			throws DuplicateNameSignal, FrameworkErrorSignal{
		    CheckRecord[] checkRecordArray = new CheckRecord[newCheckRecordDataArray.length];
		    System.arraycopy(newCheckRecordDataArray,0,checkRecordArray,0,newCheckRecordDataArray.length);
		    CheckRecordKey[] keyArray = new CheckRecordKey[newCheckRecordDataArray.length];
		    for(int i=0;i<newCheckRecordDataArray.length;i++)
		    {
		    	keyArray[i]=checkRecordArray[i].getKey();
		    }
		    CheckRecordServiceProxy.getCheckRecordService().delete(keyArray);
	}
}
