1
votes

This query is related to Rational Clear Case Cm api programming using java. We have a requirement wherein we want to get the list of modified files of a particular stream. I am able to get the list of activities which are of type CcActivity from given Stream and Using that activitylist info I am able to fetch the Version information also. I am unable to get the changeset information ie name of files which are modified, as there is no such method defined.

Could you please help me out as to which property or method I should use to fetch the list of mopdified file or changeset information using activity id or version information. Below is the code which I have written for getting activity list information and version information:-

PropertyRequest propertyrequest = new PropertyRequest(
                    CcStream.ACTIVITY_LIST,CcStream.TASK_LIST
                    );
            stream=(CcStream) stream.doReadProperties(propertyrequest);

            List<CcActivity> listOfAct = stream.getActivityList();
            for(int i=0;i<listOfAct.size();i++){

                CcActivity ccActivity = listOfAct.get(i);

                PropertyRequest activityPropertyRequest = new PropertyRequest(
                        CcActivity.COMMENT,CcActivity.ID,CcActivity.DISPLAY_NAME,CcActivity.LATEST_VERSION_LIST,CcActivity.CREATOR_DISPLAY_NAME,CcActivity.NAME_RESOLVER_VIEW
                        ,CcActivity.TASK_LIST,CcActivity.CREATOR_LOGIN_NAME,CcActivity.HEADLINE,CcActivity.COMMENT); 

                ccActivity = (CcActivity)ccActivity.doReadProperties(activityPropertyRequest);

trace(ccActivity.getDisplayName());
                trace(ccActivity.getCreatorDisplayName());
                trace("CREATOR_LOGIN_NAME :" +ccActivity.getCreatorLoginName());
                trace("Headline:" +ccActivity.getHeadline());


ResourceList<javax.wvcm.Version> versionList = ccActivity.getLatestVersionList();

                for(int j=0;j<versionList.size();j++){
                    Version version = versionList.get(j);
                    PropertyRequest versionPropertyRequest = new PropertyRequest(
                            Version.PREDECESSOR_LIST,Version.VERSION_NAME,Version.VERSION_HISTORY.nest(VersionHistory.CHILD_MAP),Version.DISPLAY_NAME,Version.COMMENT
                            ,Version.PATHNAME_LOCATION,Version.ACTIVITY.nest(Resource.CONTENT_TYPE)); 

                    version = (Version)version.doReadProperties(versionPropertyRequest);
                    trace("Version Info");

                    trace("Version Name : " + version.getVersionName());
                    trace("Version Comment :" +version.getComment());
1
The version name or path location should give you the file (element) part of this activity. - VonC
@VonC :- I am using version name but it is giving me output in following format:- Version Name : /main/AlnAuto_11_Int/Auto.03.38.00.00_Dev/6. It is not giving me the exact file name on which changes are done. and using path name property is giving me following error:- CRVAP0231E (property-retrieval-failed): 'pathname-location' Property {xmlns.rational.com/TEAM}pathname-location is currently empty on resource cc.repo.cc-activity:1577971@503edae3d5e24be6a36dba433c49b5e8 - Gazala Shaikh
Strange, unless that element is no longer visible in the current view (has been rmnamed) - VonC

1 Answers

1
votes

Old thread but I have recently been trying to learn how to list modified files through the API. I believe the issue is that version object returned by the ResourceList get method should be cast to CcVersion type.

This exposes the StpResource.doReadProperties(Resource context, Feedback feedback) method which requires a handle to the view we are interested in. We can also request the CcVersion specific properties that we are interested in.

The example would then become something like:

ResourceList<javax.wvcm.Version> versionList = ccActivity.getLatestVersionList();

            for(int j=0;j<versionList.size();j++){
                Version version = versionList.get(j);
                PropertyRequest versionPropertyRequest = new PropertyRequest(CcVersion.DISPLAY_NAME, CcVersion.VIEW_RELATIVE_PATH, CcVersion.CREATION_DATE); 

                version = (CcVersion) version.doReadProperties(view, versionPropertyRequest);
                trace("Version Info");

                trace("Version DISPLAY_NAME : " + version.getDisplayName());
                trace("Version VIEW_RELATIVE_PATH : " + version.getViewRelativePath());
                trace("Version CREATION_DATE : " + version.getCreationDate());
            }