Forums

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

How do add space shortcuts to my space blueprint?

Deleted user
December 8, 2020

I'm creating a customized space blueprint, but can't seem to figure out how to add automatic space shortcuts (or quick links). I tried following this tutorial: but it doesn't work.

This is code I used from the tutorial:

atlassian-plugin.xml

<web-item key="space-admin-quick-link-manager" name="Quick Link Manager in Space Admin" section="system.space.tools/addons" weight="100">
<label key="space.admin.quick.link.manager" />
<link linkId="space-admin-quick-link-manager-id">/plugins/${project.artifactId}/add-link.action?key=$generalUtil.urlEncode($helper.spaceKey)</link>
<condition class="com.atlassian.confluence.plugin.descriptor.web.conditions.SpaceSidebarCondition"/>
</web-item>

<xwork name="Example Actions" key="example-actions">
<description>Examples of actions</description>
<package name="space-links-xwork-package" extends="default" namespace="/plugins/${project.artifactId}">
<default-interceptor-ref name="validatingStack"/>

<action name="add-link" class="com.project.plugins.racyics.confluence.projectspacebp.MyAction" method="doCreate">
<result name="input" type="velocity">/templates/add-link-action.vm</result>
<result name="success" type="velocity">/templates/add-link-action.vm</result>
</action>
</package>
</xwork>

 

 

MyAction.java

public class MyAction extends AbstractSpaceAction {
private SidebarLinkService sidebarLinkService;
private String message;
private String confirm;

public String doCreate() throws Exception { 


if (!"true".equals(confirm)) {
message = "Please confirm you want to add a link to this space.";
return INPUT;
}


Space space = getSpace();
if (space == null) {
message = "The Space wasn't found.";
return INPUT;
}
long id = space.getHomePage().getId();
boolean exists = sidebarLinkService.hasQuickLink(this.getSpaceKey(), id);


if (!exists){
sidebarLinkService.create(getSpaceKey(), id, null, null);
message = "Link added";
}
else {
message = "Link already exists";
}

return SUCCESS;
}

 

Thanks in advance for the help.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events