1 package org.tigris.scarab.om; 2 3 48 49 import java.util.Date ; 50 51 import org.tigris.scarab.tools.localization.L10NKeySet; 52 import org.tigris.scarab.util.ScarabException; 53 54 import org.apache.torque.TorqueException; 55 import org.apache.torque.om.NumberKey; 56 57 64 public class ActivitySetManager 65 extends BaseActivitySetManager 66 { 67 72 public ActivitySetManager() 73 throws TorqueException 74 { 75 super(); 76 } 77 78 81 public static ActivitySet getInstance(String key) 82 throws TorqueException 83 { 84 return getInstance(new NumberKey(key)); 86 } 87 88 91 public static ActivitySet getInstance(ActivitySetType tt, ScarabUser user) 92 throws Exception 93 { 94 return getInstance(tt.getTypeId(), user, null); 95 } 96 97 100 public static ActivitySet getInstance(ActivitySetType tt, 101 ScarabUser user, Attachment attachment) 102 throws Exception 103 { 104 return getInstance(tt.getTypeId(), user, attachment); 105 } 106 107 110 public static ActivitySet getInstance(Integer typeId, ScarabUser user) 111 throws Exception 112 { 113 return getInstance(typeId, user, null); 114 } 115 116 119 public static ActivitySet getInstance(Integer typeId, 120 ScarabUser user, Attachment attachment) 121 throws Exception 122 { 123 if (attachment != null && attachment.getAttachmentId() == null) 124 { 125 throw new ScarabException(L10NKeySet.ExceptionNeedToSaveAttachement); 126 } 127 ActivitySet activitySet = new ActivitySet(); 128 activitySet.setTypeId(typeId); 129 activitySet.setCreatedBy(user.getUserId()); 130 activitySet.setCreatedDate(new Date ()); 131 if (attachment != null && 132 attachment.getData() != null && 133 attachment.getData().length() > 0) 134 { 135 activitySet.setAttachment(attachment); 136 } 137 return activitySet; 138 } 139 } 140 | Popular Tags |