* @param context the context
* @return the retrieval
*/
protected MetaDataRetrieval initMetaDataRetrieval(ControllerContext context)
{
MutableMetaDataRepository repository = getMetaDataRepository();
ScopeInfo scopeInfo = context.getScopeInfo();
ScopeKey scopeKey = scopeInfo.getScope();
ArrayList<MetaDataRetrieval> retrievals = new ArrayList<MetaDataRetrieval>();
for (Scope scope : scopeKey.getScopes())
{
ScopeKey thisScope = new ScopeKey(scope);
MetaDataRetrieval retrieval = repository.getMetaDataRetrieval(thisScope);
if (retrieval == null)
{
retrieval = scopeInfo.initMetaDataRetrieval(repository, context, scope);
if (retrieval == null)
{
retrieval = new MemoryMetaDataLoader(thisScope);
repository.addMetaDataRetrieval(retrieval);
}
}
retrievals.add(0, retrieval);
}
AbstractMetaDataContext metaDataContext = new AbstractMetaDataContext(null, retrievals);
repository.addMetaDataRetrieval(metaDataContext);
return metaDataContext;
}