Project

General

Profile

« Previous | Next » 

Revision 6974

remove {pid} from POST URL on CN.registerSystemMetadata()
https://redmine.dataone.org/issues/2284

View differences:

src/edu/ucsb/nceas/metacat/restservice/CNResourceHandler.java
177 177
                    }
178 178
                    // post to register system metadata
179 179
                    if (httpVerb == POST) {
180
                        registerSystemMetadata(extra);
180
                        registerSystemMetadata();
181 181
                        status = true;
182 182
                    }
183 183

  
......
614 614
        // Read the incoming data from its Mime Multipart encoding
615 615
        Map<String, File> files = collectMultipartFiles();
616 616
        
617
	     // get the encoded pid string from the body and make the object
617
	    // get the encoded pid string from the body and make the object
618 618
        String pidContent = multipartparams.get("pid").get(0);
619 619
        Identifier pid = TypeMarshaller.unmarshalTypeFromStream(Identifier.class, IOUtils.toInputStream(pidContent, "UTF-8"));
620 620
        
......
934 934
     * @throws IllegalAccessException
935 935
     * @throws InstantiationException
936 936
     */
937
    protected void registerSystemMetadata(String pid)
937
    protected void registerSystemMetadata()
938 938
            throws ServiceFailure, InvalidRequest, IOException,
939 939
            FileUploadException, JiBXException, NotImplemented, NotAuthorized,
940 940
            InvalidSystemMetadata, InstantiationException,
941 941
            IllegalAccessException {
942
        logMetacat.debug("Entering registerSystemMetadata: " + pid);
942
    	
943
    	// Read the incoming data from its Mime Multipart encoding
944
        Map<String, File> files = collectMultipartFiles();
945
        
946
    	// get the encoded pid string from the body and make the object
947
        String pidContent = multipartparams.get("pid").get(0);
948
        Identifier pid = TypeMarshaller.unmarshalTypeFromStream(Identifier.class, IOUtils.toInputStream(pidContent, "UTF-8"));
949
        
950
        logMetacat.debug("registerSystemMetadata: " + pid);
943 951

  
944 952
        // get the system metadata from the request
945
        SystemMetadata systemMetadata = collectSystemMetadata();
953
        File smFile = files.get("sysmeta");
954
        FileInputStream sysmeta = new FileInputStream(smFile);
955
        SystemMetadata systemMetadata = TypeMarshaller.unmarshalTypeFromStream(SystemMetadata.class, sysmeta);
946 956

  
947
        Identifier guid = new Identifier();
948
        guid.setValue(pid);
949
        logMetacat.debug("registering system metadata with pid "
950
                + guid.getValue());
951
        Identifier retGuid = CNodeService.getInstance(request)
952
                .registerSystemMetadata(session, guid, systemMetadata);
957
        logMetacat.debug("registering system metadata with pid " + pid.getValue());
958
        Identifier retGuid = CNodeService.getInstance(request).registerSystemMetadata(session, pid, systemMetadata);
953 959

  
954 960
        OutputStream out = response.getOutputStream();
955 961
        response.setStatus(200);

Also available in: Unified diff