2

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

Ajinkya
  • 125
  • 7
  • the question is too generic, alike "why my code is not working". – Farside Mar 21 '16 at 13:13
  • You should have an iterator availaible on `VersionHistory` for you to use in a loop. – VonC Mar 21 '16 at 13:46
  • @VonC can you share some sample code for your solution. Actually i tried using iterator but was not able to get history properly. It will be very helpfull if you share some code sample for this. – Ajinkya Mar 22 '16 at 07:10
  • @Ajinkya I don't have access to a ClearCase to test it right now, but what id you try? And what issue did you get? – VonC Mar 22 '16 at 07:10
  • In the above code both child map and child list are empty. So don't know what property fetch after this. – Ajinkya Mar 22 '16 at 07:12
  • @VonC i tried to iterate over child list and child map, but child map property is not supported by clearcase and Child list is empty. So can you tell after fetching VersionHistory from element what should i fetch next to fetch history. – Ajinkya Mar 22 '16 at 07:24
  • @Ajinkya are you sure that element has multiple version? What CM API version are you using? With which ClearCase version? – VonC Mar 22 '16 at 07:29
  • @VonC i am sure that element has multiple versions, b'coz i can see history through UI. I am using CM API that comes with clearcase 7.1.2 – Ajinkya Mar 22 '16 at 08:35
  • I have added below the few links I can find. – VonC Mar 22 '16 at 09:14

1 Answers1

0

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I have already gone through these links but they haven't given any sample code for VersionHistory Object. – Ajinkya Mar 22 '16 at 10:06