java - Get the full path of a file at change set -



java - Get the full path of a file at change set -

i searching .txt file located @ alter set. need create locally on pc total path directory of file.

for illustration if there file called"test.txt" it's located at: project1-->folder1-->folder2-->test.txt

till have managed search file. need fetch total directory , create similar 1 on pc: result @ pc: folder1-->folder2-->test.txt

that's did search file within changeset , retrieve it:

public ifileitem gettextfilefile(ichangeset changeset, iteamrepository repository) throws teamrepositoryexception{ iversionablemanager vm = scmplatform.getworkspacemanager(repository).versionablemanager(); list changes = changeset.changes(); ifileitem toreturn = null; for(int i=0;i<changes.size();i++) {="" <br=""> alter change = (change) changes.get(i); iversionablehandle after = change.afterstate(); if( after != null && after instanceof ifileitemhandle) { ifileitem fileitem = (ifileitem) vm.fetchcompletestate(after, null); if(fileitem.getname().contains(".txt")) { toreturn = fileitem; break; } else { continue; } } } if(toreturn == null){ throw new teamrepositoryexception("could not find file"); } homecoming toreturn; }

i utilize rtc:4 win:xp

thanks in advance.

i have next iconfiguration fetched following:

iworkspacemanager workspacemanager = scmplatform.getworkspacemanager(repository); iworkspacesearchcriteria wssearchcriteria = workspacesearchcriteria.factory.newinstance(); wssearchcriteria.setkind(iworkspacesearchcriteria.streams); wssearchcriteria.setpartialownernameignorecase(projectareaname); list <iworkspacehandle> workspacehandles = workspacemanager.findworkspaces(wssearchcriteria, integer.max_value, application.getmonitor());  iworkspaceconnection workspaceconnection = workspacemanager.getworkspaceconnection(workspacehandles.get(0),application.getmonitor()); icomponenthandle component = changeset.getcomponent(); iconfiguration configuration = workspaceconnection.configuration(component); list lst = new arraylist<string>(); lst=configuration.locateancestors(lst,application.getmonitor());

=========================================

now total path of file item ,i made next method got :

https://jazz.net/forum/questions/94927/how-do-i-find-moved-from-location-for-a-movedreparented-item-using-rtc-4-java-api

=========================================

private string getfullpath(list ancestor, iteamrepository repository) throws teamrepositoryexception { string directorypath = ""; (object ancestorobj : ancestor) { iancestorreport ancestorimpl = (iancestorreport) ancestorobj; (object nameitempairobj : ancestorimpl.getnameitempairs()) { nameitempairimpl nameitempair = (nameitempairimpl) nameitempairobj; object item = scmplatform.getworkspacemanager(repository) .versionablemanager() .fetchcompletestate(nameitempair.getitem(), null); string pathname = ""; if (item instanceof ifolder) { pathname = ((ifolder) item).getname(); } else if (item instanceof ifileitem) { pathname = ((ifileitem) item).getname(); } if (!pathname.equals("")) directorypath = directorypath + "\\" + pathname; } } homecoming directorypath; }

=========================================

java rtc jazz

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -