01: package org.apache.ojb.ejb;
02:
03: /* Copyright 2002-2005 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: import java.math.BigDecimal;
19: import java.util.ArrayList;
20: import java.util.List;
21:
22: /**
23: * Simple helper class.
24: *
25: * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
26: */
27: public class VOHelper {
28: public static List createNewArticleList(int number) {
29: ArrayList list = new ArrayList();
30: for (int i = 0; i < number; i++) {
31: list.add(createNewArticle(i));
32: }
33: return list;
34: }
35:
36: public static List createNewPersonList(int number) {
37: ArrayList list = new ArrayList();
38: for (int i = 0; i < number; i++) {
39: list.add(createNewPerson(i));
40: }
41: return list;
42: }
43:
44: public static ArticleVO createNewArticle(int counter) {
45: return createNewArticle("A simple test article ", counter);
46: }
47:
48: public static ArticleVO createNewArticle(String name, int counter) {
49: ArticleVO a = new ArticleVO();
50: a.setName(name);
51: a.setPrice(new BigDecimal(0.45d * counter));
52: a.setDescription("test article description " + counter);
53: return a;
54: }
55:
56: public static CategoryVO createNewCategory(String name) {
57: return new CategoryVO(null, name, "this is a test category");
58: }
59:
60: public static PersonVO createNewPerson(int counter) {
61: PersonVO p = new PersonVO();
62: p.setFirstName("firstname " + counter);
63: p.setLastName("lastname " + counter);
64: p.setGrade("grade" + counter);
65: return p;
66: }
67: }
|