本文整理汇总了Java中org.alfresco.repo.tenant.TenantUtil.getCurrentDomain方法的典型用法代码示例。如果您正苦于以下问题:Java TenantUtil.getCurrentDomain方法的具体用法?Java TenantUtil.getCurrentDomain怎么用?Java TenantUtil.getCurrentDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.repo.tenant.TenantUtil
的用法示例。
在下文中一共展示了TenantUtil.getCurrentDomain方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDictionaryRegistryWithWriteLock
import org.alfresco.repo.tenant.TenantUtil; //导入方法依赖的package包/类
protected CMISDictionaryRegistry createDictionaryRegistryWithWriteLock()
{
String tenant = TenantUtil.getCurrentDomain();
CMISDictionaryRegistry cmisRegistry = createDictionaryRegistry(tenant);
String cacheKey = getCacheKey(tenant);
registryWriteLock.lock();
try
{
// publish new registry
cmisRegistryCache.put(cacheKey, cmisRegistry);
}
finally
{
registryWriteLock.unlock();
}
return cmisRegistry;
}
示例2: postActivity
import org.alfresco.repo.tenant.TenantUtil; //导入方法依赖的package包/类
/**
* Posts activities based on the activity_type.
* If the method is called with aSync=true then a TransactionListener is used post the activity
* afterCommit. Otherwise the activity posting is done synchronously.
* @param activity_type
* @param activityInfo
* @param aSync
*/
protected void postActivity(Activity_Type activity_type, ActivityInfo activityInfo, boolean aSync)
{
if (activityInfo == null) return; //Nothing to do.
String activityType = determineActivityType(activity_type, activityInfo.getFileInfo().isFolder());
if (activityType != null)
{
if (aSync)
{
ActivitiesTransactionListener txListener = new ActivitiesTransactionListener(activityType, activityInfo,
TenantUtil.getCurrentDomain(), Activities.APP_TOOL, Activities.RESTAPI_CLIENT,
poster, retryingTransactionHelper);
AlfrescoTransactionSupport.bindListener(txListener);
}
else
{
poster.postFileFolderActivity(activityType, null, TenantUtil.getCurrentDomain(),
activityInfo.getSiteId(), activityInfo.getParentNodeRef(), activityInfo.getNodeRef(),
activityInfo.getFileName(), Activities.APP_TOOL, Activities.RESTAPI_CLIENT,
activityInfo.getFileInfo());
}
}
}
示例3: getTenantAwareCacheKey
import org.alfresco.repo.tenant.TenantUtil; //导入方法依赖的package包/类
/**
* Convert the key to a tenant-specific key if the cache is tenant-aware and
* the current thread is running in the context of a tenant.
*
* @param key the key to convert
* @return a key that separates tenant-specific values
*/
private Serializable getTenantAwareCacheKey(final K key)
{
if (isTenantAware)
{
final String tenantDomain = TenantUtil.getCurrentDomain();
if (! tenantDomain.equals(TenantService.DEFAULT_DOMAIN))
{
return new CacheRegionKey(tenantDomain, key);
}
// drop through
}
return key;
}
示例4: getThreadInfo
import org.alfresco.repo.tenant.TenantUtil; //导入方法依赖的package包/类
/**
* Gets userful information from the current thread for use when creating an event
* @return ThreadInfo
*/
protected ThreadInfo getThreadInfo()
{
return new ThreadInfo(
AuthenticationUtil.getFullyAuthenticatedUser(),
AlfrescoTransactionSupport.getTransactionId(),
TenantUtil.getCurrentDomain());
}
示例5: isSpecialNode
import org.alfresco.repo.tenant.TenantUtil; //导入方法依赖的package包/类
/**
* Check for special case: additional node validation (pending common lower-level service support)
* for blacklist of system nodes that should not be deleted or locked, eg. Company Home, Sites, Data Dictionary
*
* @param nodeRef
* @param type
* @return
*/
protected boolean isSpecialNode(NodeRef nodeRef, QName type)
{
// Check for Company Home, Sites and Data Dictionary (note: must be tenant-aware)
if (nodeRef.equals(repositoryHelper.getCompanyHome()))
{
return true;
}
else if (type.equals(SiteModel.TYPE_SITES) || type.equals(SiteModel.TYPE_SITE))
{
// note: alternatively, we could inject SiteServiceInternal and use getSitesRoot (or indirectly via node locator)
return true;
}
else
{
String tenantDomain = TenantUtil.getCurrentDomain();
NodeRef ddNodeRef = ddCache.get(tenantDomain);
if (ddNodeRef == null)
{
List<ChildAssociationRef> ddAssocs = nodeService.getChildAssocs(
repositoryHelper.getCompanyHome(),
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "dictionary"));
if (ddAssocs.size() == 1)
{
ddNodeRef = ddAssocs.get(0).getChildRef();
ddCache.put(tenantDomain, ddNodeRef);
}
}
if (nodeRef.equals(ddNodeRef))
{
return true;
}
}
return false;
}
示例6: getProcessDefinitionKey
import org.alfresco.repo.tenant.TenantUtil; //导入方法依赖的package包/类
protected String getProcessDefinitionKey(String paramProcessDefinitionKey)
{
String processDefinitionKey = null;
if (tenantService.isEnabled() && deployWorkflowsInTenant)
{
processDefinitionKey = "@" + TenantUtil.getCurrentDomain() + "@" + paramProcessDefinitionKey;
}
else
{
processDefinitionKey = paramProcessDefinitionKey;
}
return processDefinitionKey;
}
示例7: getProcessDefinitionKey
import org.alfresco.repo.tenant.TenantUtil; //导入方法依赖的package包/类
protected String getProcessDefinitionKey(String key)
{
String processDefKey = null;
if (tenantService.isEnabled() && deployWorkflowsInTenant)
{
processDefKey = "@" + TenantUtil.getCurrentDomain() + "@" + key;
}
else
{
processDefKey = key;
}
return processDefKey;
}
示例8: setDisableSharedCacheReadForTransaction
import org.alfresco.repo.tenant.TenantUtil; //导入方法依赖的package包/类
/**
* Transaction-long setting to force all the share cache to be bypassed for the current transaction.
* <p/>
* This setting is like having a {@link NullCache null} {@link #setSharedCache(SimpleCache) shared cache},
* but only lasts for the transaction.
* <p/>
* Use this when a read transaction <b>must</b> see consistent and current data i.e. go to the database.
* While this is active, write operations will also not be committed to the shared cache.
*
* @param noSharedCacheRead <tt>true</tt> to avoid reading from the shared cache for the transaction
*/
@SuppressWarnings("unchecked")
public void setDisableSharedCacheReadForTransaction(boolean noSharedCacheRead)
{
TransactionData txnData = getTransactionData();
// If we are switching on noSharedCacheRead mode, convert all existing reads and updates to avoid 'consistent
// read' behaviour giving us a potentially out of date node already accessed
if (noSharedCacheRead && !txnData.noSharedCacheRead)
{
txnData.noSharedCacheRead = noSharedCacheRead;
String currentCacheRegion = TenantUtil.getCurrentDomain();
for (Map.Entry<Serializable, CacheBucket<V>> entry : new ArrayList<Map.Entry<Serializable, CacheBucket<V>>>(
txnData.updatedItemsCache.entrySet()))
{
Serializable cacheKey = entry.getKey();
K key = null;
if (cacheKey instanceof CacheRegionKey)
{
CacheRegionKey cacheRegionKey = (CacheRegionKey) cacheKey;
if (currentCacheRegion.equals(cacheRegionKey.getCacheRegion()))
{
key = (K) cacheRegionKey.getCacheKey();
}
}
else
{
key = (K) cacheKey;
}
if (key != null)
{
CacheBucket<V> bucket = entry.getValue();
// Simply 'forget' reads
if (bucket instanceof ReadCacheBucket)
{
txnData.updatedItemsCache.remove(cacheKey);
}
// Convert updates to removes
else if (bucket instanceof UpdateCacheBucket)
{
remove(key);
}
// Leave new entries alone - they can't have come from the shared cache
}
}
}
}
示例9: getRegistry
import org.alfresco.repo.tenant.TenantUtil; //导入方法依赖的package包/类
protected CMISDictionaryRegistry getRegistry()
{
String tenant = TenantUtil.getCurrentDomain();
return getRegistry(tenant);
}
示例10: execute
import org.alfresco.repo.tenant.TenantUtil; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public void execute(final Api api, final WebScriptRequest req, final WebScriptResponse res) throws IOException
{
try
{
final Map<String, Object> respons = new HashMap<String, Object>();
final Map<String, String> templateVars = req.getServiceMatch().getTemplateVars();
final ResourceWithMetadata resource = locator.locateResource(api,templateVars, httpMethod);
final Params params = paramsExtractor.extractParams(resource.getMetaData(),req);
final boolean isReadOnly = HttpMethod.GET==httpMethod;
//This execution usually takes place in a Retrying Transaction (see subclasses)
final Object toSerialize = execute(resource, params, res, isReadOnly);
//Outside the transaction.
if (toSerialize != null)
{
if (toSerialize instanceof BinaryResource)
{
// TODO review (experimental) - can we move earlier & wrap complete execute ? Also for QuickShare (in MT/Cloud) needs to be tenant for the nodeRef (TBC).
boolean noAuth = false;
if (BinaryResourceAction.Read.class.isAssignableFrom(resource.getResource().getClass()))
{
noAuth = resource.getMetaData().isNoAuth(BinaryResourceAction.Read.class);
}
else if (RelationshipResourceBinaryAction.Read.class.isAssignableFrom(resource.getResource().getClass()))
{
noAuth = resource.getMetaData().isNoAuth(RelationshipResourceBinaryAction.Read.class);
}
else
{
logger.warn("Unexpected");
}
if (noAuth)
{
String networkTenantDomain = TenantUtil.getCurrentDomain();
TenantUtil.runAsSystemTenant(new TenantUtil.TenantRunAsWork<Void>()
{
public Void doWork() throws Exception
{
streamResponse(req, res, (BinaryResource) toSerialize);
return null;
}
}, networkTenantDomain);
}
else
{
streamResponse(req, res, (BinaryResource) toSerialize);
}
}
else
{
renderJsonResponse(res, toSerialize, assistant.getJsonHelper());
}
}
}
catch (AlfrescoRuntimeException | ApiException | WebScriptException xception )
{
renderException(xception, res, assistant);
}
catch (RuntimeException runtimeException)
{
renderException(runtimeException, res, assistant);
}
}