本文整理汇总了Java中com.erudika.para.core.Address.setCountry方法的典型用法代码示例。如果您正苦于以下问题:Java Address.setCountry方法的具体用法?Java Address.setCountry怎么用?Java Address.setCountry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.erudika.para.core.Address
的用法示例。
在下文中一共展示了Address.setCountry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: post
import com.erudika.para.core.Address; //导入方法依赖的package包/类
@PostMapping("/questions/ask")
public String post(@RequestParam(required = false) String location, @RequestParam(required = false) String latlng,
@RequestParam(required = false) String address, HttpServletRequest req, Model model) {
if (utils.isAuthenticated(req)) {
Profile authUser = utils.getAuthUser(req);
Question q = utils.populate(req, new Question(), "title", "body", "tags|,", "location");
q.setCreatorid(authUser.getId());
Map<String, String> error = utils.validate(q);
if (error.isEmpty()) {
q.setLocation(location);
String qid = q.create();
if (!StringUtils.isBlank(latlng)) {
Address addr = new Address();
addr.setAddress(address);
addr.setCountry(location);
addr.setLatlng(latlng);
addr.setParentid(qid);
addr.setCreatorid(authUser.getId());
pc.create(addr);
}
authUser.setLastseen(System.currentTimeMillis());
} else {
model.addAttribute("error", error);
model.addAttribute("path", "questions.vm");
model.addAttribute("includeGMapsScripts", true);
model.addAttribute("askSelected", "navbtn-hover");
return "base";
}
return "redirect:" + q.getPostLink(false, false);
}
return "redirect:" + SIGNINLINK + "?returnto=" + QUESTIONSLINK + "/ask";
}
示例2: init
import com.erudika.para.core.Address; //导入方法依赖的package包/类
public static void init() {
CoreUtils.getInstance().setSearch(s);
u = new User("111");
u.setName("John Doe");
u.setGroups(User.Groups.USERS.toString());
u.setEmail("[email protected]");
u.setIdentifier(u.getEmail());
u.setTimestamp(1000000000L);
u.setPassword("123456");
u.setTags(CoreUtils.getInstance().addTags(u.getTags(), "one", "two", "three"));
u1 = new User("222");
u1.setName("Joe Black");
u1.setGroups(User.Groups.USERS.toString());
u1.setEmail("[email protected]");
u1.setIdentifier(u1.getEmail());
u1.setTimestamp(Utils.timestamp());
u1.setPassword("123456");
u1.setTags(CoreUtils.getInstance().addTags(u1.getTags(), "two", "four", "three"));
u2 = new User("333");
u2.setName("Ann Smith");
u2.setGroups(User.Groups.USERS.toString());
u2.setEmail("[email protected]");
u2.setIdentifier(u2.getEmail());
u2.setTimestamp(Utils.timestamp());
u2.setPassword("123456");
u2.setTags(CoreUtils.getInstance().addTags(u2.getTags(), "four", "five", "three"));
t = new Tag("test");
t.setCount(3);
t.setTimestamp(Utils.timestamp());
a1 = new Address("adr1");
a1.setName("Place 1");
a1.setAddress("NYC");
a1.setCountry("US");
a1.setLatlng("40.67,-73.94");
a1.setParentid(u.getId());
a1.setCreatorid(u.getId());
a2 = new Address("adr2");
a2.setName("Place 2");
a2.setAddress("NYC");
a2.setCountry("US");
a2.setLatlng("40.69,-73.95");
a2.setParentid(t.getId());
a2.setCreatorid(t.getId());
s1 = new Sysprop("s1");
s1.addProperty("text", "This is a little test sentence. Testing, one, two, three.");
s1.setTimestamp(Utils.timestamp());
s2 = new Sysprop("s2");
s2.addProperty("text", "We are testing this thing. This sentence is a test. One, two.");
s2.setTimestamp(Utils.timestamp());
Sysprop linked1 = new Sysprop("link1");
Sysprop linked2 = new Sysprop("link2");
linked1.addProperty("text", "hello kitty");
linked2.addProperty("text", "hello doggy");
l1 = new Linker("cat", "dog", "id1", "id2");
l1.addNestedObject(linked1);
l1.addNestedObject(linked2);
s.indexAll(Arrays.asList(u, u1, u2, t, s1, s2, a1, a2, l1));
try {
Thread.sleep(1000);
} catch (InterruptedException ex) { }
}