Project

General

Profile

Revision 162

Added by bojilova about 21 years ago

docid is String

View differences:

src/edu/ucsb/nceas/metacat/DBSAXNode.java
82 82
        if (nodetype == "ELEMENT") {
83 83
          pstmt.setLong(3, getParentID());
84 84
          pstmt.setLong(4, getRootNodeID());
85
          pstmt.setLong(5, getDocID());
85
          pstmt.setString(5, getDocID());
86 86
          pstmt.setString(6, data);
87 87
          pstmt.setInt(7, getNodeIndex());
88 88
        } else {
89 89
          pstmt.setLong(3, getNodeID());
90 90
          pstmt.setLong(4, getRootNodeID());
91
          pstmt.setLong(5, getDocID());
91
          pstmt.setString(5, getDocID());
92 92
          pstmt.setString(6, data);
93 93
          pstmt.setInt(7, incChildNum());
94 94
        }
......
151 151
   * creates SQL code to put doc ID for the document node and for comment/PI nodes under document node
152 152
   * into DB connection 
153 153
   */
154
  public void writeDocID(long doc_id) {
154
  public void writeDocID(String doc_id) {
155 155
      try {
156 156
        PreparedStatement pstmt;
157 157
        pstmt = conn.prepareStatement(
......
159 159
              "WHERE nodeid = ?");
160 160

  
161 161
        // Bind the values to the query
162
        pstmt.setLong(1, doc_id);
162
        pstmt.setString(1, doc_id);
163 163
        pstmt.setLong(2, getNodeID());
164 164
        // Do the insertion
165 165
        pstmt.execute();
......
170 170
              "UPDATE xml_nodes set docid = ? " +
171 171
              "WHERE parentnodeid = ?");
172 172
        // Bind the values to the query
173
        pstmt.setLong(1, doc_id);
173
        pstmt.setString(1, doc_id);
174 174
        pstmt.setLong(2, getNodeID());
175 175
        // Do the insertion
176 176
        pstmt.execute();
src/edu/ucsb/nceas/metacat/DBReader.java
48 48
        try {
49 49
                    
50 50
          String nodeidstr = args[0];
51
          long nodeid = (new Long(nodeidstr).longValue());
51
          String nodeid = nodeidstr;
52
          //long nodeid = (new Long(nodeidstr).longValue());
52 53
          String user     = args[1];
53 54
          String password = args[2];
54 55
          String dbstring = null;
......
97 98
   * @param docid the document node contains the root of the document
98 99
   * @returns long the nodeid of the root node for this document
99 100
   */
100
  public long getRootNode(long docid) {
101
  public long getRootNode(String docid) {
101 102
    // Now look up the root node id
102 103
    long rootnodeid = 0;
103 104

  
......
107 108
                "FROM xml_documents " +
108 109
                "WHERE docid = ?");
109 110
      // Bind the values to the query
110
      pstmt.setLong(1, docid);
111
      pstmt.setString(1, docid);
111 112

  
112 113
      pstmt.execute();
113 114
      try {
......
142 143
   *
143 144
   * @param docid the document that we want retrieved
144 145
   */
145
  public String readXMLDocument(long docid) {
146
  public String readXMLDocument(String docid) {
146 147
    StringBuffer doc = new StringBuffer();
147 148
    DoctypeInfo dti = getDoctypeInfo(docid);
148 149

  
......
175 176
   *
176 177
   * @param docid the id of the document to look up
177 178
   */
178
  public DoctypeInfo getDoctypeInfo(long docid) {
179
  public DoctypeInfo getDoctypeInfo(String docid) {
179 180
    PreparedStatement pstmt;
180 181
    String doctype = null;
181 182
    String docname = null;
src/edu/ucsb/nceas/metacat/MetaCatServlet.java
312 312
               HttpServletResponse response) 
313 313
               throws ClassNotFoundException, IOException, SQLException {
314 314
    String docidstr = null;
315
    long docid = 0;
315
    String docid = null;
316 316
    String doc = null;
317 317
    try {
318 318
      // Find the document id number
319 319
      docidstr = ((String[])params.get("docid"))[0]; 
320
      docid = (new Long(docidstr)).longValue();
320
      //docid = (new Long(docidstr)).longValue();
321
      docid = docidstr;
321 322

  
322 323
      // Get the document indicated fromthe db
323 324
      doc = docreader.readXMLDocument(docid);
......
385 386
    } catch (Exception nullpe) {
386 387

  
387 388
      String docidstr = null;
388
      long docid = 0;
389
      String docid = null;
389 390
      try {
390 391
        // Find the document id number
391 392
        docidstr = ((String[])params.get("docid"))[0]; 
392
        docid = (new Long(docidstr)).longValue();
393
        //docid = (new Long(docidstr)).longValue();
394
        docid = docidstr;
393 395
  
394 396
        // Get the document indicated fromthe db
395 397
        valtext = docreader.readXMLDocument(docid);
src/edu/ucsb/nceas/metacat/DBSimpleQuery.java
80 80
          // Print the reulting root nodes
81 81
          StringBuffer result = new StringBuffer();
82 82
          String document = null;
83
          Long docid = null;
83
          String docid = null;
84 84
          result.append("<?xml version=\"1.0\"?>\n");
85 85
          result.append("<resultset>\n");
86 86
          result.append("  <query>" + query + "</query>\n");
87 87
          Enumeration doclist = nodelist.keys(); 
88 88
          while (doclist.hasMoreElements()) {
89
            docid = (Long)doclist.nextElement();
89
            docid = (String)doclist.nextElement();
90 90
            document = (String)nodelist.get(docid);
91 91
            result.append("  <document>\n    " + document + 
92 92
                          "\n  </document>\n");
......
140 140
      PreparedStatement pstmt;
141 141

  
142 142
      // Now look up the document id
143
      long docid = 0;
143
      String docid = null;
144 144
      String docname = null;
145 145
      String doctype = null;
146 146
      String doctitle = null;
......
177 177
        ResultSet rs = pstmt.getResultSet();
178 178
        boolean tableHasRows = rs.next();
179 179
        while (tableHasRows) {
180
          docid = rs.getLong(1);
180
          docid = rs.getString(1);
181 181
          docname = rs.getString(2);
182 182
          doctype = rs.getString(3);
183 183
          doctitle = rs.getString(4);
......
195 195
          }
196 196

  
197 197
          // Store the document id and the root node id
198
          docListResult.put(new Long(docid),(String)document.toString());
198
          docListResult.put(docid,(String)document.toString());
199 199

  
200 200
          // Advance to the next record in the cursor
201 201
          tableHasRows = rs.next();
src/edu/ucsb/nceas/metacat/BasicNode.java
22 22
    private String	tagname;
23 23
    private long	parent_id;
24 24
    private long    rootnode_id;
25
    private long    doc_id;
25
    private String  doc_id;
26 26
    private Hashtable	attributes;
27 27
    private int         childNum;
28 28
    private int         nodeIndex;
29 29
    private String      nodeType;
30
    private Vector	children;
30
    private Vector  	children;
31 31

  
32 32
    /** Construct a Basic Node */
33 33
    public BasicNode () {
......
125 125
    }
126 126

  
127 127
    /** Get the doc id of this node */
128
    public long getDocID() 
128
    public String getDocID() 
129 129
    { 
130 130
      return doc_id; 
131 131
    }
132 132

  
133 133
    /** Set the doc id of this node */
134
    public void setDocID(long doc_id) 
134
    public void setDocID(String doc_id) 
135 135
    { 
136 136
      this.doc_id = doc_id; 
137 137
    }

Also available in: Unified diff