Project

General

Profile

« Previous | Next » 

Revision 5333

Added by berkley almost 14 years ago

adding a system to track system metadata documents for dataone

View differences:

CrudService.java
106 106
     */
107 107
    public CrudService(ServletContext servletContext,
108 108
            HttpServletRequest request, HttpServletResponse response) {
109
    //change crud service into a singleton.  dont pass servlet data structures here
110
    
109 111
        this.servletContext = servletContext;
110 112
        this.request = request;
111 113
        this.response = response;
......
491 493
    private void insertSystemMetadata(SystemMetadata sysmeta, SessionData sessionData) 
492 494
        throws ServiceFailure {
493 495
        logMetacat.debug("Starting to insert SystemMetadata...");
494
        IdentifierManager im = IdentifierManager.getInstance();
495 496
    
496 497
        // generate guid/localId pair for sysmeta
497 498
        Identifier sysMetaGuid = new Identifier();
......
499 500
        sysmeta.setDateSysMetadataModified(new Date());
500 501

  
501 502
        String xml = new String(serializeSystemMetadata(sysmeta).toByteArray());
502
        insertDocument(xml, sysMetaGuid, sessionData);
503
        String localId = insertDocument(xml, sysMetaGuid, sessionData);
504
        //insert the system metadata doc id into the identifiers table to 
505
        //link it to the data or metadata document
506
        IdentifierManager.getInstance().createSystemMetadataMapping(sysMetaGuid.getValue(), localId);
503 507
    }
504 508
    
505
    private void insertDocument(String xml, Identifier guid, SessionData sessionData) 
509
    /**
510
     * insert a document, return the id of the document that was inserted
511
     */
512
    private String insertDocument(String xml, Identifier guid, SessionData sessionData) 
506 513
        throws ServiceFailure {
507 514
        logMetacat.debug("Starting to insert xml document...");
508 515
        IdentifierManager im = IdentifierManager.getInstance();
......
536 543
//        if (!(outputS.indexOf("<success>") > 0 && outputS.indexOf(localId) > 0)) {
537 544
//            throw new ServiceFailure(1190, outputS);
538 545
//        }
539
        logMetacat.debug("Finsished inserting xml document.");
546
        logMetacat.debug("Finsished inserting xml document with id " + localId);
547
        return localId;
540 548
    }
541 549
    
542 550
    public static ByteArrayOutputStream serializeSystemMetadata(SystemMetadata sysmeta) 

Also available in: Unified diff