Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import play.*;
- import play.jobs.*;
- import play.test.*;
- import models.*;
- @OnApplicationStart
- public class Bootstrap extends Job {
- public void doJob() {
- Fixtures.deleteAll();
- // Check if the database is empty
- // if (IdeaDeveloper.count() < 2) {
- IdeaDeveloper ousama = new IdeaDeveloper();
- ousama.username = "ousama";
- ousama.fullName = "ousama";
- ousama.eMail = "ousama";
- ousama.dateOfBirth = "ousama";
- ousama.password = "ousama";
- ousama.passwordHash = "ousama";
- ousama.address = "ousama";
- ousama.save();
- //
- IdeaDeveloper qamar = new IdeaDeveloper();
- qamar.username = "qamar";
- qamar.fullName = "qamar";
- qamar.eMail = "qamar";
- qamar.dateOfBirth = "qamar";
- qamar.password = "qamar";
- qamar.passwordHash = "qamar";
- qamar.address = "qamar";
- qamar.save();
- IdeaDeveloper tarek = new IdeaDeveloper();
- tarek.username = "tarek";
- tarek.fullName = "adasd";
- tarek.eMail = "asdasdas";
- tarek.dateOfBirth = "552";
- tarek.password = "asd";
- tarek.passwordHash = "asd";
- tarek.address = "sd";
- tarek.save();
- // OrganizationLead.create(tarek);
- //
- // OrganizationLead orgLead = new OrganizationLead();
- // orgLead.ideaDeveloper = tarek;
- // orgLead.save();
- // Organization organization = Organization.create(orgLead, "Org1");
- // organization.save();
- //
- // IdeaDeveloper ideaDeveloper2 = new IdeaDeveloper("asd", "sad",
- // "dd", "123@gmails.com", "12-12-1991", "123");
- // ideaDeveloper2.save();
- Entities entity = new Entities();
- entity.name = "entity1";
- entity.save();
- Organization organization = new Organization();
- organization.name = "organization1";
- organization.save();
- Organizer organizer = new Organizer();
- organizer.ideaDeveloper = ousama;
- organizer.manages.add(entity);
- organizer.save();
- IdeaDeveloper x = new IdeaDeveloper("Mohamed", "Sekkina", "1234",
- "w@guc.com", "5/6/1990", "Ahmed Hosny");
- x.save();
- Organization o = new Organization();
- o.name = "Egypt";
- o.save();
- x.joinedOrg.add(o);
- x.save();
- o.members.add(x);
- o.save();
- OrganizationLead xa = new OrganizationLead();
- xa.ideaDeveloper = x;
- xa.save();
- Organization o2 = new Organization();
- o2.name = "Italy";
- o2.save();
- xa.manages.add(o2);
- xa.save();
- o2.managers.add(xa);
- o2.save();
- Organization o3 = new Organization();
- o3.name = "GUC";
- o3.save();
- x.followedOrg.add(o3);
- x.followedOrg.add(o2);
- x.save();
- o3.followed.add(x);
- o3.save();
- Topic t1 = new Topic();
- t1.title = "Topic1";
- t1.topicOrg = o;
- t1.save();
- Idea i1 = new Idea();
- i1.title = "Idea1";
- i1.ideaOrg = o;
- i1.save();
- o.ideas.add(i1);
- o.topics.add(t1);
- o.type = "Public";
- o.save();
- Entities e1 = new Entities();
- e1.name = "Entity1";
- e1.save();
- o.liesIn.add(e1);
- o.save();
- Entities e2 = new Entities();
- e2.name = "Hello world";
- e2.save();
- e1.childern.add(e2);
- e1.liesIn = o;
- e1.save();
- e2.parent = e1;
- e2.save();
- x.joinedEnt.add(e1);
- x.save();
- Topic t3 = new Topic();
- t3.title = "مصر هي أمي ";
- t3.save();
- e1.topics.add(t3);
- e1.save();
- t3.topicEnt = e1;
- t3.save();
- t3.ideas.add(i1);
- t3.save();
- i1.ideaTopic = t3;
- i1.save();
- x.createdTopics.add(t3);
- x.save();
- t3.creator = x;
- t3.save();
- Topic t4 = new Topic();
- t4.title = "ثروة التحرير";
- t4.creator = x;
- t4.save();
- x.createdTopics.add(t4);
- x.save();
- t4.ideas.add(i1);
- t4.save();
- i1.ideaTopic = t4;
- i1.save();
- Idea i2 = new Idea();
- i2.title = "سكينة";
- i2.save();
- t3.ideas.add(i2);
- t3.save();
- i2.ideaTopic = t3;
- i2.save();
- i1.creator = x;
- i2.creator = x;
- x.save();
- Tag tag1 = new Tag();
- tag1.save();
- Tag tag2 = new Tag();
- tag2.save();
- Organizer xb = new Organizer();
- xb.ideaDeveloper = x;
- xb.save();
- e1.managers.add(xb);
- e1.save();
- xb.manages.add(e1);
- xb.save();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement