本文整理汇总了Java中org.alfresco.repo.tenant.TenantUtil类的典型用法代码示例。如果您正苦于以下问题:Java TenantUtil类的具体用法?Java TenantUtil怎么用?Java TenantUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TenantUtil类属于org.alfresco.repo.tenant包,在下文中一共展示了TenantUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: process
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
public void process(final NodeRef person) throws Throwable
{
// note: runAs before runAsTenant (to avoid clearing tenant context, if no previous auth)
AuthenticationUtil.runAs(new RunAsWork<Object>()
{
@Override
public Object doWork() throws Exception
{
return TenantUtil.runAsTenant(new TenantRunAsWork<Void>()
{
public Void doWork() throws Exception
{
RunAsWorker.this.doWork(person);
return null;
}
}, tenantDomain);
}
}, userName);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:HomeFolderProviderSynchronizer.java
示例2: startAdhocProcess
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
protected ProcessInstance startAdhocProcess(final String user, final String networkId, final String businessKey)
{
return TenantUtil.runAsUserTenant(new TenantRunAsWork<ProcessInstance>()
{
@Override
public ProcessInstance doWork() throws Exception
{
String processDefinitionKey = "@" + networkId + "@activitiAdhoc";
// Set required variables for adhoc process and start
Map<String, Object> variables = new HashMap<String, Object>();
ActivitiScriptNode person = getPersonNodeRef(user);
variables.put("bpm_assignee", person);
variables.put("wf_notifyMe", Boolean.FALSE);
variables.put(WorkflowConstants.PROP_INITIATOR, person);
return activitiProcessEngine.getRuntimeService().startProcessInstanceByKey(processDefinitionKey, businessKey, variables);
}
}, user, networkId);
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:19,代码来源:TaskWorkflowApiTest.java
示例3: listMembers
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
public void listMembers(String shortName, final String nameFilter, final String roleFilter, final boolean collapseGroups, final SiteMembersCallback callback)
{
// MT share - for activity service system callback
if (tenantService.isEnabled() && (AuthenticationUtil.SYSTEM_USER_NAME.equals(AuthenticationUtil.getRunAsUser())) && tenantService.isTenantName(shortName))
{
final String tenantDomain = tenantService.getDomain(shortName);
final String sName = tenantService.getBaseName(shortName, true);
TenantUtil.runAsSystemTenant(new TenantRunAsWork<Void>()
{
public Void doWork() throws Exception
{
listMembersImpl(sName, nameFilter, roleFilter, collapseGroups, callback);
return null;
}
}, tenantDomain);
}
else
{
listMembersImpl(shortName, nameFilter, roleFilter, collapseGroups, callback);
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:SiteServiceImpl.java
示例4: getFolder
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
public FavouriteFolder getFolder(String networkId, final NodeRef nodeRef)
{
return TenantUtil.runAsSystemTenant(new TenantRunAsWork<FavouriteFolder>()
{
@Override
public FavouriteFolder doWork() throws Exception
{
FavouriteFolder folder = null;
QName type = nodeService.getType(nodeRef);
if(dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER))
{
Properties properties = getProperties(nodeRef);
folder = FavouriteFolder.getFolder(nodeRef.getId(), nodeRef.getId(), properties);
}
else
{
throw new IllegalArgumentException("Not a folder node");
}
return folder;
}
}, networkId);
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:25,代码来源:RepoService.java
示例5: getSites
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
public List<TestSite> getSites(String personId)
{
List<TestSite> sites = TenantUtil.runAsUserTenant(new TenantRunAsWork<List<TestSite>>()
{
@Override
public List<TestSite> doWork() throws Exception
{
List<SiteInfo> results = siteService.listSites(null, null);
TreeMap<String, TestSite> ret = new TreeMap<String, TestSite>();
for(SiteInfo siteInfo : results)
{
TestSite site = new TestSite(TestNetwork.this, siteInfo/*, null*/);
ret.put(site.getSiteId(), site);
}
return new ArrayList<TestSite>(ret.values());
}
}, personId, getId());
return sites;
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:21,代码来源:RepoService.java
示例6: onBootstrap
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
@Override
protected void onBootstrap(ApplicationEvent event)
{
// default domain
bootstrapInternal();
if (tenantAdminService.isEnabled())
{
List<Tenant> tenants = tenantAdminService.getAllTenants();
for (Tenant tenant : tenants)
{
TenantUtil.runAsSystemTenant(new TenantRunAsWork<Object>()
{
public Object doWork() throws Exception
{
bootstrapInternal();
return null;
}
}, tenant.getTenantDomain());
}
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:UserUsageTrackingComponent.java
示例7: createTestDocuments
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
protected NodeRef[] createTestDocuments(final RequestContext requestContext) {
NodeRef[] docNodeRefs = TenantUtil.runAsUserTenant(new TenantRunAsWork<NodeRef[]>()
{
@Override
public NodeRef[] doWork() throws Exception
{
String siteName = "site" + GUID.generate();
SiteInformation siteInfo = new SiteInformation(siteName, siteName, siteName, SiteVisibility.PUBLIC);
TestSite site = currentNetwork.createSite(siteInfo);
NodeRef nodeRefDoc1 = getTestFixture().getRepoService().createDocument(site.getContainerNodeRef("documentLibrary"), "Test Doc1", "Test Doc1 Title", "Test Doc1 Description", "Test Content");
NodeRef nodeRefDoc2 = getTestFixture().getRepoService().createDocument(site.getContainerNodeRef("documentLibrary"), "Test Doc2", "Test Doc2 Title", "Test Doc2 Description", "Test Content");
NodeRef[] result = new NodeRef[2];
result[0] = nodeRefDoc1;
result[1] = nodeRefDoc2;
return result;
}
}, requestContext.getRunAsUser(), requestContext.getNetworkId());
return docNodeRefs;
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:23,代码来源:EnterpriseWorkflowTestApi.java
示例8: getAllDefinitions
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public List<WorkflowDefinition> getAllDefinitions()
{
try
{
ProcessDefinitionQuery query = repoService.createProcessDefinitionQuery();
if(activitiUtil.isMultiTenantWorkflowDeploymentEnabled() && !TenantUtil.isCurrentDomainDefault())
{
query.processDefinitionKeyLike("@" + TenantUtil.getCurrentDomain() + "%");
}
return getValidWorkflowDefinitions(query.list());
}
catch (ActivitiException ae)
{
String msg = messageService.getMessage(ERR_GET_WORKFLOW_DEF);
if(logger.isDebugEnabled())
{
logger.debug(msg, ae);
}
throw new WorkflowException(msg, ae);
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:ActivitiWorkflowEngine.java
示例9: getDefinitions
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public List<WorkflowDefinition> getDefinitions()
{
try
{
ProcessDefinitionQuery query = repoService.createProcessDefinitionQuery().latestVersion();
if(activitiUtil.isMultiTenantWorkflowDeploymentEnabled() && !TenantUtil.isCurrentDomainDefault())
{
query.processDefinitionKeyLike("@" + TenantUtil.getCurrentDomain() + "%");
}
return getValidWorkflowDefinitions(query.list());
}
catch (ActivitiException ae)
{
String msg = messageService.getMessage(ERR_GET_WORKFLOW_DEF);
if(logger.isDebugEnabled())
{
logger.debug(msg, ae);
}
throw new WorkflowException(msg, ae);
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:ActivitiWorkflowEngine.java
示例10: addTasksForCandidateGroups
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
private void addTasksForCandidateGroups(List<String> groupNames, Map<String, Task> resultingTasks)
{
if(groupNames != null && groupNames.size() > 0) {
TaskQuery query = taskService.createTaskQuery().taskCandidateGroupIn(groupNames);
// Additional filtering on the tenant-property in case workflow-definitions are shared across tenants
if(!activitiUtil.isMultiTenantWorkflowDeploymentEnabled() && tenantService.isEnabled()) {
query.processVariableValueEquals(ActivitiConstants.VAR_TENANT_DOMAIN, TenantUtil.getCurrentDomain());
}
List<Task> tasks =query.list();
for(Task task : tasks)
{
resultingTasks.put(task.getId(), task);
}
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:ActivitiWorkflowEngine.java
示例11: createUser
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
/**
* TODO implement as remote api call
*/
protected String createUser(final PersonInfo personInfo, final TestNetwork network)
{
final String tenantDomain = (network != null ? network.getId() : TenantService.DEFAULT_DOMAIN);
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<String>()
{
@Override
public String doWork() throws Exception
{
return TenantUtil.runAsTenant(new TenantUtil.TenantRunAsWork<String>()
{
public String doWork() throws Exception
{
String username = repoService.getPublicApiContext().createUserName(personInfo.getUsername(), tenantDomain);
personInfo.setUsername(username);
RepoService.TestPerson person = repoService.createUser(personInfo, username, network);
return person.getId();
}
}, tenantDomain);
}
}, networkAdmin);
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:27,代码来源:AbstractBaseApiTest.java
示例12: getDocument
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
public FavouriteDocument getDocument(String networkId, final NodeRef nodeRef)
{
return TenantUtil.runAsSystemTenant(new TenantRunAsWork<FavouriteDocument>()
{
@Override
public FavouriteDocument doWork() throws Exception
{
FavouriteDocument document = null;
QName type = nodeService.getType(nodeRef);
if(dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT))
{
Properties properties = getProperties(nodeRef);
document = FavouriteDocument.getDocument(nodeRef.getId(), nodeRef.getId(), properties);
}
else
{
throw new IllegalArgumentException("Not a document node");
}
return document;
}
}, networkId);
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:25,代码来源:RepoService.java
示例13: removeSharedId
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
private void removeSharedId(final String sharedId)
{
TenantUtil.runAsDefaultTenant(new TenantRunAsWork<Void>()
{
public Void doWork() throws Exception
{
attributeService.removeAttribute(ATTR_KEY_SHAREDIDS_ROOT, sharedId);
return null;
}
});
try
{
// Remove scheduled expiry action if any
NodeRef expiryActionNodeRef = getQuickShareLinkExpiryActionNode(sharedId);
if (expiryActionNodeRef != null)
{
deleteQuickShareLinkExpiryAction(expiryActionNodeRef);
}
}
catch (Exception ex)
{
throw new QuickShareLinkExpiryActionException("Couldn't delete the quick share link expiry action for the sharedId:" + sharedId);
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:QuickShareServiceImpl.java
示例14: canRead
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
@Override
public boolean canRead(String sharedId)
{
Pair<String, NodeRef> pair = getTenantNodeRefFromSharedId(sharedId);
final String tenantDomain = pair.getFirst();
final NodeRef nodeRef = pair.getSecond();
return TenantUtil.runAsTenant(new TenantRunAsWork<Boolean>()
{
public Boolean doWork() throws Exception
{
try
{
checkQuickShareNode(nodeRef);
return permissionService.hasPermission(nodeRef, PermissionService.READ) == AccessStatus.ALLOWED;
}
catch (AccessDeniedException ex)
{
return false;
}
}
}, tenantDomain);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:QuickShareServiceImpl.java
示例15: getSiteContainers
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
public List<SiteContainer> getSiteContainers(final String siteId, TestPerson runAs)
{
List<SiteContainer> siteContainers = TenantUtil.runAsUserTenant(new TenantRunAsWork<List<SiteContainer>>()
{
@Override
public List<SiteContainer> doWork() throws Exception
{
PagingResults<FileInfo> results = siteService.listContainers(siteId, new PagingRequest(0, Integer.MAX_VALUE));
List<SiteContainer> ret = new ArrayList<SiteContainer>(results.getPage().size());
for(FileInfo fileInfo : results.getPage())
{
SiteContainer siteContainer = new SiteContainer(siteId, fileInfo.getName(), fileInfo.getNodeRef().getId());
ret.add(siteContainer);
}
return ret;
}
}, runAs.getId(), getId());
return siteContainers;
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:22,代码来源:RepoService.java
示例16: initializeNetwork1
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
private void initializeNetwork1() throws Exception
{
if (network1 == null)
{
network1 = getRepoService().createNetwork(this.getClass().getName().toLowerCase()+"-1-"+RUNID, true);
network1.create();
TenantUtil.runAsSystemTenant(new TenantRunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
person1Id = network1.createUser().getId();
person2Id = network1.createUser().getId();
return null;
}
}, network1.getId());
}
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:20,代码来源:TestSites.java
示例17: getPerson
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
public NodeRef getPerson(final String user)
{
NodeRef person = null;
String domain = tenantService.getPrimaryDomain(user); // get primary tenant
if (domain != null)
{
person = TenantUtil.runAsTenant(new TenantRunAsWork<NodeRef>()
{
public NodeRef doWork() throws Exception
{
return personService.getPerson(user);
}
}, domain);
}
else
{
person = personService.getPerson(user);
}
return person;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:MailActionExecuter.java
示例18: getPersonEmail
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
public String getPersonEmail(final String user)
{
final NodeRef person = getPerson(user);
String email = null;
String domain = tenantService.getPrimaryDomain(user); // get primary tenant
if (domain != null)
{
email = TenantUtil.runAsTenant(new TenantRunAsWork<String>()
{
public String doWork() throws Exception
{
return (String) nodeService.getProperty(person, ContentModel.PROP_EMAIL);
}
}, domain);
}
else
{
email = (String) nodeService.getProperty(person, ContentModel.PROP_EMAIL);
}
return email;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:MailActionExecuter.java
示例19: testAuthenticateMultiTenant
import org.alfresco.repo.tenant.TenantUtil; //导入依赖的package包/类
/**
* Test for ALF-20680
* Test of the {@link RepositoryAuthenticationDao#getUserFolderLocation(String)} in multitenancy
*/
public void testAuthenticateMultiTenant()
{
// Create a tenant domain
TenantUtil.runAsSystemTenant(new TenantUtil.TenantRunAsWork<Object>()
{
public Object doWork() throws Exception
{
if (!tenantAdminService.existsTenant(TEST_TENANT_DOMAIN))
{
tenantAdminService.createTenant(TEST_TENANT_DOMAIN, TENANT_ADMIN_PW.toCharArray(), null);
}
return null;
}
}, TenantService.DEFAULT_DOMAIN);
// Use default admin
authenticateMultiTenantWork(AuthenticationUtil.getAdminUserName(), DEFAULT_ADMIN_PW);
// Use tenant admin
authenticateMultiTenantWork(AuthenticationUtil.getAdminUserName() + TenantService.SEPARATOR + TEST_TENANT_DOMAIN, TENANT_ADMIN_PW);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:AuthenticationTest.java
示例20: 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;
}
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:21,代码来源:CMISAbstractDictionaryService.java
注:本文中的org.alfresco.repo.tenant.TenantUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论