KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ashkelon > ConstructorMember


1 package org.ashkelon;
2 /**
3  * Ashkelon
4  * Copyright UptoData Inc. 2001
5  * March 2001
6  */

7
8 import java.sql.Connection JavaDoc;
9 import java.sql.SQLException JavaDoc;
10 import java.util.HashMap JavaDoc;
11 import java.util.Map JavaDoc;
12
13 import org.ashkelon.db.DBUtils;
14
15 import com.sun.javadoc.ConstructorDoc;
16
17 /**
18  * Part of Persistable javadoc object model known as Ashkelon
19  * Analog of com.sun.javadoc.ConstructorDoc
20  *
21  * @author Eitan Suez
22  * @version 2.0
23  */

24 public class ConstructorMember extends ExecMember
25 {
26    private static String JavaDoc TABLENAME = "CONSTRUCTOR";
27    
28    public ConstructorMember(String JavaDoc qualifiedName, String JavaDoc signature)
29    {
30       super(qualifiedName + qualifiedName.substring(qualifiedName.lastIndexOf(".")), signature, Member.CONSTRUCTOR_MEMBER);
31    }
32    
33    public ConstructorMember(ConstructorDoc constructordoc, ClassType containingClass)
34    {
35       super(constructordoc, containingClass);
36    }
37
38    public ConstructorMember(Member member, String JavaDoc signature)
39    {
40       super(member, signature);
41    }
42    
43    public void store(Connection JavaDoc conn) throws SQLException JavaDoc
44    {
45       super.store(conn);
46       Map JavaDoc fieldInfo = new HashMap JavaDoc(5);
47       fieldInfo.put("ID", new Integer JavaDoc(getId(conn)));
48       DBUtils.insert(conn, TABLENAME, fieldInfo);
49    }
50    
51    public static void delete(Connection JavaDoc conn, int memberid, int docid) throws SQLException JavaDoc
52    {
53       Map JavaDoc constraint = new HashMap JavaDoc();
54       constraint.put("ID", new Integer JavaDoc(memberid));
55       DBUtils.delete(conn, TABLENAME, constraint);
56       
57       ExecMember.delete(conn, memberid, docid);
58    }
59    
60    public static String JavaDoc fixQualifiedName(String JavaDoc qualifiedName)
61    {
62       int idx = qualifiedName.lastIndexOf(".");
63       String JavaDoc lastPart = qualifiedName.substring(idx);
64       return qualifiedName + lastPart;
65    }
66 }
67
Popular Tags