docs: protected List<FacesConfig> getPostOrderedList(final List<FacesConfig> appConfigResources) throws FacesException
      {
  
          //0. Clean up: remove all not found resource references from the ordering
          //descriptions.
          List<String> availableReferences = new ArrayList<String>();
          for (FacesConfig resource : appConfigResources)
          {
              String name = resource.getName();
              if (name != null && !"".equals(name))
              {
                  availableReferences.add(name);
              }
          }
  
          for (FacesConfig resource : appConfigResources)
          {
              Ordering ordering = resource.getOrdering();
              if (ordering != null)
              {
                  for (Iterator<OrderSlot> it =  resource.getOrdering().getBeforeList().iterator();it.hasNext();)
                  {
                      OrderSlot slot = it.next();
                      if (slot instanceof FacesConfigNameSlot)
                      {
                          String name = ((FacesConfigNameSlot) slot).getName();
                          if (!availableReferences.contains(name))
                          {
                              it.remove();
                          }
                      }
                  }
                  for (Iterator<OrderSlot> it =  resource.getOrdering().getAfterList().iterator();it.hasNext();)
                  {
                      OrderSlot slot = it.next();
                      if (slot instanceof FacesConfigNameSlot)
                      {
                          String name = ((FacesConfigNameSlot) slot).getName();
                          if (!availableReferences.contains(name))
                          {
                              it.remove();
                          }
                      }
                  }
              }
          }
  
          List<FacesConfig> appFilteredConfigResources = null;
  
          //1. Pre filtering: Sort nodes according to its weight. The weight is the number of named
          //nodes containing in both before and after lists. The sort is done from the more complex
          //to the most simple
          if (appConfigResources instanceof ArrayList)
          {
              appFilteredConfigResources = (List<FacesConfig>)
                  ((ArrayList<FacesConfig>)appConfigResources).clone();
          }
          else
          {
              appFilteredConfigResources = new ArrayList<FacesConfig>();
              appFilteredConfigResources.addAll(appConfigResources);
          }
          Collections.sort(appFilteredConfigResources,
                  new Comparator<FacesConfig>()
                  {
                      public int compare(FacesConfig o1, FacesConfig o2)
                      {
                          int o1Weight = 0;
                          int o2Weight = 0;
                          if (o1.getOrdering() != null)
                          {
                              for (OrderSlot slot : o1.getOrdering()
                                      .getBeforeList())
                              {
                                  if (slot instanceof FacesConfigNameSlot)
                                  {
                                      o1Weight++;
                                  }
                              }
                              for (OrderSlot slot : o1.getOrdering()
                                      .getAfterList())
                              {
                                  if (slot instanceof FacesConfigNameSlot)
                                  {
                                      o1Weight++;
                                  }
                              }
                          }
                          if (o2.getOrdering() != null)
                          {
                              for (OrderSlot slot : o2.getOrdering()
                                      .getBeforeList())
                              {
                                  if (slot instanceof FacesConfigNameSlot)
                                  {
                                      o2Weight++;
                                  }
                              }
                              for (OrderSlot slot : o2.getOrdering()
                                      .getAfterList())
                              {
                                  if (slot instanceof FacesConfigNameSlot)
                                  {
                                      o2Weight++;
                                  }
                              }
                          }
                          return o2Weight - o1Weight;
                      }
                  });
  
          List<FacesConfig> postOrderedList = new LinkedList<FacesConfig>();
          List<FacesConfig> othersList = new ArrayList<FacesConfig>();
  
          List<String> nameBeforeStack = new ArrayList<String>();
          List<String> nameAfterStack = new ArrayList<String>();
  
          boolean[] visitedSlots = new boolean[appFilteredConfigResources.size()];
  
          //2. Scan and resolve conflicts
          for (int i = 0; i < appFilteredConfigResources.size(); i++)
          {
              if (!visitedSlots[i])
              {
                  resolveConflicts(appFilteredConfigResources, i, visitedSlots,
                          nameBeforeStack, nameAfterStack, postOrderedList, othersList, false);
              }
          }
  
          //Add othersList to postOrderedList so <before><others/></before> and <after><others/></after>
          //ordering conditions are handled at last if there are not referenced by anyone
          postOrderedList.addAll(othersList);
  
          return postOrderedList;
      }