public static void withMap(String companyId) { Company company = Company.findById(companyId); Project project = new Project(); project.companies = new HashMap(); project.companies.put(company.name, company); project.create(); render("@show", project); }
@Override public void onStart(Application app) { Category food = null; Category travel = null; Category sport = null; Category other = null; Company admin = null; Company bitCamp = null; long ownedCoupinID1 = 0; long ownedCoupinID2 = 0; int quantity = 1; int status = Coupon.Status.ACTIVE; String picture = Play.application().configuration().getString("defaultProfilePicture"); if (!Company.exists("Admin")) { bitCamp = new Company( "Admin", "*****@*****.**", HashHelper.createPassword("bitadmin"), new Date(), picture, adress, city, contact); bitCamp.status = Status.ACTIVE; bitCamp.save(); } if (!Company.exists("BitCamp")) { bitCamp = new Company( "BitCamp", "*****@*****.**", HashHelper.createPassword("bitcamp"), new Date(), picture, adress, city, contact); bitCamp.status = Status.ACTIVE; bitCamp.save(); } if (Category.exists("Food") == false) { food = new Category( "Food", "http://res.cloudinary.com/bitfiles/image/upload/v1430902947/staticImages/food.png"); food.save(); } if (Category.exists("Travel") == false) { travel = new Category( "Travel", "http://res.cloudinary.com/bitfiles/image/upload/v1430902953/staticImages/travel.png"); travel.save(); } if (Category.exists("Sport") == false) { sport = new Category( "Sport", "http://res.cloudinary.com/bitfiles/image/upload/v1430902950/staticImages/sport.png"); sport.save(); } if (Category.exists("Other") == false) { other = new Category("Other"); other.save(); } if (Coupon.checkByName(nameCoupon1) == false) { Coupon.createCoupon( nameCoupon1, 80, new Date(), "http://res.cloudinary.com/bitfiles/image/upload/v1430853980/staticImages/cp1.jpg", travel, descriptionCoupon1, remarkCoupon1, 5, 25, new Date(), bitCamp, status); } if (Coupon.checkByName(nameCoupon2) == false) { ownedCoupinID1 = Coupon.createCoupon( nameCoupon2, 40, new Date(), "http://res.cloudinary.com/bitfiles/image/upload/v1430853989/staticImages/cp2.jpg", other, descriptionCoupon2, remarkCoupon2, 5, 20, new Date(), bitCamp, status); } /* creating a coupon that is not expired */ if (Coupon.checkByName(nameCoupon3) == false) { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); String dateString = "01/01/2051"; Date date = null; try { date = df.parse(dateString); } catch (ParseException e) { e.printStackTrace(); } ownedCoupinID2 = Coupon.createCoupon( nameCoupon3, 20, date, "http://res.cloudinary.com/bitfiles/image/upload/v1430854001/staticImages/cp3.jpg", food, descriptionCoupon3, remarkCoupon3, 2, 5, new Date(), bitCamp, status); } if (Coupon.checkByName(nameCoupon4) == false) { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); String dateString = "05/05/2020"; Date date = null; try { date = df.parse(dateString); } catch (ParseException e) { e.printStackTrace(); } Coupon.createCoupon( nameCoupon4, 350, date, "http://res.cloudinary.com/bitfiles/image/upload/v1430854005/staticImages/cp4.jpg", travel, descriptionCoupon4, remarkCoupon4, 5, 30, new Date(), bitCamp, status); } if (Coupon.checkByName(nameCoupon5) == false) { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); String dateString = "05/05/2020"; Date date = null; try { date = df.parse(dateString); } catch (ParseException e) { e.printStackTrace(); } Coupon.createCoupon( nameCoupon5, 17, date, "http://res.cloudinary.com/bitfiles/image/upload/v1430854008/staticImages/cp5.jpg", food, descriptionCoupon5, remarkCoupon5, 5, 30, new Date(), bitCamp, status); } if (Coupon.checkByName(nameCoupon6) == false) { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); String dateString = "05/05/2020"; Date date = null; try { date = df.parse(dateString); } catch (ParseException e) { e.printStackTrace(); } Coupon.createCoupon( nameCoupon6, 34, date, "http://res.cloudinary.com/bitfiles/image/upload/v1430854011/staticImages/cp6.jpg", travel, descriptionCoupon6, remarkCoupon6, 5, 30, new Date(), bitCamp, status); } if (Coupon.checkByName(nameCoupon7) == false) { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); String dateString = "05/05/2020"; Date date = null; try { date = df.parse(dateString); } catch (ParseException e) { e.printStackTrace(); } Coupon.createCoupon( nameCoupon7, 219, date, "http://res.cloudinary.com/bitfiles/image/upload/v1430854013/staticImages/cp7.jpg", travel, descriptionCoupon7, remarkCoupon7, 5, 30, new Date(), bitCamp, status); } if (Coupon.checkByName(nameCoupon8) == false) { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); String dateString = "05/05/2020"; Date date = null; try { date = df.parse(dateString); } catch (ParseException e) { e.printStackTrace(); } Coupon.createCoupon( nameCoupon8, 25, date, "http://res.cloudinary.com/bitfiles/image/upload/v1430854016/staticImages/cp8.jpg", sport, descriptionCoupon8, remarkCoupon8, 5, 30, new Date(), bitCamp, status); } if (Coupon.checkByName(nameCoupon9) == false) { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); String dateString = "05/05/2020"; Date date = null; try { date = df.parse(dateString); } catch (ParseException e) { e.printStackTrace(); } Coupon.createCoupon( nameCoupon9, 239, date, "http://res.cloudinary.com/bitfiles/image/upload/v1430854019/staticImages/cp9.jpg", travel, descriptionCoupon9, remarkCoupon9, 5, 30, new Date(), bitCamp, status); } if (User.check("*****@*****.**") == false) { User.createUser( "Admin", "", new Date(), "", "", "", "*****@*****.**", HashHelper.createPassword("bitadmin"), true, picture); EmailVerification setVerified = new EmailVerification(1, true); setVerified.save(); } if (User.check("*****@*****.**") == false) { User user = new User( "Jesenko", "Gavric", new Date(), "", "", "", "*****@*****.**", HashHelper.createPassword("johndoe"), false, picture); user.save(); EmailVerification setVerified = new EmailVerification(2, true); setVerified.save(); Coupon c1 = Coupon.find(ownedCoupinID1); Coupon c2 = Coupon.find(ownedCoupinID2); TransactionCP.createTransaction( "AH-324ASDas", "bitSale", c1.price, quantity, c1.price, "TOKEN01010", user, c1); c1.maxOrder = c1.maxOrder - quantity; c1.statistic.bought(quantity); c1.save(); TransactionCP.createTransaction( "AH-324ASsadD", "bitSale", c2.price, quantity, c2.price, "TOKEN2222", user, c2); c2.maxOrder = c2.maxOrder - quantity; c2.statistic.bought(quantity); c2.save(); } if (User.check("*****@*****.**") == false) { User.createUser( "Vedad", "Zornic", new Date(), "", "", "", "*****@*****.**", HashHelper.createPassword("johndoe"), false, picture); EmailVerification setVerified = new EmailVerification(3, true); setVerified.save(); Subscriber sb = new Subscriber(User.findByEmail("*****@*****.**")); sb.save(); } if (FAQ.checkByQuestion("Želim kupiti današnju ponudu. Kako da to učinim?") == false) { FAQ.createFAQ( "Želim kupiti današnju ponudu. Kako da to učinim?", "Morate biti " + "registrovani i ulogovani na stranicu. Ukoliko još nemate nalog," + " registracija je besplatna i traje manje od 30 sekundi, a također se " + "možete uvezati sa Vašim Facebook nalogom. Kada se ulogujete kliknite na" + " dugme Kupi i pratite jednostavne korake."); } if (FAQ.checkByQuestion("Na koji način plaćam ponudu i je li sigurno?") == false) { FAQ.createFAQ( "Na koji način plaćam ponudu i je li sigurno?", "Plaćanje možete obaviti na" + " jedan od sljedećih načina:" + "1. Putem eKredita – eKredit možete uplatiti u banci ili pošti na naš transkcijski " + "račun, a on će Vam biti dodijeljen sljedeći radni dan ili najkasnije 48 sati nakon" + " uplate. Kada Vaš eKredit bude prikazan na Vašem profilu možete obaviti željenu kupovinu. " + "Više informacija možete pronaći na ovom linku nakon prijave na Vaš profil." + "2. Putem kartice – Plaćanje je zbog sigurnosti, jednostavnije realizacije i brzine " + "obrade zahtjeva limitirano na kreditne i debitne MasterCard, Maestro i VISA kartice. " + "Plaćanje je potpuno sigurno, a više o tome možete pročitati na - sigurnost plaćanja." + "3. Dio plaćate eKreditom, a dio karticom – Prilikom kupovine potrebno je da unesete iznos " + "eKredita koji želite da Vam se odbije i dalje idete na „Nastavi kupovinu“. Unesete sve" + " potrebne podatke i na taj način će Vam se jedan dio odbiti u vidu eKredita a ostatak" + " vrijednosti će biti rezervisan na Vašoj kartici." + "4. Gotovinska uplata kupona ili ekredita - uplatu možete izvršiti na eKupon prodajnim mjestima u" + " BBI tržnom centru i Grand centru na Ilidži. " + "5. Kupovina poklon bona na ime i prezime osobe koju želite bez obzira da li je registrovan korisnik ili ne."); } if (FAQ.checkByQuestion("Šta se dešava ako ponuda dana ne dosegne minimalan broj kupaca?") == false) { FAQ.createFAQ( "Šta se dešava ako ponuda dana ne dosegne minimalan broj kupaca?", "Da bi ponuda " + "uspjela mora dostići minimalan broj kupaca koji se određuje u dogovoru s partnerima." + "U slučaju da se ne kupi dovoljan broj kupona, ponuda propada i ništa Vam se ne naplaćuje. " + "Da izbjegnete ovakve situacije, pozovite što više osoba da se uključe na ponudu na " + "kojoj ste učestvovali."); } // Creating 10 testing posts. if (Post.all().size() < 1) { for (int i = 0; i < 10; i++) { Post.createPost( "Man must explore, and this is exploration at its greatest", "Problems look mighty small from 150 miles up", post_content, "http://res.cloudinary.com/bitfiles/image/upload/v1430859169/staticImages/explore.jpg", new Date(), User.find(true), "no,tag"); } } }
public static void createCompany(Company company) { company.create(); render(company); }
public static ExpressionList<CompanyMessage> find(Company company) { return find.where().eq("company.id", company.getId()); }