本文整理汇总了Java中net.sourceforge.stripes.examples.bugzooky.biz.Person类的典型用法代码示例。如果您正苦于以下问题:Java Person类的具体用法?Java Person怎么用?Java Person使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Person类属于net.sourceforge.stripes.examples.bugzooky.biz包,在下文中一共展示了Person类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveChanges
import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
@HandlesEvent("Save")
public Resolution saveChanges() {
PersonManager pm = new PersonManager();
// Save any changes to existing people (and create new ones)
for (Person person : people) {
pm.saveOrUpdate(person);
}
// Then, if the user checked anyone off to be deleted, delete them
if (deleteIds != null) {
for (int id : deleteIds) {
pm.deletePerson(id);
}
}
return new RedirectResolution(getClass());
}
示例2: convert
import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
/**
* Attempt to parse the input string to an integer and look up the {@link Person} with that ID
* using a {@link PersonManager}.
*
* @param input The input string to be parsed as the Person ID.
* @param targetType The type of object we're supposed to be returning.
* @param errors The validation errors for this request. If the input string cannot be parsed,
* then we will add a new {@link ValidationError} to this collection and return null.
*/
public Person convert(String input, Class<? extends Person> targetType,
Collection<ValidationError> errors) {
Person person = null;
try {
int id = Integer.valueOf(input);
PersonManager personManager = new PersonManager();
person = personManager.getPerson(id);
}
catch (NumberFormatException e) {
errors.add(new SimpleError("The number {0} is not a valid Person ID", input));
}
return person;
}
示例3: getPeople
import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
/**
* If no list of people is set and we're not handling the "save" event then populate the list of
* people and return it.
*/
public List<Person> getPeople() {
if (people == null && !"Save".equals(getContext().getEventName())) {
people = new PersonManager().getAllPeople();
}
return people;
}
示例4: setUser
import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
/** The user being registered. */
public void setUser(Person user) { this.user = user; }
示例5: getUser
import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
/** The user being registered. */
public Person getUser() { return user; }
示例6: setPeople
import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
public void setPeople(List<Person> people) {
this.people = people;
}
示例7: format
import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
/** Format the {@link Person} object according to the format type and pattern. */
public String format(Person person) {
if (person == null) {
return "";
}
else if ("short".equals(formatType)) {
return checkNull(person.getUsername());
}
else if ("full".equals(formatType)) {
Pattern pattern = Pattern.compile("%[EFLU]");
String fp = formatPattern == null ? DEFAULT_FORMAT_PATTTERN : formatPattern;
StringBuffer buf = new StringBuffer();
Matcher matcher = pattern.matcher(fp);
while (matcher.find()) {
char spec = matcher.group().charAt(1);
switch (spec) {
case 'E':
matcher.appendReplacement(buf, checkNull(person.getEmail()));
break;
case 'F':
matcher.appendReplacement(buf, checkNull(person.getFirstName()));
break;
case 'L':
matcher.appendReplacement(buf, checkNull(person.getLastName()));
break;
case 'U':
matcher.appendReplacement(buf, checkNull(person.getUsername()));
break;
default:
buf.append(matcher.group());
}
}
matcher.appendTail(buf);
return buf.toString();
}
else {
return String.valueOf(person.getId());
}
}
示例8: getUser
import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
/** Gets the currently logged in user, or null if no-one is logged in. */
public Person getUser() {
return (Person) getRequest().getSession().getAttribute("user");
}
示例9: setUser
import net.sourceforge.stripes.examples.bugzooky.biz.Person; //导入依赖的package包/类
/** Sets the currently logged in user. */
public void setUser(Person currentUser) {
getRequest().getSession().setAttribute("user", currentUser);
}