cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to start dialog as managed bean

hagitok1
Champ in-the-making
Champ in-the-making
Hi all,

I have added  a custom dialog according to the explenations in http://wiki.alfresco.com/wiki/Adding_a_Custom_Dialog.
The dialog had worked correctly, Then I have tried to add another dialog and failed.From that point also the original dialog that worked properly stopped working even after I have cancelled the additional modification. I see the new menu item but when I try to activate the dialog I get the following message
org.alfresco.error.AlfrescoRuntimeException: 04040002 Failed to start dialog as managed bean 'CreateScPostDialog' has not been defined

As there a way to know why alfresco claims that the amanged bean is not defined ?

Following are the components that I have added to alfresco:

solidcam.jar in Alfresco\tomcat\webapps\alfresco\WEB-INF\lib as follows:

> alfresco
   > extension
      > web-client-config-custom.xml
> META-INF
   > faces-config.xml
   > MANIFEST.MF
> org 
   > alfresco
      > solidcam
         > CreateScPostDialog.class


create-sc-post.jsp in in Alfresco\tomcat\webapps\alfresco\jsp\extension

<%–

–%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>

<f:verbatim>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/validation.js"> </script>

<script type="text/javascript">
var finishButtonPressed = false;
window.onload = pageLoaded;

function pageLoaded()
{
document.getElementById("dialog:dialog-body:name").focus();
document.getElementById("dialog").onsubmit = validateDialog;
document.getElementById("dialog:finish-button").onclick = function() {finishButtonPressed = true; clear_dialog();}
checkButtonState();
}

function checkButtonState()
{
if (document.getElementById("dialog:dialog-body:name").value.length == 0 )
{
document.getElementById("dialog:finish-button").disabled = true;
}
else
{
document.getElementById("dialog:finish-button").disabled = false;
}
}

</script>

<table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr>
<td colspan="3" class="wizardSectionHeading">
</f:verbatim>
<h:outputText value="#{msg.properties}" />
<f:verbatim>
</td>
</tr>
<tr>
<td align="middle">
</f:verbatim>
<h:graphicImage value="/images/icons/required_field.gif" alt="#{msg.required_field}" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:outputText value="#{msg.name}:" />
<f:verbatim>
</td>
<td width="85%">
</f:verbatim>
<h:inputText id="name" value="#{DialogManager.bean.name}" size="35" maxlength="1024"
onkeyup="javascript:checkButtonState();" onchange="javascript:checkButtonState();" />
<f:verbatim>
</td>
</tr>
<tr>
<td></td>
<td>
</f:verbatim>
<h:outputText value="#{msg.title}:" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:inputText id="title" value="#{DialogManager.bean.title}" size="35" maxlength="1024" />
<f:verbatim>
</td>
</tr>
<tr>
<td></td>
<td>
</f:verbatim>
<h:outputText value="#{msg.description}:" />
<f:verbatim>
</td>
<td>
</f:verbatim>
<h:inputText id="description" value="#{DialogManager.bean.description}" size="35" maxlength="1024" />
<f:verbatim>
</td>
</tr>
<tr>
<td></td>

</tr>

<tr>
<td></td>
<td></f:verbatim><h:outputText id="text12" value="Machine Type:" /><f:verbatim></td>
<td></f:verbatim><h:selectOneMenu id="machineType" value="#{CreateScPostDialog.machineType}">
<f:selectItems value="#{CreateScPostDialog.machineTypes}" />
</h:selectOneMenu><f:verbatim></td>
</tr>

<tr>
<td></td>
<td></f:verbatim><h:outputText id="text13" value="Machine Name:" /><f:verbatim></td>
<td></f:verbatim><h:selectOneMenu id="machineName" value="#{CreateScPostDialog.machineName}">
<f:selectItems value="#{CreateScPostDialog.machineNames}" />
</h:selectOneMenu><f:verbatim></td>
</tr>

<tr>
<td></td>
<td></f:verbatim><h:outputText id="text14" value="Machine Controller:" /><f:verbatim></td>
<td></f:verbatim><h:selectOneMenu id="machineController" value="#{CreateScPostDialog.machineController}">
<f:selectItems value="#{CreateScPostDialog.machineControllers}" />
</h:selectOneMenu><f:verbatim></td>
</tr>

<tr>
<td></td>
<td></f:verbatim><h:outputText id="text15" value="SolidCAM Version:" /><f:verbatim></td>
<td></f:verbatim><h:selectOneMenu id="solidCamVersion" value="#{CreateScPostDialog.solidCamVersion}">
<f:selectItems value="#{CreateScPostDialog.solidCamVersions}" />
</h:selectOneMenu><f:verbatim></td>
</tr>

