1 package org.tigris.scarab.om; 2 3 48 49 import java.util.List ; 51 52 import org.apache.torque.TorqueException; 53 import org.apache.torque.util.Criteria; 54 55 import org.tigris.scarab.tools.localization.L10NKeySet; 56 import org.tigris.scarab.util.ScarabException; 57 import org.tigris.scarab.services.cache.ScarabCache; 58 59 66 public class ActivitySetTypeManager 67 extends BaseActivitySetTypeManager 68 { 69 private static final String TRANSACTION_TYPE = 71 "ActivitySetType"; 72 private static final String GET_INSTANCE = 73 "getInstance"; 74 75 80 public ActivitySetTypeManager() 81 throws TorqueException 82 { 83 super(); 84 } 85 86 public static ActivitySetType getInstance(String activitySetTypeName) 87 throws Exception 88 { 89 ActivitySetType ttype = null; 90 Object obj = ScarabCache.get(TRANSACTION_TYPE, GET_INSTANCE, 91 activitySetTypeName); 92 if (obj == null) 93 { 94 Criteria crit = new Criteria(); 95 crit.add(ActivitySetTypePeer.NAME, activitySetTypeName); 96 List activitySetTypes = ActivitySetTypePeer.doSelect(crit); 97 if (activitySetTypes.size() < 1) 98 { 99 throw new ScarabException( 100 L10NKeySet.ExceptionActivitySetTypenameNotFound, 101 activitySetTypeName); 102 } 103 if (activitySetTypes.size() > 1) 104 { 105 throw new ScarabException( 106 L10NKeySet.ExceptionActivitySetDuplicateTypename, 107 activitySetTypeName); 108 } 109 ttype = (ActivitySetType)activitySetTypes.get(0); 110 ScarabCache.put(ttype, "ActivitySetType", "getInstance", 111 activitySetTypeName); 112 } 113 else 114 { 115 ttype = (ActivitySetType)obj; 116 } 117 118 return ttype; 119 } 120 } 121 | Popular Tags |