Highlighted
psciascia Honored Contributor.
Honored Contributor.
504 views

Using the SDK to get all share

Jump to solution

 There has been a lot of pollution on our server with ChangeRequest being shared back and forth between views and sometimes in fdirfferent folders of the same view.

I am trying to do a cleanup routine that will identify all the CR shares starting from the CRs in a given view.

Using the viewmembercollection of the view I can easily get all the CRs.

Then from each CR I can get the Parent and Child Shares.

However, I know that there are many more complex shares involved (ex: Root was shared to two other views, then a share was created in a target view back to the root view, etc...you get the picture).

Is there a way to get the entire Share Tree of a CR or do I have to run a complex traverse algorithm that will cover all possible directions?

 

Tags (2)
0 Likes
Reply
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

RE: Using the SDK to get all share

Jump to solution
Hi Patrick,
There's an SDK api for that.

/**
* Returns the shares for this view member.
*
* @return All shares of this view member
*/
public Share[] ViewMember::getAllShares() {

this returns the share tree for any viewmember, (in your case, a CR is a viewmember)

you'll need to walk the share tree, and process the shares accordingly.

from the data structure of the Share object, you can extract the cr's viewmemberid, viewid, projectid, etc, then resolve each share to its corresponding project/view.

you'll find tests that process the share tree in the test suite, for examples of how to go about doing it...

take care,
anil
0 Likes
Reply
2 Replies
Micro Focus Expert
Micro Focus Expert

RE: Using the SDK to get all share

Jump to solution
Hi Patrick,
There's an SDK api for that.

/**
* Returns the shares for this view member.
*
* @return All shares of this view member
*/
public Share[] ViewMember::getAllShares() {

this returns the share tree for any viewmember, (in your case, a CR is a viewmember)

you'll need to walk the share tree, and process the shares accordingly.

from the data structure of the Share object, you can extract the cr's viewmemberid, viewid, projectid, etc, then resolve each share to its corresponding project/view.

you'll find tests that process the share tree in the test suite, for examples of how to go about doing it...

take care,
anil
0 Likes
Reply
psciascia Honored Contributor.
Honored Contributor.

RE: Using the SDK to get all share

Jump to solution
Ah, see, I didn't think of going to the viewmember object.

Thanks,
0 Likes
Reply
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.