</table>
</f:verbatim>

here's the web-config-custom.xml (withinin solidcam.jar):

<alfresco-config>



    <config>
        <actions>
            <!– Launch Create post Dialog –>
            <action id="create_sc_post">
                <label>Create Post</label>
                <image>/images/icons/create_space.gif</image>
                <action>dialog:CreateScPost</action>
            </action>

            <!– Add action to more actions menu for each space –>
            <action-group id="browse_create_menu">
                <action idref="create_sc_post" />
            </action-group>
        </actions>

        <dialogs>
            <dialog name="CreateScPost" page="/jsp/extension/create-sc-post.jsp" managed-bean="CreateScPostDialog"
                    icon="/images/icons/create_space_large.gif" title="Create Post"
                    description="Create a post" />
        </dialogs>

    </config>

face
 
</alfresco-config>

faces-config.xml :

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
                              "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>

   <!– *************************************************************** –>
   <!– Empty JSF config file to prevent errors being thrown during JSF –>
   <!– initialisation. Overwrite this file with your custom version.   –>
   <!– *************************************************************** –>
  <managed-bean>
    <description>
      The bean that backs up the Create post Dialog
    </description>
    <managed-bean-name>CreateScPostDialog</managed-bean-name>
    <managed-bean-class>org.alfresco.solidcam.CreateScPostDialog</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    <managed-property>
      <property-name>nodeService</property-name>
      <value>#{NodeService}</value>
    </managed-property>
    <managed-property>
      <property-name>fileFolderService</property-name>
      <value>#{FileFolderService}</value>
    </managed-property>
    <managed-property>
      <property-name>searchService</property-name>
      <value>#{SearchService}</value>
    </managed-property>
    <managed-property>
      <property-name>navigator</property-name>
      <value>#{NavigationBean}</value>
    </managed-property>
    <managed-property>
      <property-name>browseBean</property-name>
      <value>#{BrowseBean}</value>
    </managed-property>
    <managed-property>
      <property-name>namespaceService</property-name>
      <value>#{NamespaceService}</value>
    </managed-property>
    <managed-property>
      <property-name>contentService</property-name>
      <value>#{ContentService}</value>
    </managed-property>
    <managed-property>
      <property-name>dictionaryService</property-name>
      <value>#{DictionaryService}</value>
    </managed-property>
  </managed-bean>
  
</faces-config>

CreateScPostDialog.java

package org.alfresco.solidcam;

import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Iterator;
import java.util.Collection;

import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;



import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.dictionary.TypeDefinition;
import org.alfresco.service.cmr.model.FileExistsException;
import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.security.PermissionService;
//import org.alfresco.service.cmr.security;

import org.alfresco.service.cmr.search.CategoryService;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.search.CategoryService.Depth;


import org.alfresco.service.namespace.DynamicNamespacePrefixResolver;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.dialog.BaseDialogBean;
import org.alfresco.web.bean.repository.Repository;

import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.repo.component.UICharsetSelector;
import org.alfresco.web.ui.repo.component.UICategorySelector;


/**
* Dialog bean to create a post

* @author hagit
*/
public class CreateScPostDialog extends BaseDialogBean
{
   //private static final long serialVersionUID = 4659583264588102372L;???
   // ——————————————————————————
   // Wizard implementation
  
   protected String name;
   protected String title;
   protected String description;

   protected String machineType;
   protected String machineName;
   protected String machineController;
   protected String solidCamVersion;
  


   //protected List<NodeRef> categories = new ArrayList<NodeRef>();

   private List<SelectItem> machineTypes;
   private List<SelectItem> machineNames;
   private List<SelectItem> machineControllers;
   private List<SelectItem> solidCamVersions;



   

