cancel
Showing results for 
Search instead for 
Did you mean: 

Get document node in finishImpl()

nparry
Champ in-the-making
Champ in-the-making
Hello,

I've been trying to implement a custom dialog.  I've been following the aspect dialog example in the SDK, and I've been able to add a menu item to the "more options" menu on a document, as well as set up the dialog.  When the OK button is pushed on the dialog, finishImpl is called in the java class like it should be.  My question:

How do you access the document node that you ran the dialog on?  I need it for the finishImpl function.  Also, how do you access the input fields of the dialog?

My web-client-custom.xml is as follows:


<alfresco-config>
   <config>
      <actions>
         <action id="custom_action">
            <permissions>
           <permission allow="true">Write</permission>
         </permissions>
            <tooltip>…</tooltip>
            <label>…</label>
            <image>…</image>
            <action>dialog:customDialog</action>
             <action-listener>#{CustomBean.actionListenFunction}</action-listener>
            <params>
               <param name="id">#{actionContext.id}</param>
            </params>
         </action>
         
         <action-group id="document_browse_menu">
            <action idref="custom_action" />
         </action-group>
         
       
      </actions>
      
      <dialogs>
         <dialog name="customDialog" page="/jsp/customJSP.jsp" managed-bean="MyCustomDialog"
                 icon="/images/icons/icon.gif" title="…"
                 description="…" />
    </dialogs>
   
    
   </config>
  
   

</alfresco-config>


My dialog implementation is status-quo:


public class MyCustomDialog extends BaseDialogBean
{
  
  
   @Override
   protected String finishImpl(FacesContext context, String outcome) throws Exception
   {
      System.out.println("finishImpl called");
      return outcome;
   }

   @Override
   public boolean getFinishButtonDisabled()
   {
      return false;
   }

 
}

I can get the node of the space it's in, but I can't get the actual content node.

Thanks,
Nick P
1 REPLY 1

gavinc
Champ in-the-making
Champ in-the-making
To get access to the node you are doing the action for you need to call the setupContentAction action handler on BrowseBean i.e. your action config should be:

<action-listener>#{BrowseBean.setupContentAction}</action-listener>

If you need to do some other processing you can call a custom handler like you have currently but make sure you also call setupContentAction() on BrowseBean (this should be available as a member variable in your dialog bean).

Once you have done this you can do the following within your dialog:

Node node = this.browseBean.getDocument();

As for the input fields you need to have getter and setter methods for all the fields on the JSP and value bind them to your bean. See org.alfresco.web.bean.wcm.CreateWebsiteWizard and /jsp/wcm/create-website-wizard/details.jsp as an example (ignore the fact it's a wizard the concept is the same, just change WizardManager.bean.xxx to DialogManager.bean.xxxx).

Hope this helps.