The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to get diffs URL in notifier email when a push is done in stash

Deleted user
July 24, 2014

Hello,

I am very new to Java development. I am writing a hook that sends out a email when a push is done in Stash. This email should have URL to diffs. I am using contentService.streamDirectory but I am not getting URL in the output. Please take a look at below code and help me on this.

public void explore(final Repository repository, String objectId, final StringBuilder sb){

String path= ""; //ToDO ContentTreeNode childNode != null ? node.getPath().toString() : "";

boolean recursive = true;

if (contentService.getType(repository, objectId, path) == ContentTreeNode.Type.DIRECTORY)

{

final List<ContentTreeNode> nodes = new ArrayList<ContentTreeNode>();

contentService.streamDirectory(repository, objectId, path, recursive, new AbstractContentTreeCallback(){

@Override

public boolean onTreeNode(ContentTreeNode node) throws IOException {

nodes.add(node);

String link = node.getPath().toString();

sb.append( link );

//Using below line I am trying to create a hyperlink.

sb.append( "<li><a href=\"" ).append( repository ).append(link).append( node.getPath() ).append( "\"diff" ).append( "\">")

.append(node.getPath()).append("</a></li>");

sb.append("\n");

return true;

}

}, new PageRequestImpl(0, PushEmailNotifier.MAX_PAGE_REQUEST));

}

}

I am using Atlassian SDK with stash 2.11 version. I really appreciate your help.

Thanks,

iihitp

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
July 30, 2014

For getting the right URL, use the NavBuilder class instead of trying to construct it this way.

TAGS
AUG Leaders

Atlassian Community Events