1 package org.tigris.scarab.om; 2 3 48 import java.util.List ; 50 51 import org.apache.torque.om.Persistent; 53 import org.apache.torque.util.Criteria; 54 import org.tigris.scarab.tools.localization.L10NKeySet; 55 import org.tigris.scarab.util.ScarabException; 56 57 67 public class AttachmentType 68 extends BaseAttachmentType 69 implements Persistent 70 { 71 public static AttachmentType getInstance(String attachmentTypeName) throws Exception 72 { 73 Criteria crit = new Criteria(); 74 crit.add(BaseAttachmentTypePeer.ATTACHMENT_TYPE_NAME, attachmentTypeName); 75 List attachmentTypes = AttachmentTypePeer.doSelect(crit); 76 if(attachmentTypes.size() > 1) 77 { 78 throw new ScarabException(L10NKeySet.ExceptionAttachementDuplicateTypename); 79 } 80 return (AttachmentType)attachmentTypes.get(0); 81 } 82 } 83 84 85 86 | Popular Tags |