本文整理汇总了Java中org.alfresco.service.cmr.repository.StoreRef类的典型用法代码示例。如果您正苦于以下问题:Java StoreRef类的具体用法?Java StoreRef怎么用?Java StoreRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StoreRef类属于org.alfresco.service.cmr.repository包,在下文中一共展示了StoreRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canGuessMimeType
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
@Test
public void canGuessMimeType()
{
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
ContentService contentService = (ContentService) ctx.getBean("ContentService");
NodeService nodeService = (NodeService) ctx.getBean("NodeService");
StoreRef storeRef = nodeService.createStore("workspace", getClass().getName()+UUID.randomUUID());
NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
NodeRef nodeRef = nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, getClass().getSimpleName()),
ContentModel.TYPE_CONTENT).getChildRef();
ContentWriter writer = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true);
// Pre-condition of test is that we're testing with a potentially problematic BackingStoreAwareCacheWriter
// rather than a FileContentWriter, which we would expect to work.
assertTrue(writer instanceof BackingStoreAwareCacheWriter);
String content = "This is some content";
writer.putContent(content);
writer.guessMimetype("myfile.txt");
assertEquals("text/plain", writer.getMimetype());
}
示例2: getCannedQuery
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
/**
* Retrieve an unsorted instance of a {@link CannedQuery} based on parameters including
* request for a total count (up to a given max)
*
* @param storeRef the store to search in, if requested
* @param aspectQNames qnames of aspects to search for
* @param pagingRequest skipCount, maxItems - optionally queryExecutionId and requestTotalCountMax
*
* @return an implementation that will execute the query
*/
public CannedQuery<NodeRef> getCannedQuery(StoreRef storeRef, Set<QName> aspectQNames, PagingRequest pagingRequest)
{
ParameterCheck.mandatory("aspectQNames", aspectQNames);
ParameterCheck.mandatory("pagingRequest", pagingRequest);
int requestTotalCountMax = pagingRequest.getRequestTotalCountMax();
// specific query params - context (parent) and inclusive filters (child types, property values)
GetNodesWithAspectCannedQueryParams paramBean = new GetNodesWithAspectCannedQueryParams(storeRef, aspectQNames);
// page details
CannedQueryPageDetails cqpd = new CannedQueryPageDetails(pagingRequest.getSkipCount(), pagingRequest.getMaxItems(), CannedQueryPageDetails.DEFAULT_PAGE_NUMBER, CannedQueryPageDetails.DEFAULT_PAGE_COUNT);
// no sort details - no sorting done
// create query params holder
CannedQueryParameters params = new CannedQueryParameters(paramBean, cqpd, null, requestTotalCountMax, pagingRequest.getQueryExecutionId());
// return canned query instance
return getCannedQuery(params);
}
示例3: onSetUpInTransaction
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
/**
* onSetUpInTransaction
*/
@Override
protected void onSetUpInTransaction() throws Exception
{
this.nodeService = (NodeService)this.applicationContext.getBean("nodeService");
this.serviceRegistry = (ServiceRegistry)this.applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
this.configurableService = (ConfigurableService)this.applicationContext.getBean("configurableService");
this.testStoreRef = this.nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
this.rootNodeRef = this.nodeService.getRootNode(this.testStoreRef);
// Create the node used for tests
this.nodeRef = this.nodeService.createNode(
this.rootNodeRef,
ContentModel.ASSOC_CHILDREN,
ContentModel.ASSOC_CHILDREN,
ContentModel.TYPE_CONTAINER).getChildRef();
}
示例4: query
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
@Override
public ResultSet query(StoreRef store, QName queryId, QueryParameter[] queryParameters)
{
CannedQueryDef definition = queryRegister.getQueryDefinition(queryId);
// Do parameter replacement
// As lucene phrases are tokensied it is correct to just do straight
// string replacement.
// The string will be formatted by the tokeniser.
//
// For non phrase queries this is incorrect but string replacement is
// probably the best we can do.
// As numbers and text are indexed specially, direct term queries only
// make sense against textual data
checkParameters(definition, queryParameters);
String queryString = parameterise(definition.getQuery(), definition.getQueryParameterMap(), queryParameters, definition.getNamespacePrefixResolver());
return query(store, definition.getLanguage(), queryString, null);
}
示例5: setUp
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
public void setUp()
{
ctx = ApplicationContextHelper.getApplicationContext();
serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
nodeService = serviceRegistry.getNodeService();
searchService = serviceRegistry.getSearchService();
dictionaryService = serviceRegistry.getDictionaryService();
contentService = serviceRegistry.getContentService();
authenticationService = (MutableAuthenticationService) ctx.getBean("authenticationService");
authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
permissionService = serviceRegistry.getPermissionService();
mimetypeService = serviceRegistry.getMimetypeService();
namespaceService = serviceRegistry.getNamespaceService();
transactionService = serviceRegistry.getTransactionService();
authenticationComponent.setSystemUserAsCurrentUser();
StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
rootNodeRef = nodeService.getRootNode(storeRef);
}
示例6: onSetUpInTransaction
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
@Override
protected void onSetUpInTransaction() throws Exception
{
this.nodeService = (NodeService)this.applicationContext.getBean("nodeService");
// Create the store and get the root node
this.testStoreRef = this.nodeService.createStore(
StoreRef.PROTOCOL_WORKSPACE, "Test_"
+ System.currentTimeMillis());
this.rootNodeRef = this.nodeService.getRootNode(this.testStoreRef);
// Create the node used for tests
this.nodeRef = this.nodeService.createNode(
this.rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName("{test}testnode"),
ContentModel.TYPE_CONTENT).getChildRef();
this.evaluator = (IsSubTypeEvaluator)this.applicationContext.getBean(IsSubTypeEvaluator.NAME);
}
示例7: dumpNodeStore
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
/**
* Dumps the contents of a store to a string.
*
* @param nodeService the node service
* @param storeRef the store reference
* @return string containing textual representation of the contents of the store
*/
public static String dumpNodeStore(NodeService nodeService, StoreRef storeRef)
{
StringBuilder builder = new StringBuilder();
if (nodeService.exists(storeRef) == true)
{
NodeRef rootNode = nodeService.getRootNode(storeRef);
builder.append(outputNode(0, nodeService, rootNode));
}
else
{
builder.
append("The store ").
append(storeRef.toString()).
append(" does not exist.");
}
return builder.toString();
}
示例8: bootstrapSystemTenantStore
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
private void bootstrapSystemTenantStore(ImporterBootstrap systemImporterBootstrap, String tenantDomain)
{
// Bootstrap Tenant-Specific System Store
StoreRef bootstrapStoreRef = systemImporterBootstrap.getStoreRef();
StoreRef tenantBootstrapStoreRef = new StoreRef(bootstrapStoreRef.getProtocol(), tenantService.getName(bootstrapStoreRef.getIdentifier(), tenantDomain));
systemImporterBootstrap.setStoreUrl(tenantBootstrapStoreRef.toString());
// override default property (workspace://SpacesStore)
List<String> mustNotExistStoreUrls = new ArrayList<String>();
mustNotExistStoreUrls.add(new StoreRef(PROTOCOL_STORE_WORKSPACE, tenantService.getName(STORE_BASE_ID_USER, tenantDomain)).toString());
systemImporterBootstrap.setMustNotExistStoreUrls(mustNotExistStoreUrls);
systemImporterBootstrap.bootstrap();
// reset since systemImporter is singleton (hence reused)
systemImporterBootstrap.setStoreUrl(bootstrapStoreRef.toString());
if (logger.isDebugEnabled())
{
logger.debug("Bootstrapped store: "+tenantService.getBaseName(tenantBootstrapStoreRef)+" (Tenant: "+tenantDomain+")");
}
}
示例9: onSetUpInTransaction
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
/**
* Called at the begining of all tests
*/
@SuppressWarnings("deprecation")
@Override
protected void onSetUpInTransaction() throws Exception
{
this.nodeService = (NodeService)this.applicationContext.getBean("nodeService");
this.namespaceService = (NamespaceService)this.applicationContext.getBean("namespaceService");
this.personService = (PersonService)this.applicationContext.getBean("personService");
AuthenticationComponent authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent");
authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());
// Create the store and get the root node
rootNodeRef = nodeService.getRootNode(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"));
this.nodeRef = this.nodeService.createNode(
this.rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName("{test}testnode"),
ContentModel.TYPE_CONTENT).getChildRef();
// Get the executer instance
this.executer = (StartWorkflowActionExecuter)this.applicationContext.getBean(StartWorkflowActionExecuter.NAME);
}
示例10: testBasicAllowStore
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
public void testBasicAllowStore() throws Exception
{
runAs("andy");
Object o = new ClassWithMethods();
Method method = o.getClass().getMethod("echoStoreRef", new Class[] { StoreRef.class });
AdvisorAdapterRegistry advisorAdapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
ProxyFactory proxyFactory = new ProxyFactory();
proxyFactory.addAdvisor(advisorAdapterRegistry.wrap(new Interceptor("AFTER_ACL_NODE.sys:base.Read")));
proxyFactory.setTargetSource(new SingletonTargetSource(o));
Object proxy = proxyFactory.getProxy();
permissionService.setPermission(new SimplePermissionEntry(rootNodeRef, getPermission(PermissionService.READ), "andy", AccessStatus.ALLOWED));
Object answer = method.invoke(proxy, new Object[] { rootNodeRef.getStoreRef() });
assertEquals(answer, rootNodeRef.getStoreRef());
}
示例11: getParentAssocs
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
/**
* The node will apprear to be attached to the root of the version store
*
* @see NodeService#getParentAssocs(NodeRef, QNamePattern, QNamePattern)
*/
public List<ChildAssociationRef> getParentAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern)
{
List<ChildAssociationRef> result = new ArrayList<ChildAssociationRef>();
if (qnamePattern.isMatch(rootAssocName) == true)
{
result.add(new ChildAssociationRef(
ContentModel.ASSOC_CHILDREN,
dbNodeService.getRootNode(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, STORE_ID)),
rootAssocName,
nodeRef));
}
return result;
}
示例12: makeNode
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
/**
* Creates a node with two properties
*/
public void makeNode(ContentData contentData)
{
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
Long rootNodeId = nodeDAO.newStore(storeRef).getFirst();
ChildAssocEntity assoc = nodeDAO.newNode(
rootNodeId,
ContentModel.ASSOC_CHILDREN,
ContentModel.ASSOC_CHILDREN,
storeRef,
null,
ContentModel.TYPE_CONTENT,
I18NUtil.getLocale(),
null,
null);
Long nodeId = assoc.getChildNode().getId();
nodeDAO.addNodeProperty(nodeId, contentQName, contentData);
}
示例13: getAdmStoreRefs
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
@SuppressWarnings("unchecked")
/**
* Helper method that caches ADM store references to prevent repeated and unnecessary calls to the
* NodeService for this list.
*/
private Set<StoreRef> getAdmStoreRefs()
{
Set<StoreRef> storeRefs = (Set<StoreRef>) AlfrescoTransactionSupport.getResource(KEY_STORE_REFS);
if (storeRefs != null)
{
return storeRefs;
}
else
{
storeRefs = new HashSet<StoreRef>(nodeService.getStores());
Iterator<StoreRef> storeRefsIterator = storeRefs.iterator();
while (storeRefsIterator.hasNext())
{
// Remove stores to ignore
StoreRef storeRef = storeRefsIterator.next();
if (isIgnorableStore(storeRef))
{
storeRefsIterator.remove();
}
}
// Bind it in
AlfrescoTransactionSupport.bindResource(KEY_STORE_REFS, storeRefs);
}
return storeRefs;
}
示例14: testException
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
public void testException()
{
StoreRef storeRef1 = new StoreRef("Type1", "id");
NodeRef nodeRef1 = new NodeRef(storeRef1, "id");
TestServiceInterface service = (TestServiceInterface) factory.getBean("redirector_service1");
try
{
service.throwException(nodeRef1);
fail("Service method did not throw exception");
}
catch(Exception e)
{
assertTrue(e instanceof IllegalArgumentException);
assertEquals(nodeRef1.toString(), e.getMessage());
}
}
示例15: RepositoryLocation
import org.alfresco.service.cmr.repository.StoreRef; //导入依赖的package包/类
/**
* Constructor
*
* @param storeRef the store reference (e.g. 'workspace://SpacesStore' )
* @param path the path (e.g. '/app:company_home/app:dictionary/app:models' )
* @param queryLanguage the query language (e.g. 'xpath' or 'lucence')
*/
public RepositoryLocation(StoreRef storeRef, String path, String queryLanguage)
{
this.storeProtocol = storeRef.getProtocol();
this.storeId = storeRef.getIdentifier();
this.path = path;
setQueryLanguage(queryLanguage);
}