@SuppressWarnings("unchecked") @Override public void execute() { if (!Guard.notNull(req.getMobileDeviceMAC(), req.getVersion(), req.getDate())) { throw new CommandParameterNotSetException(); } ContractInputMapper cim = new ContractInputMapper(); Contract contract; try { contract = cim.findByMobileDevice(req.getMobileDeviceMAC()); } catch (SQLException e1) { res.setException(e1); res.setSucceed(false); return; } IYearlyPass pass = contract.getCard().getYearlyPass(); pass.setDate(req.getDate()); pass.setVersion(req.getVersion()); UnitOfWork.getInstance().RegisterDirty(pass); try { try { UnitOfWork.getInstance().commit(); } catch (CommitUnitOfWorkException e) { res.setException(e); res.setSucceed(false); return; } catch (SQLException e) { res.setException(e); res.setSucceed(false); return; } } catch (LostUpdateException e) { res.setException(e); res.setSucceed(false); return; } catch (MapperException e) { res.setException(e); res.setSucceed(false); return; } res.setSucceed(true); }
public void setVersion(int version) { req.setVersion(version); }
public void setMobileDeviceMAC(String mac) { req.setMobileDeviceMAC(mac); }
public void setDate(Date date) { req.setDate(date); }