How to fetch history of elements using ClearCase C

2019-02-19 11:06发布

问题:

I want to fetch history of file elements like pdf files, doc files, etc. which are under clearcase control using Rational CM API which are provided by clearcase. I have written following code to fetch the history but it is incomplete so please help me out here.

public void fetchFileElementHistory()
{
    try
    {
        CcFile fetchElement = provider.ccFile(provider.filePathLocation(testFile)); // file under Clearcase control
        PropertyRequest wantedProps = new PropertyRequest(CcFile.DISPLAY_NAME, CcFile.CREATION_DATE,CcFile.VIEW_RELATIVE_PATH,CcFile.CLIENT_PATH,CcFile.VERSION_HISTORY,CcFile.PREDECESSOR_LIST,CcFile.ELEMENT);
        fetchElement = (CcFile) fetchElement.doReadProperties(wantedProps);
        VersionHistory versionHistory = fetchElement.getVersionHistory();
        versionHistory = (VersionHistory) versionHistory.doReadProperties(new PropertyRequest(VersionHistory.CHILD_LIST,VersionHistory.ROOT_VERSION,
                VersionHistory.CHILD_MAP,VersionHistory.PARENT_LIST,VersionHistory.PROVIDER_LIST,VersionHistory.WORKSPACE_FOLDER_LIST));
        /*
         * what to do here ? 
         */
    }
    catch(Exception e){
        e.printStackTrace();
    }
}

Thanks in advance

回答1:

The official documentation for CM API 7.1.x.
Make sure you have selected the "CM Library Samples and Documentation" feature under the Client Components section of the install. in order to check the code examples included with the javadoc.

From the object model overview, check if collections apply your case.