Search in sources :

Example 16 with MagicCardStock

use of org.magic.api.beans.MagicCardStock in project MtgDesktopCompanion by nicho92.

the class MTGODeckExport method exportStock.

@Override
public void exportStock(List<MagicCardStock> stock, File f) throws IOException {
    MagicDeck d = new MagicDeck();
    d.setName(f.getName());
    for (MagicCardStock mcs : stock) {
        d.getMap().put(mcs.getMagicCard(), mcs.getQte());
    }
    export(d, f);
}
Also used : MagicDeck(org.magic.api.beans.MagicDeck) MagicCardStock(org.magic.api.beans.MagicCardStock)

Example 17 with MagicCardStock

use of org.magic.api.beans.MagicCardStock in project MtgDesktopCompanion by nicho92.

the class MagicWorkStationDeckExport method exportStock.

@Override
public void exportStock(List<MagicCardStock> stock, File f) throws IOException {
    MagicDeck d = new MagicDeck();
    d.setName(f.getName());
    for (MagicCardStock mcs : stock) {
        d.getMap().put(mcs.getMagicCard(), mcs.getQte());
    }
    export(d, f);
}
Also used : MagicDeck(org.magic.api.beans.MagicDeck) MagicCardStock(org.magic.api.beans.MagicCardStock)

Example 18 with MagicCardStock

use of org.magic.api.beans.MagicCardStock in project MtgDesktopCompanion by nicho92.

the class ManualImportExport method importStock.

@Override
public List<MagicCardStock> importStock(File f) throws IOException {
    MagicDeck d = importDeck(f);
    List<MagicCardStock> ret = new ArrayList<>();
    for (MagicCard mc : d.getMap().keySet()) {
        MagicCardStock stock = new MagicCardStock();
        stock.setMagicCard(mc);
        stock.setQte(d.getMap().get(mc));
        stock.setUpdate(true);
        stock.setIdstock(-1);
        ret.add(stock);
    }
    return ret;
}
Also used : MagicCard(org.magic.api.beans.MagicCard) ArrayList(java.util.ArrayList) MagicDeck(org.magic.api.beans.MagicDeck) MagicCardStock(org.magic.api.beans.MagicCardStock)

Example 19 with MagicCardStock

use of org.magic.api.beans.MagicCardStock in project MtgDesktopCompanion by nicho92.

the class MkmOnlineExport method exportStock.

@Override
public void exportStock(List<MagicCardStock> stock, File f) throws IOException {
    if (!getString("STOCK_USE").equals("true")) {
        MagicDeck d = new MagicDeck();
        d.setName(f.getName());
        for (MagicCardStock mcs : stock) {
            d.getMap().put(mcs.getMagicCard(), mcs.getQte());
        }
        export(d, f);
    } else {
        StockService serv = new StockService();
        ProductServices prods = new ProductServices();
        EnumMap<PRODUCT_ATTS, String> enumAtts = new EnumMap<>(PRODUCT_ATTS.class);
        enumAtts.put(PRODUCT_ATTS.idGame, "1");
        enumAtts.put(PRODUCT_ATTS.exact, "true");
        List<Article> list = new ArrayList<>();
        for (MagicCardStock mcs : stock) {
            Product p = MagicCardMarketPricer2.getProductFromCard(mcs.getMagicCard(), prods.findProduct(mcs.getMagicCard().getName(), enumAtts));
            Article a = new Article();
            a.setAltered(mcs.isAltered());
            a.setSigned(mcs.isSigned());
            a.setCount(mcs.getQte());
            a.setFoil(mcs.isFoil());
            a.setPrice(mcs.getPrice());
            a.setCondition(convert(mcs.getCondition()));
            a.setLanguage(convertLang(mcs.getLanguage()));
            a.setProduct(p);
            a.setIdProduct(p.getIdProduct());
            list.add(a);
        }
        serv.addArticles(list);
    }
}
Also used : PRODUCT_ATTS(org.api.mkm.modele.Product.PRODUCT_ATTS) Article(org.api.mkm.modele.Article) ArrayList(java.util.ArrayList) Product(org.api.mkm.modele.Product) ProductServices(org.api.mkm.services.ProductServices) StockService(org.api.mkm.services.StockService) EnumMap(java.util.EnumMap) MagicDeck(org.magic.api.beans.MagicDeck) MagicCardStock(org.magic.api.beans.MagicCardStock)

Example 20 with MagicCardStock

use of org.magic.api.beans.MagicCardStock in project MtgDesktopCompanion by nicho92.

the class PDFExport method exportStock.

@Override
public void exportStock(List<MagicCardStock> stock, File f) throws IOException {
    MagicDeck d = new MagicDeck();
    d.setName(f.getName());
    for (MagicCardStock mcs : stock) {
        d.getMap().put(mcs.getMagicCard(), mcs.getQte());
    }
    export(d, f);
}
Also used : MagicDeck(org.magic.api.beans.MagicDeck) MagicCardStock(org.magic.api.beans.MagicCardStock)

Aggregations

MagicCardStock (org.magic.api.beans.MagicCardStock)38 ArrayList (java.util.ArrayList)17 MagicDeck (org.magic.api.beans.MagicDeck)14 PreparedStatement (java.sql.PreparedStatement)9 MagicCard (org.magic.api.beans.MagicCard)9 ResultSet (java.sql.ResultSet)6 MagicCollection (org.magic.api.beans.MagicCollection)6 File (java.io.File)5 IOException (java.io.IOException)3 SQLException (java.sql.SQLException)3 Statement (java.sql.Statement)3 Gson (com.google.gson.Gson)2 FileReader (java.io.FileReader)2 Article (org.api.mkm.modele.Article)2 Document (org.bson.Document)2 Bson (org.bson.conversions.Bson)2 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 JsonParser (com.google.gson.JsonParser)1 JsonReader (com.google.gson.stream.JsonReader)1