cancel
Showing results for 
Search instead for 
Did you mean: 

Add new panels to Advanced Search

rrobles
Champ in-the-making
Champ in-the-making
I'm trying add new panels to Advanced Search. I think, the best way is custom advanced-search.jsp and extend the class AdvancedSearchDialog. And I followed the next steps.
       1. I have created my class
                 

                   package com.example.web.bean;
import org.alfresco.web.bean.search.AdvancedSearchDialog;

public class CustomAdvancedSearchDialog extends AdvancedSearchDialog {
   
   protected String example = new String("Example");

   
   public String getExample() {
      return this.example;
   }
   
   public void setExample(String example) {
      this.example = example;
   }
}
   2. I have added a manage bean in META-INF/faces-config.xml
     

    <!– Advanced Search –>
<managed-bean>
      <description>
         The bean that holds a state for the Advanced Search screen.
      </description>
      <managed-bean-name>CustomAdvancedSearchDialog</managed-bean-name>
      <managed-bean-class>com.example.web.bean.CustomAdvancedSearchDialog</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      <managed-property>
         <property-name>navigator</property-name>
         <value>#{NavigationBean}</value>
      </managed-property>
      <managed-property>
         <property-name>nodeService</property-name>
         <value>#{NodeService}</value>
      </managed-property>
      <managed-property>
         <property-name>namespaceService</property-name>
         <value>#{NamespaceService}</value>
      </managed-property>
      <managed-property>
         <property-name>searchService</property-name>
         <value>#{SearchService}</value>
      </managed-property>
      <managed-property>
         <property-name>permissionService</property-name>
         <value>#{PermissionService}</value>
      </managed-property>
      <managed-property>
         <property-name>properties</property-name>
         <value>#{SearchProperties}</value>
      </managed-property>
   </managed-bean>

  3. I have changed the rule navigation  in faces-config.xml
   

       <!– Advanced Search –>
  
     <navigation-rule>
      <from-view-id>/jsp/*</from-view-id>
      <navigation-case>
         <from-outcome>advSearch</from-outcome>
         <to-view-id>/jsp/extension/search/advanced-search.jsp</to-view-id>
      </navigation-case>
   </navigation-rule>
   

  4. In my model, I have added new bean
      

    <bean id="CustomAdvancedSearchDialog" class="com.example.web.bean.CustomAdvancedSearchDialog" >
    </bean>
      

   5. Finally, I have tried change from advanced-search.jsp with my customize class
    

          
          <h:outputText value="#{CustomAdvancedSearchDialog.example}"/>
    
     And it works

     But when I put
    

          
          <h:outputText value="#{CustomAdvancedSearchDialog.categoriesDataModel.rowCount}"/>
    
     it doesn't work.
    

javax.faces.FacesException: javax.faces.el.EvaluationException: Cannot get value for expression '#{CustomAdvancedSearchDialog.categoriesDataModel.rowCount != 0}'
caused by:
org.apache.jasper.JasperException: javax.faces.el.EvaluationException: Cannot get value for expression '#{CustomAdvancedSearchDialog.categoriesDataModel.rowCount != 0}'
caused by:
javax.faces.el.EvaluationException: Cannot get value for expression '#{CustomAdvancedSearchDialog.categoriesDataModel.rowCount != 0}'
caused by:
javax.faces.el.EvaluationException: Exception getting value of property categoriesDataModel of base of type : com.example.web.bean.CustomAdvancedSearchDialog
caused by:
javax.faces.el.EvaluationException: Bean: es.citic.web.bean.CustomAdvancedSearchDialog, property: categoriesDataModel
caused by:
java.lang.reflect.InvocationTargetException
caused by:
java.lang.NullPointerException
 
     When you extend a class in java, the class keeps the methods of parent class, doesn't it?,
     Anybody now which is the problem?

Thanks
1 REPLY 1

rrobles
Champ in-the-making
Champ in-the-making
I have found which was the problem.

The manage-bean must be declarated in faces-config-custom.xml