Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

how to get all the IResource by current login user

hi,

Question 1: I would like to get all the IResource last modified by current login user?

I know how to get the author of a certain IResource by adapting to it: SCMPlatform.getWorkspaceManager(repo).versionableManager
().fetchCompleteState(shareable.getRemote(), monitor).getModifiedBy();

But I am not sure how to get the other way around (all IResource last modified by current login user).

Question 2: are there any listeners that I can use to keep track of the behavior of loading code from the server, e.g. I get notified every time the user check in new code or apply a patch from the work item. Please specify how.

Thanks for any info,
Owen

0 votes



6 answers

Permanent link
On Sun, 03 Aug 2008 21:27:55 +0000, jingweno wrote:

Question 1: I would like to get all the IResource last modified by
current login user?

I know how to get the author of a certain IResource:
SCMPlatform.getWorkspaceManager(repo).versionableManager
().fetchCompleteState(shareable.getRemote(), monitor).getModifiedBy();

You would have to get a list of all shareable.getRemote() currently
loaded per repo, and then fetchCompleteStates() on them.


Question 2: are there any listeners that I can use to keep track of the
check in behavior, e.g. I get notified every time the user check in new
code or apply a patch from the work item.

On checkin the IWorkspaceConnection sends ICommitEvent.COMMIT. As for
apply patch, I am not sure, there might be events the ComponentSyncModel
sends.

- Dmitry

0 votes


Permanent link
On Sun, 03 Aug 2008 21:27:55 +0000, jingweno wrote:

Question 1: I would like to get all the IResource last modified by
current login user?

I know how to get the author of a certain IResource:
SCMPlatform.getWorkspaceManager(repo).versionableManager
().fetchCompleteState(shareable.getRemote(), monitor).getModifiedBy();

You would have to get a list of all shareable.getRemote() currently
loaded per repo, and then fetchCompleteStates() on them.

could you be more specific by giving me a code snippet ? I am looking for a list of IResource last modified by current login user. I expect the procedure would be: getting current login user -> asking the server for results by criteria -> adapting the results back to IResource.

I am not familiar with the APIs and not sure whether its possible the results can be adapted back to IResource. And I don't how to get a list of all shareable.getRemote() either.

Thanks for any hints,
Owen

0 votes


Permanent link
On Tue, 05 Aug 2008 01:57:52 +0000, jingweno wrote:

I expect
the procedure would be: getting current login user -> asking the server
for results by criteria -> adapting the results back to IResource.

No, rather you would gather a list of all IResources, then figure out who
was the last user that modified them and then keep only those that were
modified by the user returned in repo.loggedInContributor().

- Dmitry

0 votes


Permanent link
On Tue, 05 Aug 2008 17:57:57 +0000, jingweno wrote:


Do you know how to get all the IResource that are shared in the Jazz
repository? Are there any APIs I can use?

final List<IResource> sharedResources = new ArrayList<IResource>();
ResourcesPlugin.getWorkspace().getRoot().accept(new IResourceVisitor() {
public boolean visit(IResource resource) throws CoreException {
IShareable s = (IShareable)resource.getAdapter(IShareable.class);
if (s != null && s.getRemote() != null) {
sharedResources.add(resource);
}
return true;
}
});

- Dmitry

0 votes


Permanent link

No, rather you would gather a list of all IResources, then figure out who
was the last user that modified them and then keep only those that were
modified by the user returned in repo.loggedInContributor().


Do you know how to get all the IResources that are shared in the Jazz repository? I mean how to get a list of IResources that have Jazz properties. Are there any APIs I can use?

0 votes


Permanent link
You would have to get a list of all shareable.getRemote() currently
loaded per repo, and then fetchCompleteStates() on them.


fetchCompleteStates() only returns a list of states (IVersionable) which I cannot get any local information from them, e.g. the local IPath of a IVersionalble.

To put it simple, the procedure is: 1. a list of IShareable -> 2. fetchCompleteStates() -> 3. a list of IVersionalble -> 4. a list of IResource by current login user.

Right now I can filter a list of IVersionable by current login user (step 3). But I can't get any local info such as IPath from it. Does anyone know get the IPath out of a IVersionable.

I also tried to adapt IVersionable back to IShareable/IResource but failed.

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 11,074

Question asked: Aug 03 '08, 5:27 p.m.

Question was seen: 11,884 times

Last updated: Aug 03 '08, 5:27 p.m.

Confirmation Cancel Confirm