Project

General

Profile

« Previous | Next » 

Revision 10186

Added by Jing Tao over 7 years ago

In the archive method, add a new mechanism to check if the local id is in the xml_revision table if it is not in the xml_documents table.

View differences:

src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
2188 2188
              //HazelcastService.getInstance().getIndexQueue().add(sysMeta);
2189 2189
              
2190 2190
          } catch (McdbDocNotFoundException e) {
2191
              throw new NotFound("1340", "The provided identifier was invalid.");
2192

  
2191
              try {
2192
                  AccessionNumber acc = new AccessionNumber(localId, "NOACTION");
2193
                  String docid = acc.getDocid();
2194
                  int rev = 1;
2195
                  if (acc.getRev() != null) {
2196
                    rev = (new Integer(acc.getRev()).intValue());
2197
                  }
2198
                  if(IdentifierManager.getInstance().existsInXmlLRevisionTable(docid, rev)) {
2199
                      //somehow the document is in the xml_revision table.
2200
                      // archive it
2201
                      sysMeta.setArchived(true);
2202
                      if(needModifyDate) {
2203
                          sysMeta.setDateSysMetadataModified(Calendar.getInstance().getTime());
2204
                          sysMeta.setSerialVersion(sysMeta.getSerialVersion().add(BigInteger.ONE));
2205
                      }
2206
                      HazelcastService.getInstance().getSystemMetadataMap().put(pid, sysMeta);
2207
                  } else {
2208
                      throw new NotFound("1340", "The provided identifier "+ pid.getValue()+" is invalid");
2209
                  }
2210
              } catch (SQLException ee) {
2211
                  ee.printStackTrace();
2212
                  throw new NotFound("1340", "The provided identifier "+ pid.getValue()+" is invalid");
2213
              } catch (AccessionNumberException ee) {
2214
                  ee.printStackTrace();
2215
                  throw new NotFound("1340", "The provided identifier "+ pid.getValue()+" is invalid");
2216
              }
2193 2217
          } catch (SQLException e) {
2194 2218
              throw new ServiceFailure("1350", "There was a problem archiving the object." + "The error message was: " + e.getMessage());
2195 2219

  

Also available in: Unified diff