1 package net.sourceforge.blogentis.om;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import java.sql.Connection;
26 import java.util.List;
27
28 import org.apache.torque.NoRowsException;
29 import org.apache.torque.TooManyRowsException;
30 import org.apache.torque.TorqueException;
31 import org.apache.torque.om.ObjectKey;
32 import org.apache.torque.util.Criteria;
33
34 public class SectionPeer
35 extends BaseSectionPeer
36 implements BaseConfigurablePeer {
37 public static Section retrieveSectionByPath(int blogId, String sectionName)
38 throws TorqueException, TooManyRowsException, NoRowsException {
39 Criteria c = new Criteria();
40 c.add(SectionPeer.NAME, sectionName);
41 c.add(SectionPeer.BLOG_ID, blogId);
42 List l = SectionPeer.doSelect(c);
43 if (l.size() < 1)
44 throw new NoRowsException("No section named " + sectionName
45 + " found.");
46 if (l.size() > 1)
47 throw new TooManyRowsException("More than one section named "
48 + sectionName + " found!");
49 return (Section)l.get(0);
50 }
51
52 public BaseConfigurable getConfigurable(ObjectKey key, Connection con)
53 throws TorqueException {
54 return retrieveByPK(key, con);
55 }
56 }