Delivery only if there are any non-currency items delivered.
This commit is contained in:
@@ -106,8 +106,9 @@ public class DbTransferDAO implements TransferDAO {
|
||||
}
|
||||
}
|
||||
|
||||
// For now, very naive synchronization
|
||||
@Override
|
||||
public Map<String, ? extends CardCollection> consumeUndeliveredPackages(String player) {
|
||||
public synchronized Map<String, ? extends CardCollection> consumeUndeliveredPackages(String player) {
|
||||
try {
|
||||
Connection connection = _dbAccess.getDataSource().getConnection();
|
||||
try {
|
||||
|
||||
@@ -43,23 +43,25 @@ public class DeliveryResource extends AbstractResource {
|
||||
String collectionType = collectionTypeItems.getKey();
|
||||
CardCollection items = collectionTypeItems.getValue();
|
||||
|
||||
Element collectionTypeElem = doc.createElement("collectionType");
|
||||
collectionTypeElem.setAttribute("name", collectionType);
|
||||
for (CardCollection.Item item : items.getAll().values()) {
|
||||
String blueprintId = item.getBlueprintId();
|
||||
if (item.getType() == CardCollection.Item.Type.CARD) {
|
||||
Element card = doc.createElement("card");
|
||||
card.setAttribute("count", String.valueOf(item.getCount()));
|
||||
card.setAttribute("blueprintId", blueprintId);
|
||||
collectionTypeElem.appendChild(card);
|
||||
} else {
|
||||
Element pack = doc.createElement("pack");
|
||||
pack.setAttribute("count", String.valueOf(item.getCount()));
|
||||
pack.setAttribute("blueprintId", blueprintId);
|
||||
collectionTypeElem.appendChild(pack);
|
||||
if (items.getAll().size() > 0) {
|
||||
Element collectionTypeElem = doc.createElement("collectionType");
|
||||
collectionTypeElem.setAttribute("name", collectionType);
|
||||
for (CardCollection.Item item : items.getAll().values()) {
|
||||
String blueprintId = item.getBlueprintId();
|
||||
if (item.getType() == CardCollection.Item.Type.CARD) {
|
||||
Element card = doc.createElement("card");
|
||||
card.setAttribute("count", String.valueOf(item.getCount()));
|
||||
card.setAttribute("blueprintId", blueprintId);
|
||||
collectionTypeElem.appendChild(card);
|
||||
} else {
|
||||
Element pack = doc.createElement("pack");
|
||||
pack.setAttribute("count", String.valueOf(item.getCount()));
|
||||
pack.setAttribute("blueprintId", blueprintId);
|
||||
collectionTypeElem.appendChild(pack);
|
||||
}
|
||||
}
|
||||
deliveryElem.appendChild(collectionTypeElem);
|
||||
}
|
||||
deliveryElem.appendChild(collectionTypeElem);
|
||||
}
|
||||
|
||||
doc.appendChild(deliveryElem);
|
||||
|
||||
Reference in New Issue
Block a user