Project

General

Profile

« Previous | Next » 

Revision 7024

only generate system metadata when the call comes from the legacy Metacat API, not the D1 API.
https://redmine.dataone.org/issues/2362 (I think this was the culprit)

View differences:

src/edu/ucsb/nceas/metacat/MetaCatServlet.java
891 891
				PrintWriter out = response.getWriter();
892 892
				if ((userName != null) && !userName.equals("public")) {
893 893
					handler.handleInsertOrUpdateAction(request.getRemoteAddr(), request.getHeader("User-Agent"), response, out, params, userName,
894
							groupNames);
894
							groupNames, true);
895 895
				} else {
896 896
					response.setContentType("text/xml");
897 897
					out.println("<?xml version=\"1.0\"?>");
src/edu/ucsb/nceas/metacat/MetacatHandler.java
1627 1627
     * Handle the database putdocument request and write an XML document to the
1628 1628
     * database connection
1629 1629
     * @param userAgent 
1630
     * @param generateSystemMetadata 
1630 1631
     */
1631 1632
    public String handleInsertOrUpdateAction(String ipAddress, String userAgent,
1632 1633
            HttpServletResponse response, PrintWriter out, Hashtable<String, String[]> params,
1633
            String user, String[] groups) {
1634
            String user, String[] groups, boolean generateSystemMetadata) {
1634 1635
        Logger logMetacat = Logger.getLogger(MetacatHandler.class);
1635 1636
        DBConnection dbConn = null;
1636 1637
        int serialNumber = -1;
......
1815 1816
              mde.setGroups(groups);
1816 1817
              MetacatEventService.getInstance().notifyMetacatEventObservers(mde);
1817 1818
              
1818
              // Check for existing system metadata for the docid. Update
1819
              // or create it as necessary, but only for non-DataONE
1820
              // calls to handleInsertOrUpdateAction()
1821
              if ( !(ipAddress.contains("/d1")) ) {
1819
              // if it was called from Metacat API, we want to generate system metadata for it
1820
              if ( generateSystemMetadata ) {
1822 1821
                
1823 1822
                SystemMetadata sysMeta = null;
1824 1823
				// it's possible that system metadata exists although
......
2869 2868
                params.put("doctext", doctextArr);
2870 2869
                //call the insert routine
2871 2870
                handleInsertOrUpdateAction(request.getRemoteAddr(), request.getHeader("User-Agent"), response, out, 
2872
                          params, username, groupnames);
2871
                          params, username, groupnames, true);
2873 2872
              }
2874 2873
              catch(Exception e)
2875 2874
              {
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
925 925
    // do the insert or update action
926 926
    handler = new MetacatHandler(new Timer());
927 927
    String result = handler.handleInsertOrUpdateAction(request.getRemoteAddr(), request.getHeader("User-Agent"), null, 
928
                        null, params, username, groupnames);
928
                        null, params, username, groupnames, false);
929 929
    
930 930
    if(result.indexOf("<error>") != -1) {
931 931
    	String detailCode = "";

Also available in: Unified diff