01: /*
02: * $Id: PersonManager.java 476710 2006-11-19 05:05:14Z mrdon $
03: *
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
20: */
21: package org.apache.struts2.showcase.person;
22:
23: import java.util.HashSet;
24: import java.util.Set;
25:
26: /**
27: */
28: public class PersonManager {
29: private static Set people = new HashSet(5);
30: private static long COUNT = 5;
31:
32: static {
33: // create some imaginary persons
34: Person p1 = new Person(new Long(1), "Patrick", "Lightbuddie");
35: Person p2 = new Person(new Long(2), "Jason", "Carrora");
36: Person p3 = new Person(new Long(3), "Alexandru", "Papesco");
37: Person p4 = new Person(new Long(4), "Jay", "Boss");
38: Person p5 = new Person(new Long(5), "Rainer", "Hermanos");
39: people.add(p1);
40: people.add(p2);
41: people.add(p3);
42: people.add(p4);
43: people.add(p5);
44: }
45:
46: public void createPerson(Person person) {
47: person.setId(new Long(++COUNT));
48: people.add(person);
49: }
50:
51: public void updatePerson(Person person) {
52: people.add(person);
53: }
54:
55: public Set getPeople() {
56: return people;
57: }
58: }
|