Object contextName = context.getName();
String name = contextName.toString();
Set<MissingDependency> dependencies = new HashSet<MissingDependency>();
DependencyInfo dependsInfo = context.getDependencyInfo();
ControllerState currentState = context.getState();
ControllerState nextState = states.getNextState(currentState);
for (DependencyItem item : dependsInfo.getUnresolvedDependencies(nextState))
{
if (item.isResolved() == false)
{
String dependency;
ControllerState actualState = null;
String actualStateString;
Object iDependOn = item.getIDependOn();
if (contextName.equals(iDependOn) == false && item.resolve(controller) == false)
{
iDependOn = item.getIDependOn();
if (iDependOn == null)
{
dependency = "<UNKNOWN " + item.getName() + ">";
actualStateString = "** UNRESOLVED " + item.toHumanReadableString() + " **";
}
else
{
dependency = iDependOn.toString();
ControllerContext other = controller.getContext(iDependOn, null);
if (other == null)
actualStateString = "** NOT FOUND " + item.toHumanReadableString() + " **";
else
{
actualState = other.getState();
actualStateString = actualState.getStateString();
}
}
ControllerState requiredState = item.getWhenRequired();
String requiredStateString = requiredState.getStateString();
if (actualState == null || states.isAfterState(requiredState, actualState))
{
MissingDependency missing = new MissingDependency(name, dependency, requiredStateString, actualStateString);
dependencies.add(missing);
}