core/src/main/java/org/sakaiproject/nakamura/lite/content/ContentManagerImpl.java
public InputStream getVersionInputStream(String path, String versionId, String streamId) throws AccessDeniedException,
            StorageClientException, IOException {
        long t = System.currentTimeMillis();
        try {
            accessControlManager.check(Security.ZONE_CONTENT, path, Permissions.CAN_READ);
            checkOpen();
            Map<String, Object> structure = getCached(keySpace, contentColumnFamily, path);
            if (exists(structure)) {
                String contentId = (String) structure.get(STRUCTURE_UUID_FIELD);
                Map<String, Object> content = getCached(keySpace, contentColumnFamily, contentId);
                if (exists(content)) {
                    String versionHistoryId = (String) content.get(VERSION_HISTORY_ID_FIELD);
                    if (versionHistoryId != null) {
                        Map<String, Object> versionHistory = getCached(keySpace, contentColumnFamily, versionHistoryId);
                        if (versionHistory != null && versionHistory.containsKey(versionId)) {
                            return internalGetInputStream(versionId, streamId);
                        }
                    }
                }
            }
            return null;
        } finally {
            statsService.apiCall(ContentManagerImpl.class.getName(), "egtVersionInputStream", System.currentTimeMillis() - t);
        }
    }
public InputStream getVersionInputStream(String path, String versionId, String streamId) throws AccessDeniedException,
            StorageClientException, IOException {
        long t = System.currentTimeMillis();
        try {
            accessControlManager.check(Security.ZONE_CONTENT, path, Permissions.CAN_READ);
            checkOpen();
            Map<String, Object> structure = getCached(keySpace, contentColumnFamily, path);
            if (exists(structure)) {
                String contentId = (String) structure.get(STRUCTURE_UUID_FIELD);
                Map<String, Object> content = getCached(keySpace, contentColumnFamily, contentId);
                if (exists(content)) {
                    String versionHistoryId = (String) content.get(VERSION_HISTORY_ID_FIELD);
                    if (versionHistoryId != null) {
                        Map<String, Object> versionHistory = getCached(keySpace, contentColumnFamily, versionHistoryId);
                        if (versionHistory != null && versionHistory.containsKey(versionId)) {
                            return internalGetInputStream(versionId, streamId);
                        }
                    }
                }
            }
            return null;
        } finally {
            statsService.apiCall(ContentManagerImpl.class.getName(), "egtVersionInputStream", System.currentTimeMillis() - t);
        }
    }
public InputStream getVersionInputStream ( String path , String versionId , String streamId ) throws AccessDeniedException , StorageClientException , IOException { long t = System . currentTimeMillis ( ) ; try { accessControlManager . check ( Security . ZONE_CONTENT , path , Permissions . CAN_READ ) ; checkOpen ( ) ; Map < String , Object > structure = getCached ( keySpace , contentColumnFamily , path ) ; if ( exists ( structure ) ) { String contentId = ( String ) structure . get ( STRUCTURE_UUID_FIELD ) ; Map < String , Object > content = getCached ( keySpace , contentColumnFamily , contentId ) ; if ( exists ( content ) ) { String versionHistoryId = ( String ) content . get ( VERSION_HISTORY_ID_FIELD ) ; if ( versionHistoryId != null ) { Map < String , Object > versionHistory = getCached ( keySpace , contentColumnFamily , versionHistoryId ) ; if ( versionHistory != null && versionHistory . containsKey ( versionId ) ) { return internalGetInputStream ( versionId , streamId ) ; } } } } return null ; } finally { statsService . apiCall ( ContentManagerImpl . class . getName ( ) , "egtVersionInputStream" , System . currentTimeMillis ( ) - t ) ; } }
TODO: Unit test
TODO : Unit test