MT - fixes for new MT interceptor (create/login tenant admin, get stores)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10995 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2008-09-23 22:48:08 +00:00
parent f65ad654b2
commit 40e706f14f
7 changed files with 154 additions and 33 deletions

View File

@@ -108,9 +108,11 @@ public class MultiTNodeServiceInterceptor extends DelegatingIntroductionIntercep
return invocation.proceed();
}
String methodName = invocation.getMethod().getName();
if (logger.isDebugEnabled())
{
logger.debug("Intercepting method " + invocation.getMethod().getName());
logger.debug("Intercepting method " + methodName);
}
Object[] args = invocation.getArguments();
@@ -162,8 +164,49 @@ public class MultiTNodeServiceInterceptor extends DelegatingIntroductionIntercep
// Make the call
Object ret = invocation.proceed();
// Convert the outbound value
ret = convertOutboundValue(ret);
if (methodName.equals("getStores"))
{
if ((ret == null) || (! (ret instanceof List)))
{
return null;
}
List<StoreRef> rawValues = (List<StoreRef>)ret;
final List<StoreRef> convertedValues = new ArrayList<StoreRef>(rawValues.size());
for (StoreRef ref : rawValues)
{
StoreRef storeRef = ref;
try
{
if (tenantService.isEnabled())
{
String currentUser = AuthenticationUtil.getCurrentUserName();
// MT: return tenant stores only (although for super System return all stores - as used by
// ConfigurationChecker, IndexRecovery, IndexBackup etc)
if ((currentUser == null) || (!currentUser.equals(AuthenticationUtil.getSystemUserName())))
{
tenantService.checkDomain(storeRef.getIdentifier());
storeRef = tenantService.getBaseName(storeRef);
}
}
convertedValues.add(storeRef);
}
catch (RuntimeException re)
{
// deliberately ignore - stores in different domain will not be listed
}
}
return convertedValues;
}
else
{
// Convert the outbound value
ret = convertOutboundValue(ret);
}
// done
return ret;