import org.blueoxygen.cimande.LogInformation;
import org.blueoxygen.postila.materialmanagement.productattributes.entity.LotControl;
public class SaveLotControl extends LotControlForm {
public String execute(){
LotControl lotControl;
if(getLotControl().getId() == null && "".equalsIgnoreCase(getLotControl().getId())){
lotControl = new LotControl();
logInfo = new LogInformation();
logInfo.setCreateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setCreateDate(new Timestamp(System.currentTimeMillis()));
} else {
lotControl = (LotControl) manager.getById(LotControl.class, getLotControl().getId());
logInfo = lotControl.getLogInformation();
}
logInfo.setActiveFlag(getActive());
logInfo.setLastUpdateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setLastUpdateDate(new Timestamp(System.currentTimeMillis()));
lotControl.setLogInformation(logInfo);
lotControl.setName(getLotControl().getName());
lotControl.setDescription(getLotControl().getDescription());
lotControl.setStartNo(getLotControl().getStartNo());
lotControl.setIncrement(getLotControl().getIncrement());
lotControl.setCurrentNext(getLotControl().getCurrentNext());
lotControl.setPrefix(getLotControl().getPrefix());
lotControl.setSuffix(getLotControl().getSuffix());
manager.save(lotControl);
setLotControl(lotControl);
return SUCCESS;
}