   protected String finishImpl(FacesContext context, String outcome) throws Exception
   {
   //String postIcon = "space-icon-default";
      String postIcon = "space-icon-custom";
   String newSpaceId = null;



   // copy the selected space and update the name, description and icon

   // Get the refernce for the Post Template (we have to  look for it using the search mechanism

   DynamicNamespacePrefixResolver namespacePrefixResolver = new DynamicNamespacePrefixResolver(null);
   namespacePrefixResolver.registerNamespace(NamespaceService.APP_MODEL_PREFIX, NamespaceService.APP_MODEL_1_0_URI);

   //String xpath = Application.getRootPath(FacesContext.getCurrentInstance()) + "/" +
   //      Application.getGlossaryFolderName(FacesContext.getCurrentInstance()) + "/" +
    //      Application.getSpaceTemplatesFolderName(FacesContext.getCurrentInstance())+ "/";
   String xpath = "/app:company_home/app:dictionary/app:space_templates/*";

   //NodeRef templateNode = rootNode.getNode(xpath);

   

   NodeRef rootNodeRef = this.getNodeService().getRootNode(Repository.getStoreRef());

   List<NodeRef> templateNodeList = this.getSearchService().selectNodes(
                                             rootNodeRef,
                                                    xpath, null, namespacePrefixResolver, false);
   

         //if (templateNodeList.size() == 1)
         //{

         // get the first item in the list as we from test above there is only one!
            NodeRef templateNode = templateNodeList.get(0);

       //}
         //NodeRef sourceNode = new NodeRef(Repository.getStoreRef(), "Company Home/Data Dictionary/Space Templates/Post Template");
      

      NodeRef curNode;
      String nodeName;
      for (int i = 0; i < templateNodeList.size(); ++i)
      {
         curNode = templateNodeList.get(i);
         nodeName = (String)this.getNodeService().getProperty(curNode, ContentModel.PROP_NAME);
         System.out.println("Name= " + nodeName);
         if (nodeName.equals("PostTemplate"))
         {
            System.out.println("Post template found");
            templateNode = curNode;
         }

      }

         NodeRef parentSpace = new NodeRef(Repository.getStoreRef(), this.navigator.getCurrentNodeId());
         // copy from the template
       NodeRef copiedNode = this.getFileFolderService().copy(templateNode, parentSpace, this.name).getNodeRef();
         // also need to set the new title, description and icon properties
         this.getNodeService().setProperty(copiedNode, ContentModel.PROP_TITLE, this.title);
         this.getNodeService().setProperty(copiedNode, ContentModel.PROP_DESCRIPTION, this.description);
         this.getNodeService().setProperty(copiedNode, ApplicationModel.PROP_ICON, postIcon );

        // because of a bug in alfresco I need to set the permissions for the post
       // note that geting the getPermissionService from Dialog bean  is not straightforward
       Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService().
                                                setPermission(copiedNode, "admin", "Coordinator", true);
      


         newSpaceId = copiedNode.getId();

         //if (logger.isDebugEnabled())
         //   logger.debug("Copied template space with id of " + sourceNode.getId() + " to " + this.name);

      
      System.out.println("Machine Name: " + this.machineName);

       // Now add all the categories
      ArrayList<NodeRef> categories = new ArrayList<NodeRef>(5);

      NodeRef categoryeNode;
      if (this.machineType != null && this.machineType.length() > 0)
      {
         categoryeNode = new NodeRef(Repository.getStoreRef(), this.machineType);
         categories.add(categoryeNode);
      }

      if (this.machineName != null && this.machineName.length() > 0)
      {
         categoryeNode = new NodeRef(Repository.getStoreRef(), this.machineName);
         categories.add(categoryeNode);
      }

      if (this.machineController != null && this.machineController.length() > 0)
      {
         categoryeNode = new NodeRef(Repository.getStoreRef(), this.machineController);
         categories.add(categoryeNode);
      }

      if (this.solidCamVersion != null && this.solidCamVersion.length() > 0)
      {
         categoryeNode = new NodeRef(Repository.getStoreRef(), this.solidCamVersion);
         categories.add(categoryeNode);
      }

     
         this.getNodeService().setProperty(copiedNode, ContentModel.PROP_CATEGORIES, categories);



       return outcome;

   }

   /**
    * @return Returns the name.
    */
   public String getName()
   {
      return name;
   }

   /**
    * @param name The name to set.
    */
   public void setName(String name)
   {
      this.name = name.trim();
   }

   /**
    * @return Returns the title.
    */
   public String getTitle()
   {
      return title;
   }

   /**
    * @param title The title to set.
    */
   public void setTitle(String title)
   {
      this.title = title;
   }
   /**
    * @return Returns the description.
    */
   public String getDescription()
   {
      return description;
   }

   /**
    * @param description The description to set.
    */
   public void setDescription(String description)
   {
      this.description = description;
   }


  

   /**
    * @return  Returns the machineType currently selected
    */
   public String getMachineType()
   {
     
         if (machineType == null || machineType.length() == 0)
         {
            // if not configured, set to a sensible default for most character sets
            //machineType = "Milling";
            System.out.println("CreateScPost: Machine Type not set");

         }
         else
            System.out.println("CreateScPost: Get Machine Type " + machineType);

   
     
      return machineType;
   }

