1 25 26 package org.objectweb.speedo.mim.lib; 27 28 import java.util.Arrays ; 29 import java.util.Collection ; 30 import java.util.Set ; 31 import java.util.HashSet ; 32 33 import javax.jdo.FetchPlan; 34 35 36 39 public class SpeedoFetchPlan implements FetchPlan { 40 41 44 private Set groups = new HashSet (); 45 46 private int fetchSize; 47 48 public SpeedoFetchPlan(){ 49 groups.add(FetchPlan.DEFAULT); 50 } 51 52 public SpeedoFetchPlan(String fgName){ 53 groups.add(fgName); 54 } 55 56 59 public FetchPlan addGroup(String fetchGroupName){ 60 if (fetchGroupName != null){ 61 groups.add(fetchGroupName); 62 } 63 return this; 64 } 65 66 69 public FetchPlan removeGroup(String fetchGroupName){ 70 if (fetchGroupName != null){ 71 groups.remove(fetchGroupName); 72 } 73 return this; 74 } 75 76 public Collection getGroups(){ 77 return groups; 78 } 79 80 public FetchPlan setGroups(Collection fetchGroupNames){ 81 groups.clear(); 82 if (fetchGroupNames != null){ 83 groups.addAll(fetchGroupNames); 84 } 85 return this; 86 } 87 88 public FetchPlan clearGroups() { 89 groups.clear(); 90 groups.add(FetchPlan.DEFAULT); 91 return this; 92 } 93 public FetchPlan setGroup(String fetchGroupName) { 94 groups.clear(); 95 if (fetchGroupName != null){ 96 groups.add(fetchGroupName); 97 } 98 return this; 99 } 100 public FetchPlan setGroups(String [] fetchGroupNames) { 101 groups.clear(); 102 if (fetchGroupNames != null){ 103 groups.addAll(Arrays.asList(fetchGroupNames)); 104 } 105 return this; 106 } 107 108 public FetchPlan setFetchSize(int fetchSize){ 109 this.fetchSize = fetchSize; 110 return this; 111 } 112 113 public int getFetchSize(){ 114 return fetchSize; 115 } 116 } 117 | Popular Tags |