本文整理汇总了Java中org.fluttercode.datafactory.impl.DataFactory.getFirstName方法的典型用法代码示例。如果您正苦于以下问题:Java DataFactory.getFirstName方法的具体用法?Java DataFactory.getFirstName怎么用?Java DataFactory.getFirstName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fluttercode.datafactory.impl.DataFactory
的用法示例。
在下文中一共展示了DataFactory.getFirstName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupUser
import org.fluttercode.datafactory.impl.DataFactory; //导入方法依赖的package包/类
@GET
@Path("/setupuser")
@Produces(MediaType.APPLICATION_JSON)
public String setupUser() {
logger.info("Setup aufrufen");
DataFactory df = DataFactory.create();
User user = new User(df.getFirstName(),df.getLastName(), df.getEmailAddress());
Key<User> userKey = ObjectifyService.ofy().save().entity(user).now();
User user2 = new User(df.getFirstName(),df.getLastName(), df.getEmailAddress());
Key<User> user2Key = ObjectifyService.ofy().save().entity(user2).now();
Address addr = new Address(df.getCity(),String.valueOf( df.getNumberBetween(10000, 99999)), df.getStreetName(),
String.valueOf(df.getNumberUpTo(300)));
// need to store to db, so the address entity gets a key in the db that can be assigned to the item
Key<Address> key = ObjectifyService.ofy().save().entity(addr).now();
Address addr2 = new Address(df.getCity(),String.valueOf( df.getNumberBetween(10000, 99999)), df.getStreetName(),
String.valueOf(df.getNumberUpTo(300)));
// need to store to db, so the address entity gets a key in the db that can be assigned to the item
Key<Address> key2 = ObjectifyService.ofy().save().entity(addr2).now();
user.addAddress(key2);
user2.addAddress(key);
UserRating userRating = new UserRating(userKey.getId(), user2Key.getId(), df.getNumberBetween(0, 5));
ObjectifyService.ofy().save().entity(userRating).now();
UserRating userRating2 = new UserRating(userKey.getId(), user2Key.getId(), df.getNumberBetween(0, 5));
ObjectifyService.ofy().save().entity(userRating2).now();
ObjectifyService.ofy().save().entity(user).now();
ObjectifyService.ofy().save().entity(user2).now();
logger.info("Saved user with address.");
return "{\"status\":\"done\"}";
}
示例2: mock
import org.fluttercode.datafactory.impl.DataFactory; //导入方法依赖的package包/类
@Override
public void mock() {
customerNr = "CN - " + (int)(Math.random() * 9000 + 1000);
DataFactory df = new DataFactory();
surname = df.getLastName();
firstname = df.getFirstName();
boolean male = Math.random() < 0.5;
email = firstname.toLowerCase() + "." + surname.toLowerCase() + "@loremipsum.com";
company = surname + " " + (Math.random() < 0.5 ? "AG" : "GmbH");
salutation = male ? Salutation.Male : Salutation.Female;
customersince = LocalDate.now();
}
示例3: fillWithDemoData
import org.fluttercode.datafactory.impl.DataFactory; //导入方法依赖的package包/类
@Override
protected void fillWithDemoData(Customer customer) {
super.fillWithDemoData(customer);
DataFactory df = new DataFactory();
customer.name = df.getLastName();
customer.firstName = df.getFirstName();
}
示例4: Person
import org.fluttercode.datafactory.impl.DataFactory; //导入方法依赖的package包/类
public Person(int id, DataFactory dataFactory, SimpleDateFormat simpleDateFormat) {
this.id = id;
this.firstName = dataFactory.getFirstName();
this.lastName = dataFactory.getLastName();
this.city = dataFactory.getCity();
this.company = new CustomCompany(dataFactory.getBusinessName());
this.birthday = simpleDateFormat.format(dataFactory.getBirthDate());
this.email = dataFactory.getEmailAddress();
this.gender = id % 3 == 0;
}
示例5: setupItem
import org.fluttercode.datafactory.impl.DataFactory; //导入方法依赖的package包/类
@GET
@Path("/setupitem")
@Produces(MediaType.APPLICATION_JSON)
public String setupItem() {
logger.info("Setup aufrufen");
DataFactory df = DataFactory.create();
User user = new User(df.getFirstName(),df.getLastName(), df.getEmailAddress());
Key<User> userKey = ObjectifyService.ofy().save().entity(user).now();
User user2 = new User(df.getFirstName(),df.getLastName(), df.getEmailAddress());
Key<User> user2Key = ObjectifyService.ofy().save().entity(user2).now();
Item item = new Item(df.getRandomWord(5, 20), new Double(df.getNumber()), "description");
Address addr = new Address(df.getCity(),String.valueOf( df.getNumberBetween(10000, 99999)), df.getStreetName(),
String.valueOf(df.getNumberUpTo(300)));
// need to store to db, so the address entity gets a key in the db that can be assigned to the item
ObjectifyService.ofy().save().entity(addr).now();
item.setAddress(addr);
Tag tag1 = new Tag("sports");
Tag tag2 = new Tag("summer");
Key<Tag> tag1Key = ObjectifyService.ofy().save().entity(tag1).now();
Key<Tag> tag2Key = ObjectifyService.ofy().save().entity(tag2).now();
item.addTag(Ref.create(tag1Key));
item.addTag(Ref.create(tag2Key));
Key<Item> itemKey = ObjectifyService.ofy().save().entity(item).now();
user.addItem(item);
ObjectifyService.ofy().save().entity(user).now();
int ratingValue = df.getNumberBetween(0, 5);
ItemRating itemRating = new ItemRating(itemKey.getId(), userKey.getId(), ratingValue);
item.updateRatingCount(ratingValue);
ObjectifyService.ofy().save().entity(itemRating).now();
ratingValue = df.getNumberBetween(0, 5);
ItemRating itemRating2 = new ItemRating(itemKey.getId(), user2Key.getId(), ratingValue);
item.updateRatingCount(ratingValue);
// save item again to store updated rating counts
ObjectifyService.ofy().save().entity(item).now();
ObjectifyService.ofy().save().entity(itemRating2).now();
logger.info("Saved successfully.");
return "{\"status\":\"done\"}";
}
示例6: mock
import org.fluttercode.datafactory.impl.DataFactory; //导入方法依赖的package包/类
@Override
public void mock() {
DataFactory df = new DataFactory();
firstName = df.getFirstName();
lastName = df.getLastName();
}
示例7: mock
import org.fluttercode.datafactory.impl.DataFactory; //导入方法依赖的package包/类
@Override
public void mock() {
DataFactory df = new DataFactory();
firstName = df.getFirstName();
lastName = df.getLastName();
}