//Deal with before restrictions first
for (OrderSlot slot : facesConfig.getOrdering().getBeforeList())
{
if (slot instanceof FacesConfigNameSlot)
{
FacesConfigNameSlot nameSlot = (FacesConfigNameSlot) slot;
//The resource pointed is not added yet?
boolean alreadyAdded = false;
for (FacesConfig res : postOrderedList)
{
if (nameSlot.getName().equals(res.getName()))
{
alreadyAdded = true;
break;
}
}
if (!alreadyAdded)
{
int indexSlot = -1;
//Find it
for (int i = 0; i < appConfigResources.size(); i++)
{
FacesConfig resource = appConfigResources.get(i);
if (resource.getName() != null && nameSlot.getName().equals(resource.getName()))
{
indexSlot = i;
break;
}
}
//Resource founded on appConfigResources
if (indexSlot != -1)
{
pointingResource = true;
//Add to nameStac
nameBeforeStack.add(facesConfig.getName());
resolveConflicts(appConfigResources, indexSlot, visitedSlots,
nameBeforeStack, nameAfterStack, postOrderedList,
othersList,true);
nameBeforeStack.remove(facesConfig.getName());
}
}
else
{
pointingResource = true;
}
}
}
for (OrderSlot slot : facesConfig.getOrdering().getAfterList())
{
if (slot instanceof FacesConfigNameSlot)
{
FacesConfigNameSlot nameSlot = (FacesConfigNameSlot) slot;
//The resource pointed is not added yet?
boolean alreadyAdded = false;
for (FacesConfig res : postOrderedList)
{
if (nameSlot.getName().equals(res.getName()))
{
alreadyAdded = true;
break;
}
}
if (!alreadyAdded)
{
int indexSlot = -1;
//Find it
for (int i = 0; i < appConfigResources.size(); i++)
{
FacesConfig resource = appConfigResources.get(i);
if (resource.getName() != null && nameSlot.getName().equals(resource.getName()))
{
indexSlot = i;
break;
}
}