Project

General

Profile

« Previous | Next » 

Revision 6099

-remove system metadata guid -> local id mapping (there is no document for system metadata now)
-include system metadata elements when replicating data objects (TODO: transfer all system metadata structures with the docinfo request).
TODO: remove docid+rev from the systemMetadata table definition

View differences:

CrudService.java
478 478
                    permissionType + " on doc with localid " + docid);
479 479
            handler.setAccess(metacatUrl, sessionData.getUserName(), docid, 
480 480
                    principal, permNum, permissionType, permissionOrder);
481
            if(setSystemMetadata)
482
            {
483
                //set the same perms on the system metadata doc
484
                String smlocalid = im.getSystemMetadataLocalId(id.getValue());
485
                logCrud.debug("setting access on SM doc with localid " + smlocalid);
486
                //cs.setAccess(token, smid, principal, permission, permissionType, permissionOrder);
487
                handler.setAccess(metacatUrl, sessionData.getUserName(), smlocalid,
488
                        principal, permNum, permissionType, permissionOrder);
489
            }
481
            
490 482
            String username = "public";
491 483
            if(sessionData != null)
492 484
            {
......
1216 1208
        
1217 1209
    	logMetacat.debug("CrudService.getSystemMetadata - for guid: " + guid.getValue());
1218 1210
        
1219
        IdentifierManager im = IdentifierManager.getInstance();
1220
        String localId = null;
1221 1211
        SystemMetadata sysmeta = null;
1222 1212
		try {
1223
			localId = im.getSystemMetadataLocalId(guid.getValue());
1224 1213
	        // look up the SysMeta
1225
	        sysmeta = im.getSystemMetadata(localId);
1214
	        sysmeta = IdentifierManager.getInstance().getSystemMetadata(guid.getValue());
1226 1215
		} catch (McdbDocNotFoundException e) {
1227 1216
			e.printStackTrace();
1228
			throw new NotFound(null, "Could not locate SystemMetadata for localId: " + localId);
1217
			throw new NotFound(null, "Could not locate SystemMetadata for: " + guid.getValue());
1229 1218
		}        
1230 1219

  
1231
		logCrud.info("getsystemmetadata D1GUID:" + guid.getValue()  + ":D1SYSMETADATA:"+ localId + ":");
1220
		logCrud.info("getsystemmetadata D1GUID:" + guid.getValue());;
1232 1221
        
1233 1222
        return sysmeta;
1234 1223
                   
......
1483 1472
        throws ServiceFailure 
1484 1473
    {
1485 1474
        logMetacat.debug("Starting to insert SystemMetadata...");
1486
    
1487
        // generate guid/localId pair for sysmeta
1488
        Identifier sysMetaGuid = new Identifier();
1489
        sysMetaGuid.setValue(DocumentUtil.generateDocumentId(1));
1490 1475
        sysmeta.setDateSysMetadataModified(new Date());
1491 1476
        logCrud.debug("****inserting new system metadata with modified date " + 
1492 1477
                sysmeta.getDateSysMetadataModified());
1493 1478

  
1494
        //insert the system metadata doc id into the systemmetadata table to 
1495
        //link it to the data or metadata document
1496
        IdentifierManager.getInstance().createSystemMetadataMapping(
1497
                sysmeta, sysMetaGuid.getValue());
1479
        //insert the system metadata
1480
        IdentifierManager.getInstance().createSystemMetadata(sysmeta);
1481
        IdentifierManager.getInstance().updateSystemMetadata(sysmeta);
1498 1482
        
1499
        IdentifierManager.getInstance().insertAdditionalSystemMetadataFields(sysmeta);
1500
        
1501 1483
    }
1502 1484
    
1503 1485
    /**
......
1512 1494
        {
1513 1495
            logCrud.debug("Setting date modified to " + new Date());
1514 1496
            sm.setDateSysMetadataModified(new Date());
1515

  
1516
            IdentifierManager.getInstance().insertAdditionalSystemMetadataFields(sm);
1517
                        
1497
            IdentifierManager.getInstance().updateSystemMetadata(sm);
1518 1498
        }
1519 1499
        catch(Exception e)
1520 1500
        {
......
1602 1582
            try
1603 1583
            {
1604 1584
                logCrud.debug("updating guid " + guid.getValue());
1605
                if(!isSystemMetadata)
1606
                {
1607
                    logCrud.debug("looking in identifier table for guid " + guid.getValue());
1608
                    localId = im.getLocalId(guid.getValue());
1609
                }
1610
                else
1611
                {
1612
                    logCrud.debug("looking in systemmetadata table for guid " + guid.getValue());
1613
                    localId = im.getSystemMetadataLocalId(guid.getValue());
1614
                }
1585
                logCrud.debug("looking in identifier table for guid " + guid.getValue());
1586
                
1587
                localId = im.getLocalId(guid.getValue());
1588
                
1615 1589
                logCrud.debug("localId: " + localId);
1616 1590
                //increment the revision
1617 1591
                String docid = localId.substring(0, localId.lastIndexOf("."));

Also available in: Unified diff