本文整理汇总了Java中org.alfresco.service.cmr.repository.StoreRef.PROTOCOL_WORKSPACE属性的典型用法代码示例。如果您正苦于以下问题:Java StoreRef.PROTOCOL_WORKSPACE属性的具体用法?Java StoreRef.PROTOCOL_WORKSPACE怎么用?Java StoreRef.PROTOCOL_WORKSPACE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.alfresco.service.cmr.repository.StoreRef
的用法示例。
在下文中一共展示了StoreRef.PROTOCOL_WORKSPACE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeNode
/**
* 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);
}
示例2: getLoadedCategoryRoot
private NodeRef getLoadedCategoryRoot()
{
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
CategoryService categoryService = serviceRegistry.getCategoryService();
// Check if the categories exist
Collection<ChildAssociationRef> assocRefs = categoryService.getRootCategories(
storeRef,
ContentModel.ASPECT_GEN_CLASSIFIABLE);
// Find it
for (ChildAssociationRef assocRef : assocRefs)
{
NodeRef nodeRef = assocRef.getChildRef();
if (nodeRef.getId().equals("test:xyz-root"))
{
// Found it
return nodeRef;
}
}
return null;
}
示例3: setUp
/**
* Test case set up
*/
protected void setUp() throws Exception
{
super.setUp();
// Create the node reference
this.nodeRef = new NodeRef(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "testWS"), "testID");
assertNotNull(this.nodeRef);
// Create the version property map
this.versionProperties = new HashMap<String, Serializable>();
this.versionProperties.put(VersionModel.PROP_VERSION_LABEL, VERSION_1);
this.versionProperties.put(VersionModel.PROP_CREATED_DATE, this.createdDate);
this.versionProperties.put(VersionModel.PROP_CREATOR, USER_NAME);
this.versionProperties.put(Version.PROP_DESCRIPTION, VALUE_DESCRIPTION);
this.versionProperties.put(VersionModel.PROP_VERSION_TYPE, VERSION_TYPE);
this.versionProperties.put(PROP_1, VALUE_1);
this.versionProperties.put(PROP_2, VALUE_2);
this.versionProperties.put(PROP_3, VALUE_3);
// Create the root version
this.version = new VersionImpl(this.versionProperties, this.nodeRef);
assertNotNull(this.version);
}
示例4: createTestFolders
private void createTestFolders()
{
StoreRef testStore = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, TEST_STORE_IDENTIFIER);
if (!nodeService.exists(testStore))
{
testStore = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, TEST_STORE_IDENTIFIER);
}
NodeRef rootNodeRef = nodeService.getRootNode(testStore);
testWorkNodeRef = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}testnode"), ContentModel.TYPE_FOLDER).getChildRef();
testNodeRef = fileFolderService.create(testWorkNodeRef, TEST_FOLDER, ContentModel.TYPE_FOLDER).getNodeRef();
testNodeRef2 = fileFolderService.create(testWorkNodeRef, TEST_FOLDER_2, ContentModel.TYPE_FOLDER).getNodeRef();
}
示例5: getOrCreateRootFolder
protected NodeRef getOrCreateRootFolder()
{
// find the company home folder
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
NodeRef storeRootNodeRef = nodeService.getRootNode(storeRef);
List<NodeRef> results = searchService.selectNodes(
storeRootNodeRef,
"/app:company_home",
null,
namespaceService,
false,
SearchService.LANGUAGE_XPATH);
if (results.size() == 0)
{
throw new AlfrescoRuntimeException("Didn't find Company Home");
}
NodeRef companyHomeNodeRef = results.get(0);
return fileFolderService.create(
companyHomeNodeRef,
getName() + "_" + System.currentTimeMillis(),
ContentModel.TYPE_FOLDER).getNodeRef();
}
示例6: testSupportedStores
@Test
public void testSupportedStores() throws Exception
{
NodeRefRadixHasher h = NodeRefRadixHasher.RADIX_36_HASHER;
String[] storeProtocols = new String[] { StoreRef.PROTOCOL_WORKSPACE, StoreRef.PROTOCOL_ARCHIVE,
StoreRef.PROTOCOL_AVM, StoreRef.PROTOCOL_DELETED, VersionService.VERSION_STORE_PROTOCOL };
String[] storeIds = new String[] { "SpacesStore", VersionModel.STORE_ID, Version2Model.STORE_ID };
for (int i = 0; i < storeProtocols.length; i++)
{
for (int j = 0; j < storeIds.length; j++)
{
NodeRef nr = new NodeRef(storeProtocols[i],
storeIds[j],
"0d3b26ff-c4c1-4680-8622-8608ea7ab4b2");
Pair<String, String> nh = h.hash(nr);
NodeRef nr2 = h.lookup(nh);
assertEquals("Could match hash-lookup " + nr,
nr,
nr2);
}
}
}
示例7: setUp
@Override
public void setUp() throws Exception
{
ctx = ApplicationContextHelper.getApplicationContext();
ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry");
nodeService = serviceRegistry.getNodeService();
fileFolderService = serviceRegistry.getFileFolderService();
nodeArchiveService = (NodeArchiveService) ctx.getBean("nodeArchiveService");
authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
transactionService = serviceRegistry.getTransactionService();
try
{
authenticationComponent.setSystemUserAsCurrentUser();
// create a test store
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
rootNodeRef = nodeService.getRootNode(storeRef);
}
finally
{
authenticationComponent.clearCurrentSecurityContext();
}
}
示例8: testCreateTarget
/**
* Test create target.
*
* @throws Exception
*/
public void testCreateTarget() throws Exception
{
if (!transferService.targetExists(TARGET_NAME))
{
//create ROOT_OF_TRANSFER > ROOT_FOLDER_TO_TRANSFER
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
NodeRef companyHome = nodeService.getRootNode(storeRef);
FileInfo fi = fileFolderService.create(companyHome, ROOT_OF_TRANSFER, ContentModel.TYPE_FOLDER);
TransferTargetImpl newTarget = new TransferTargetImpl();
newTarget.setEndpointProtocol("http");
newTarget.setEndpointHost("localhost");
newTarget.setEndpointPort(9090);
newTarget.setEndpointPath("/alfresco-ftr/service/api/transfer");
newTarget.setName(TARGET_NAME);
newTarget.setTitle("FTR test title target");
newTarget.setUsername("phil");
newTarget.setPassword("phil".toCharArray());
transferService.saveTransferTarget(newTarget);
// get the created target and define the root
// the root is implicitly defined has the root of the current node.
// get underlying node ref corresponding to the target definition
NodeRef transferTargetNodeRef = transferService.getTransferTarget(TARGET_NAME).getNodeRef();
//Get the primary parent of the node the action is execute up on
//NodeRef rooTarget = nodeService.getPrimaryParent(actionedUponNodeRef).getParentRef();
//Set the type to "fileTransferTarget" and associate it to the root
nodeService.setType(transferTargetNodeRef, TransferModel.TYPE_FILE_TRANSFER_TARGET);
//create the association
//nodeService.createAssociation(transferTargetNodeRef, rooTarget, TransferModel.ASSOC_ROOT_FILE_TRANSFER);
}
}
示例9: getVersionStoreReference
@Override
@Extend(extensionAPI=VersionServiceExtension.class,traitAPI=VersionServiceTrait.class)
public StoreRef getVersionStoreReference()
{
if (logger.isDebugEnabled())
{
logger.debug("Run as user " + AuthenticationUtil.getRunAsUser());
logger.debug("Fully authenticated " + AuthenticationUtil.getFullyAuthenticatedUser());
}
return new StoreRef(StoreRef.PROTOCOL_WORKSPACE, Version2Model.STORE_ID);
}
示例10: getVersionStoreReference
/**
* Gets the reference to the version store
*
* @return reference to the version store
*/
@Override
public StoreRef getVersionStoreReference()
{
if (logger.isDebugEnabled())
{
logger.debug("Run as user " + AuthenticationUtil.getRunAsUser());
logger.debug("Fully authenticated " + AuthenticationUtil.getFullyAuthenticatedUser());
}
return new StoreRef(
StoreRef.PROTOCOL_WORKSPACE,
VersionModel.STORE_ID);
}
示例11: testHasPermissionSwappedProtocol
/**
* Check permissions for the frozen node if the store protocol is swapped from "version" to "workspace"
* MNT-6877
*/
public void testHasPermissionSwappedProtocol()
{
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
if(!authenticationDAO.userExists(USER_NAME_A))
{
authenticationService.createAuthentication(USER_NAME_A, PWD_A.toCharArray());
}
permissionService.setPermission(rootNodeRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
permissionService.setInheritParentPermissions(rootNodeRef, true);
// Create a new versionable node
NodeRef versionableNode = createNewVersionableNode();
// Create a new version
Version version = createVersion(versionableNode, versionProperties);
NodeRef versionNodeRef = version.getFrozenStateNodeRef();
// Swap the protocol
NodeRef versionNodeRefSwapped = new NodeRef(StoreRef.PROTOCOL_WORKSPACE, versionNodeRef.getStoreRef().getIdentifier(), versionNodeRef.getId());
// Check permission for admin
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(versionNodeRefSwapped, PermissionService.READ));
// Check permission for user
AuthenticationUtil.setFullyAuthenticatedUser(USER_NAME_A);
assertEquals(AccessStatus.ALLOWED, permissionService.hasPermission(versionNodeRefSwapped, PermissionService.READ));
// Remove permissions for user
permissionService.setInheritParentPermissions(versionableNode, false);
// Check permission for user
AuthenticationUtil.setFullyAuthenticatedUser(USER_NAME_A);
assertEquals(AccessStatus.DENIED, permissionService.hasPermission(versionNodeRefSwapped, PermissionService.READ));
}
示例12: setUp
@Override
protected void setUp() throws Exception
{
nodeArchiveService = (NodeArchiveService) ctx.getBean("nodeArchiveService");
serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
authenticationComponent = (AuthenticationComponent) ctx.getBean("AuthenticationComponent");
transactionService = serviceRegistry.getTransactionService();
nodeService = serviceRegistry.getNodeService();
fileFolderService = serviceRegistry.getFileFolderService();
versionService = serviceRegistry.getVersionService();
multilingualContentService = (MultilingualContentService) ctx.getBean("MultilingualContentService");
contentFilterLanguagesService = (ContentFilterLanguagesService) ctx.getBean("ContentFilterLanguagesService");
editionService = (EditionService) ctx.getBean("EditionService");
// Run as admin
authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
// Create a folder to work in
RetryingTransactionCallback<NodeRef> createFolderCallback = new RetryingTransactionCallback<NodeRef>()
{
public NodeRef execute() throws Exception
{
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
NodeRef rootNodeRef = nodeService.getRootNode(storeRef);
// Create the folder
NodeRef folderNodeRef = nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "testFolder"),
ContentModel.TYPE_FOLDER).getChildRef();
// done
return folderNodeRef;
}
};
folderNodeRef = transactionService.getRetryingTransactionHelper().doInTransaction(createFolderCallback);
}
示例13: setUp
@Override
public void setUp() throws Exception
{
ctx = ApplicationContextHelper.getApplicationContext();
transactionService = (TransactionService) ctx.getBean("TransactionService");
nodeService = (NodeService) ctx.getBean("NodeService");
contentService = (ContentService) ctx.getBean(ServiceRegistry.CONTENT_SERVICE.getLocalName());
this.policyComponent = (PolicyComponent) ctx.getBean("policyComponent");
this.authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
// authenticate
this.authenticationComponent.setSystemUserAsCurrentUser();
// start the transaction
txn = getUserTransaction();
txn.begin();
// create a store and get the root node
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, getName());
if (!nodeService.exists(storeRef))
{
storeRef = nodeService.createStore(storeRef.getProtocol(), storeRef.getIdentifier());
}
rootNodeRef = nodeService.getRootNode(storeRef);
// create a content node
ContentData contentData = new ContentData(null, "text/plain", 0L, "UTF-16", Locale.CHINESE);
PropertyMap properties = new PropertyMap();
properties.put(ContentModel.PROP_CONTENT, contentData);
ChildAssociationRef assocRef = nodeService.createNode(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QName.createQName(TEST_NAMESPACE, GUID.generate()),
ContentModel.TYPE_CONTENT,
properties);
contentNodeRef = assocRef.getChildRef();
}
示例14: testBootstrap
public void testBootstrap()
{
StoreRef bootstrapStoreRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
importerBootstrap.setStoreUrl(bootstrapStoreRef.toString());
importerBootstrap.bootstrap();
authenticationComponent.setSystemUserAsCurrentUser();
System.out.println(NodeStoreInspector.dumpNodeStore(nodeService, bootstrapStoreRef));
}
示例15: before
@SuppressWarnings("unchecked")
@Before
public void before()
{
ServiceRegistry serviceRegistry = (ServiceRegistry)ctx.getBean("ServiceRegistry");
NamespaceService namespaceService = serviceRegistry.getNamespaceService();
this.transactionService = serviceRegistry.getTransactionService();
this.authenticationService = (MutableAuthenticationService)ctx.getBean("authenticationService");
this.nodeService = serviceRegistry.getNodeService();
this.searchService = serviceRegistry.getSearchService();
this.nodeDAO = (NodeDAO)ctx.getBean("nodeDAO");
this.nodesCache = (SimpleCache<Serializable, Serializable>) ctx.getBean("node.nodesSharedCache");
this.worker = (DeletedNodeCleanupWorker)ctx.getBean("nodeCleanup.deletedNodeCleanup");
this.worker.setMinPurgeAgeDays(0);
this.helper = transactionService.getRetryingTransactionHelper();
authenticationService.authenticate("admin", "admin".toCharArray());
StoreRef storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
NodeRef storeRoot = nodeService.getRootNode(storeRef);
List<NodeRef> nodeRefs = searchService.selectNodes(
storeRoot, "/app:company_home", null, namespaceService, false);
final NodeRef companyHome = nodeRefs.get(0);
RetryingTransactionHelper.RetryingTransactionCallback<NodeRef> createNode = new RetryingTransactionHelper.RetryingTransactionCallback<NodeRef>()
{
@Override
public NodeRef execute() throws Throwable
{
return nodeService.createNode(companyHome, ContentModel.ASSOC_CONTAINS, QName.createQName("test", GUID.generate()), ContentModel.TYPE_CONTENT).getChildRef();
}
};
this.nodeRef1 = helper.doInTransaction(createNode, false, true);
this.nodeRef2 = helper.doInTransaction(createNode, false, true);
this.nodeRef3 = helper.doInTransaction(createNode, false, true);
this.nodeRef4 = helper.doInTransaction(createNode, false, true);
this.nodeRef5 = helper.doInTransaction(createNode, false, true);
}