   /**
   * @param machineType   the document's machineType
   */
   public void setMachineType(String machineType)
   {
      this.machineType = machineType;
   }

   public List<SelectItem> getMachineTypes()
   {
      FacesContext context = FacesContext.getCurrentInstance();
      if (this.machineTypes == null)
         this.machineTypes = new ArrayList<SelectItem>(20);
      else
         this.machineTypes.clear(); // We may have to improve if it takes  too much time to rebuild the list



      
      Collection<ChildAssociationRef> childRefs = Repository.getServiceRegistry(context).getCategoryService().getCategories(Repository.getStoreRef(), ContentModel.ASPECT_GEN_CLASSIFIABLE, Depth.IMMEDIATE);
      NodeRef machineTypeCatRef = null;
      Iterator<ChildAssociationRef> iter = childRefs.iterator();
      String catName;
      int i;
      for (i = 0; i < childRefs.size(); i++)
      {
         ChildAssociationRef assocRef = iter.next();
         System.out.println("assocRef " + assocRef);
         machineTypeCatRef = assocRef.getChildRef();
         catName = (String)this.getNodeService().getProperty(machineTypeCatRef, ContentModel.PROP_NAME);
         System.out.println("catName " + catName);
         if (catName.equals("Machine Type"))
            break;

      }
      if (machineTypeCatRef != null && i < childRefs.size())
      {
         this.machineTypes.add(new SelectItem("", ""));

         childRefs = Repository.getServiceRegistry(context).getCategoryService().
            getChildren(machineTypeCatRef, CategoryService.Mode.SUB_CATEGORIES, CategoryService.Depth.IMMEDIATE);
         iter = childRefs.iterator();
         NodeRef curCatRef = null;
         for (i = 0; i < childRefs.size(); i++)
         {
            ChildAssociationRef assocRef = iter.next();
            curCatRef = assocRef.getChildRef();
            catName = (String)this.getNodeService().getProperty(curCatRef, ContentModel.PROP_NAME);
            System.out.println("SSS catName " + catName + " Id= " + curCatRef.getId());
            this.machineTypes.add(new SelectItem(curCatRef.getId(), catName));
         }

      }
      else
         System.out.println("CreateScPost: Machine type category is not found in system");


      return this.machineTypes;


      // return UICharsetSelector.getCharsetEncodingList();
   }

   /**
    * @return  Returns the machineName currently selected
    */
   public String getMachineName()
   {

      if (machineName == null || machineName.length() == 0)
      {
         // if not configured, set to a sensible default for most character sets
         //machineName = "Milling";
         System.out.println("CreateScPost: Machine Name not set");

      }
      else
         System.out.println("SSSSSS: Machine Name is set");


      return machineName;
   }

   /**
    * @param machineName   the document's machineName
    */
   public void setMachineName(String machineName)
   {
      this.machineName = machineName;
   }

   public List<SelectItem> getMachineNames()
   {
      FacesContext context = FacesContext.getCurrentInstance();
      if (this.machineNames == null)
         this.machineNames = new ArrayList<SelectItem>(100);
      else
         this.machineNames.clear(); // We may have to improve if it takes  too much time to rebuild the list



      Collection<ChildAssociationRef> childRefs = Repository.getServiceRegistry(context).getCategoryService().getCategories(Repository.getStoreRef(), ContentModel.ASPECT_GEN_CLASSIFIABLE, Depth.IMMEDIATE);
      //System.out.println(" getMachineNames childRefs " + childRefs.size());
      NodeRef machineNameCatRef = null;
      Iterator<ChildAssociationRef> iter = childRefs.iterator();
      String catName;
      int i;
      for (i = 0; i < childRefs.size(); i++)
      {
         ChildAssociationRef assocRef = iter.next();
         machineNameCatRef = assocRef.getChildRef();
         catName = (String)this.getNodeService().getProperty(machineNameCatRef, ContentModel.PROP_NAME);
         System.out.println("  catName " + catName);
         if (catName.equals("Machine Name"))
            break;

      }
      if (machineNameCatRef != null && i < childRefs.size())
      {
         this.machineNames.add(new SelectItem("", ""));


         childRefs = Repository.getServiceRegistry(context).getCategoryService().
            getChildren(machineNameCatRef, CategoryService.Mode.SUB_CATEGORIES, CategoryService.Depth.IMMEDIATE);
         iter = childRefs.iterator();
         NodeRef curCatRef = null;

         for (i = 0; i < childRefs.size(); i++)
         {
            ChildAssociationRef assocRef = iter.next();
            curCatRef = assocRef.getChildRef();
            catName = (String)this.getNodeService().getProperty(curCatRef, ContentModel.PROP_NAME);
            System.out.println("  catName " + catName + " Id= " + curCatRef.getId());
            this.machineNames.add(new SelectItem(curCatRef.getId(), catName));
         }

      }
      else
         System.out.println("CreateScPost: Machine Names do not exist in categories");


      return this.machineNames;

   }

