Advertisement
DrupalCustom

draft dummy

Jun 15th, 2012
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.32 KB | None | 0 0
  1. package com.lionbridge.confluence.plugins;
  2.  
  3.  
  4.  
  5. import com.atlassian.confluence.core.ConfluenceActionSupport;
  6. import com.atlassian.confluence.labels.Label;
  7. import com.atlassian.confluence.labels.LabelManager;
  8. import com.atlassian.confluence.pages.AbstractPage;
  9. import com.atlassian.confluence.pages.actions.PageAware;
  10.  
  11. /**
  12.  * This Confluence action adds the label 'draft' to the page or blog post when a user selects it from the
  13.  * 'Tools' menu in Confluence. Refer to the 'atlassian-plugin.xml' file for details on how this action is
  14.  * implemented in Confluence.
  15.  */
  16. public class AddDraftLabelAction extends ConfluenceActionSupport implements PageAware
  17. {
  18.     /**
  19.      *
  20.      */
  21.     private static final long serialVersionUID = -7600642870339040144L;
  22.     private AbstractPage page;
  23.     private LabelManager labelManager;
  24.  
  25.     /**
  26.      * Implementation of PageAware
  27.      */
  28.     public AbstractPage getPage()
  29.     {
  30.         return page;
  31.     }
  32.    
  33.  
  34.  
  35.     /**
  36.      * Implementation of PageAware
  37.      */
  38.     public void setPage(AbstractPage page)
  39.     {
  40.         this.page = page;
  41.     }
  42.  
  43.     /**
  44.      * Implementation of PageAware:
  45.      * Returning 'true' ensures that the
  46.      * page is set before the action commences.
  47.      */
  48.     public boolean isPageRequired()
  49.     {
  50.         return true;
  51.     }
  52.  
  53.     /**
  54.      * Implementation of PageAware:
  55.      * Returning 'true' ensures that the
  56.      * current version of the page is used.
  57.      */
  58.     public boolean isLatestVersionRequired()
  59.     {
  60.         return true;
  61.     }
  62.  
  63.     /**
  64.      * Implementation of PageAware:
  65.      * Returning 'true' ensures that the user
  66.      * requires page view permissions.
  67.      */
  68.     public boolean isViewPermissionRequired()
  69.     {
  70.         return true;
  71.     }
  72.  
  73.     /**
  74.      * Dependency-injection of the Confluence LabelManager.
  75.      */
  76.     public void setLabelManager(LabelManager labelManager)
  77.     {
  78.         this.labelManager = labelManager;
  79.         System.out.println("This is labelmanager " + labelManager);
  80.     }
  81.  
  82.     public String execute()
  83.     {
  84.         // page is already retrieved by Confluence's PageAwareInterceptor
  85.         // labelManager is injected by Confluence -- see setLabelManager() below
  86.         Label label = new Label("draft");
  87.         labelManager.addLabel(page, label);
  88.         return "success";
  89.     }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement