1 package org.apache.ojb.ejb; 2 3 17 18 19 import java.math.BigDecimal ; 20 import java.util.ArrayList ; 21 import java.util.List ; 22 23 28 public class VOHelper 29 { 30 public static List createNewArticleList(int number) 31 { 32 ArrayList list = new ArrayList (); 33 for (int i = 0; i < number; i++) 34 { 35 list.add(createNewArticle(i)); 36 } 37 return list; 38 } 39 40 public static List createNewPersonList(int number) 41 { 42 ArrayList list = new ArrayList (); 43 for (int i = 0; i < number; i++) 44 { 45 list.add(createNewPerson(i)); 46 } 47 return list; 48 } 49 50 public static ArticleVO createNewArticle(int counter) 51 { 52 return createNewArticle("A simple test article ", counter); 53 } 54 55 public static ArticleVO createNewArticle(String name, int counter) 56 { 57 ArticleVO a = new ArticleVO(); 58 a.setName(name); 59 a.setPrice(new BigDecimal (0.45d * counter)); 60 a.setDescription("test article description " + counter); 61 return a; 62 } 63 64 public static CategoryVO createNewCategory(String name) 65 { 66 return new CategoryVO(null, name, "this is a test category"); 67 } 68 69 public static PersonVO createNewPerson(int counter) 70 { 71 PersonVO p = new PersonVO(); 72 p.setFirstName("firstname " + counter); 73 p.setLastName("lastname " + counter); 74 p.setGrade("grade" + counter); 75 return p; 76 } 77 } 78 | Popular Tags |