Small cleanups; referring to 'identifier' when the auction identifier is being used, as opposed to 'id' which is for the primary keys.
| 526 | 592 | |
|---|---|---|
| 8 | 8 | |
| 9 | 9 | import com.jbidwatcher.util.Currency; |
| 10 | 10 | import com.jbidwatcher.auction.server.AuctionServer; |
| 11 | import com.jbidwatcher.auction.AuctionServerInterface; | |
| 12 | 11 | |
| 13 | 12 | /** |
| 14 | 13 | * Created by IntelliJ IDEA. |
| --- | --- | |
| 20 | 19 | * reduce duplication of the bid/buy result text. |
| 21 | 20 | */ |
| 22 | 21 | public abstract class AuctionActionImpl implements AuctionAction { |
| 23 | protected String mId; | |
| 22 | protected String mIdentifier; | |
| 24 | 23 | protected AuctionEntry mEntry; |
| 25 | 24 | protected Currency mAmount; |
| 26 | 25 | protected int mQuantity; |
| 27 | 26 | int mResult = -1; |
| 28 | 27 | |
| 29 | 28 | protected AuctionActionImpl(String id, Currency amount, int quantity) { |
| 30 | mId = id; | |
| 29 | mIdentifier = id; | |
| 31 | 30 | mEntry = null; |
| 32 | 31 | mAmount = amount; |
| 33 | 32 | mQuantity = quantity; |
| --- | --- | |
| 35 | 34 | |
| 36 | 35 | protected AuctionActionImpl(AuctionEntry ae, Currency amount, int quantity) { |
| 37 | 36 | mEntry = ae; |
| 38 | mId = ae.getIdentifier(); | |
| 37 | mIdentifier = ae.getIdentifier(); | |
| 39 | 38 | mAmount = amount; |
| 40 | 39 | mQuantity = quantity; |
| 41 | 40 | } |
| 42 | 41 | |
| 43 | 42 | public String activate() { |
| 44 | 43 | if(mEntry == null) { |
| 45 | mEntry = AuctionEntry.findByIdentifier(mId); | |
| 44 | mEntry = AuctionEntry.findByIdentifier(mIdentifier); | |
| 46 | 45 | if(mEntry == null) { |
| 47 | 46 | mResult = AuctionServer.BID_ERROR_AUCTION_GONE; |
| 48 | 47 | return getBidResult(mAmount, mResult); |