   /**
    * @return  Returns the machineController currently selected
    */
   public String getMachineController()
   {

      if (machineController == null || machineController.length() == 0)
      {
         // if not configured, set to a sensible default for most character sets
         //machineController = "Milling";
         System.out.println("CreateScPost: Machine Controller not set");

      }
      else
         System.out.println("SSSSSSDS Machine Controller is set");


      return machineController;
   }

   /**
    * @param machineController   the document's machineController
    */
   public void setMachineController(String machineController)
   {
      this.machineController = machineController;
   }

   public List<SelectItem> getMachineControllers()
   {
      FacesContext context = FacesContext.getCurrentInstance();
      if (this.machineControllers == null)
         this.machineControllers = new ArrayList<SelectItem>(100);
      else
         this.machineControllers.clear(); // We may have to improve if it takes  too much time to rebuild the list

      System.out.println("SSSSSSSSSSSSSSS GetMachineControllers");

      // getCategories(this.machineControllers, "Machine Controller");

      
      Collection<ChildAssociationRef> childRefs = Repository.getServiceRegistry(context).getCategoryService().getCategories(Repository.getStoreRef(), ContentModel.ASPECT_GEN_CLASSIFIABLE, Depth.IMMEDIATE);
      //System.out.println(" getMachineControllers childRefs " + childRefs.size());
      NodeRef machineControllerCatRef = null;
      Iterator<ChildAssociationRef> iter = childRefs.iterator();
      String catName;
      int i;
      for (i = 0; i < childRefs.size(); i++)
      {
         ChildAssociationRef assocRef = iter.next();
         machineControllerCatRef = assocRef.getChildRef();
         catName = (String)this.getNodeService().getProperty(machineControllerCatRef, ContentModel.PROP_NAME);
         System.out.println("  catName " + catName);
         if (catName.equals("Machine Controller"))
            break;

      }
      if (machineControllerCatRef != null && i < childRefs.size())
      {

         this.machineControllers.add(new SelectItem("", ""));

         childRefs = Repository.getServiceRegistry(context).getCategoryService().
            getChildren(machineControllerCatRef, CategoryService.Mode.SUB_CATEGORIES, CategoryService.Depth.IMMEDIATE);
         iter = childRefs.iterator();
         NodeRef curCatRef = null;

         for (i = 0; i < childRefs.size(); i++)
         {
            ChildAssociationRef assocRef = iter.next();
            curCatRef = assocRef.getChildRef();
            catName = (String)this.getNodeService().getProperty(curCatRef, ContentModel.PROP_NAME);
            System.out.println("  catName " + catName + " Id= " + curCatRef.getId());
            // example wrappers.add(new SelectItem(childNode.getId(), childNode.getName()));
            this.machineControllers.add(new SelectItem(curCatRef.getId(), catName));
         }

      }
      else
         System.out.println("CreateScPost: Machine Controllers not defined in systems");

      

      return this.machineControllers;

   }

   // ———————–
   public String getSolidCamVersion()
   {

      if (solidCamVersion == null || solidCamVersion.length() == 0)
      {
         // if not configured, set to a sensible default for most character sets
         //machineController = "Milling";
         System.out.println("CreateScPost: SolidCAM Version not set");

      }
      else
         System.out.println("SSSSSSDS SolidCAM Version is set");


      return solidCamVersion;
   }

   /**
    * @param machineController   the document's machineController
    */
   public void setSolidCamVersion(String solidCamVersion)
   {
      this.solidCamVersion = solidCamVersion;
   }

   public List<SelectItem> getSolidCamVersions()
   {
      FacesContext context = FacesContext.getCurrentInstance();
      if (this.solidCamVersions == null)
         this.solidCamVersions = new ArrayList<SelectItem>(50);
      else
         this.solidCamVersions.clear(); // We may have to improve if it takes  too much time to rebuild the list

      System.out.println("SSSSSSSSSSSSSSS GetSolidCamVersions");

      // getCategories(this.machineControllers, "Machine Controller");


      Collection<ChildAssociationRef> childRefs = Repository.getServiceRegistry(context).getCategoryService().getCategories(Repository.getStoreRef(), ContentModel.ASPECT_GEN_CLASSIFIABLE, Depth.IMMEDIATE);
      //System.out.println(" getMachineControllers childRefs " + childRefs.size());
      NodeRef solidCamVersionCatRef = null;
      Iterator<ChildAssociationRef> iter = childRefs.iterator();
      String catName;
      int i;
      for (i = 0; i < childRefs.size(); i++)
      {
         ChildAssociationRef assocRef = iter.next();
         solidCamVersionCatRef = assocRef.getChildRef();
         catName = (String)this.getNodeService().getProperty(solidCamVersionCatRef, ContentModel.PROP_NAME);
         System.out.println("  catName " + catName);
         if (catName.equals("SolidCAM Version"))
            break;

      }
      if (solidCamVersionCatRef != null && i < childRefs.size())
      {

         this.solidCamVersions.add(new SelectItem("", ""));

         childRefs = Repository.getServiceRegistry(context).getCategoryService().
            getChildren(solidCamVersionCatRef, CategoryService.Mode.SUB_CATEGORIES, CategoryService.Depth.ANY);
         iter = childRefs.iterator();
         NodeRef curCatRef = null;

         for (i = 0; i < childRefs.size(); i++)
         {
            ChildAssociationRef assocRef = iter.next();
            curCatRef = assocRef.getChildRef();
            catName = (String)this.getNodeService().getProperty(curCatRef, ContentModel.PROP_NAME);
            System.out.println("  catName " + catName + " Id= " + curCatRef.getId());
            // example wrappers.add(new SelectItem(childNode.getId(), childNode.getName()));
            this.solidCamVersions.add(new SelectItem(curCatRef.getId(), catName));
         }

      }
      else
         System.out.println("CreateScPost: solidCam Versions not defined in systems");



      return this.solidCamVersions;

   }
   // ———————–

   private void getCategories(ArrayList<SelectItem> catList, String catTypeName)
   {
      FacesContext context = FacesContext.getCurrentInstance();

      Collection<ChildAssociationRef> childRefs = Repository.getServiceRegistry(context).getCategoryService().getCategories(Repository.getStoreRef(), ContentModel.ASPECT_GEN_CLASSIFIABLE, Depth.IMMEDIATE);
      //System.out.println(" getMachineControllers childRefs " + childRefs.size());
      NodeRef catRef = null;
      Iterator<ChildAssociationRef> iter = childRefs.iterator();
      String catName;
      int i;
      for (i = 0; i < childRefs.size(); i++)
      {
         ChildAssociationRef assocRef = iter.next();
         catRef = assocRef.getChildRef();
         catName = (String)this.getNodeService().getProperty(catRef, ContentModel.PROP_NAME);
         System.out.println("  catName " + catName);
         if (catName.equals(catTypeName))
            break;

      }
      if (catRef != null && i < childRefs.size())
      {

         this.machineControllers.add(new SelectItem("", ""));

         childRefs = Repository.getServiceRegistry(context).getCategoryService().
            getChildren(catRef, CategoryService.Mode.SUB_CATEGORIES, CategoryService.Depth.IMMEDIATE);
         iter = childRefs.iterator();
         NodeRef curCatRef = null;

         for (i = 0; i < childRefs.size(); i++)
         {
            ChildAssociationRef assocRef = iter.next();
            curCatRef = assocRef.getChildRef();
            catName = (String)this.getNodeService().getProperty(curCatRef, ContentModel.PROP_NAME);
            System.out.println("  catName " + catName + " Id= " + curCatRef.getId());
            // example wrappers.add(new SelectItem(childNode.getId(), childNode.getName()));
            this.machineControllers.add(new SelectItem(curCatRef.getId(), catName));
         }

      }
      else
         System.out.println("CreateScPost: " + catTypeName + " not defined in systems");
   }

  
}

Can anybody tell me why alfresco does not find the managed bean ?

Thanks,

Hagit
11 REPLIES 11

harinderpal
Champ in-the-making
Champ in-the-making
My xml files are at correct place. I have pasted content of one of the file above.

shmoula
Champ in-the-making
Champ in-the-making
Hi all, I think it depends on actual moon phase, because it sometimes hapens and sometimes doesnt.