本文整理汇总了Java中org.alfresco.service.cmr.repository.NodeService.getChildByName方法的典型用法代码示例。如果您正苦于以下问题:Java NodeService.getChildByName方法的具体用法?Java NodeService.getChildByName怎么用?Java NodeService.getChildByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.repository.NodeService
的用法示例。
在下文中一共展示了NodeService.getChildByName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTopicNode
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
/**
* Adds topic node into Alfresco repository
*
* @param parentNode Parent node
* @param name Topic name
* @return Reference to created node
*/
protected NodeRef addTopicNode(NodeRef parentNode, String name)
{
String workingName = encodeSubject(name);
NodeService nodeService = getNodeService();
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1);
properties.put(ContentModel.PROP_NAME, workingName);
NodeRef topicNode = nodeService.getChildByName(parentNode, ContentModel.ASSOC_CONTAINS, workingName);
if (topicNode == null)
{
ChildAssociationRef association = nodeService.createNode(
parentNode,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, workingName),
ForumModel.TYPE_TOPIC,
properties);
topicNode = association.getChildRef();
}
// Add necessary aspects
properties.clear();
properties.put(ApplicationModel.PROP_ICON, "topic");
getNodeService().addAspect(topicNode, ApplicationModel.ASPECT_UIFACETS, properties);
return topicNode;
}
示例2: setUp
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception
{
super.setUp();
ApplicationContext appContext = getServer().getApplicationContext();
nodeService = (NodeService)appContext.getBean("NodeService");
replicationService = (ReplicationService)appContext.getBean("ReplicationService");
actionTrackingService = (ActionTrackingService)appContext.getBean("actionTrackingService");
repositoryHelper = (Repository)appContext.getBean("repositoryHelper");
transactionService = (TransactionService)appContext.getBean("transactionService");
MutableAuthenticationService authenticationService = (MutableAuthenticationService)appContext.getBean("AuthenticationService");
PersonService personService = (PersonService)appContext.getBean("PersonService");
personManager = new TestPersonManager(authenticationService, personService, nodeService);
UserTransaction txn = transactionService.getUserTransaction();
txn.begin();
personManager.createPerson(USER_NORMAL);
// Ensure we start with no replication definitions
// (eg another test left them behind)
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
for(ReplicationDefinition rd : replicationService.loadReplicationDefinitions()) {
replicationService.deleteReplicationDefinition(rd);
}
txn.commit();
// Grab a reference to the data dictionary
dataDictionary = nodeService.getChildByName(
repositoryHelper.getCompanyHome(),
ContentModel.ASSOC_CONTAINS,
"Data Dictionary"
);
AuthenticationUtil.clearCurrentSecurityContext();
}
示例3: addPostNode
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
/**
* Posts content
*
* @param nodeRef Reference to node
* @param message Mail parser
* @return Returns the new post node
*/
protected NodeRef addPostNode(NodeRef nodeRef, EmailMessage message)
{
NodeService nodeService = getNodeService();
Date now = new Date();
String nodeName = "posted-" + new SimpleDateFormat("dd-MM-yyyy-hh-mm-ss").format(now) + ".html";
PropertyMap properties = new PropertyMap(3);
properties.put(ContentModel.PROP_NAME, nodeName);
NodeRef postNodeRef = nodeService.getChildByName(nodeRef, ContentModel.ASSOC_CONTAINS, nodeName);
if (postNodeRef == null)
{
ChildAssociationRef childAssoc = nodeService.createNode(
nodeRef,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeName),
ForumModel.TYPE_POST,
properties);
postNodeRef = childAssoc.getChildRef();
}
// Add necessary aspects
properties.clear();
properties.put(ContentModel.PROP_TITLE, nodeName);
nodeService.addAspect(postNodeRef, ContentModel.ASPECT_TITLED, properties);
properties.clear();
properties.put(ApplicationModel.PROP_EDITINLINE, true);
nodeService.addAspect(postNodeRef, ApplicationModel.ASPECT_INLINEEDITABLE, properties);
// Write content
if (message.getBody() != null)
{
writeContent(
postNodeRef,
message.getBody().getContent(),
message.getBody().getContentType(),
message.getBody().getEncoding());
}
else
{
writeContent(postNodeRef, "<The message was empty>", MimetypeMap.MIMETYPE_TEXT_PLAIN);
}
addEmailedAspect(postNodeRef, message);
// Done
return postNodeRef;
}
示例4: setUp
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception
{
applicationContext = ApplicationContextHelper.getApplicationContext();
repositoryHelper = (Repository)this.applicationContext.getBean("repositoryHelper");
ApplicationContextFactory fileServers = (ApplicationContextFactory) this.applicationContext.getBean("fileServers");
cifsHelper = (CifsHelper) fileServers.getApplicationContext().getBean("cifsHelper");
driver = (ExtendedDiskInterface)this.applicationContext.getBean("contentDiskDriver");
mlAwareNodeService = (NodeService) this.applicationContext.getBean("mlAwareNodeService");
nodeService = (NodeService)applicationContext.getBean("nodeService");
transactionService = (TransactionService)applicationContext.getBean("transactionService");
contentService = (ContentService)applicationContext.getBean("contentService");
ruleService = (RuleService)applicationContext.getBean("ruleService");
actionService = (ActionService)this.applicationContext.getBean("actionService");
personService = (PersonService) this.applicationContext.getBean("personService");
authenticationService = (MutableAuthenticationService) this.applicationContext.getBean("authenticationService");
permissionService = (PermissionService) this.applicationContext.getBean("permissionService");
ownableService = (OwnableService) this.applicationContext.getBean("ownableService");
fileFolderService = (FileFolderService) this.applicationContext.getBean("fileFolderService");
checkOutCheckInService = (CheckOutCheckInService) this.applicationContext.getBean("checkOutCheckInService");
assertNotNull("content disk driver is null", driver);
assertNotNull("repositoryHelper is null", repositoryHelper);
assertNotNull("mlAwareNodeService is null", mlAwareNodeService);
assertNotNull("nodeService is null", nodeService);
assertNotNull("transactionService is null", transactionService);
assertNotNull("contentService is null", contentService);
assertNotNull("ruleService is null", ruleService);
assertNotNull("actionService is null", actionService);
assertNotNull("cifsHelper", cifsHelper);
assertNotNull("checkOutCheckInService", checkOutCheckInService);
AuthenticationUtil.setRunAsUserSystem();
// remove our test root
RetryingTransactionCallback<Void> removeRootCB = new RetryingTransactionCallback<Void>() {
@Override
public Void execute() throws Throwable
{
NodeRef companyHome = repositoryHelper.getCompanyHome();
NodeRef rootNode = nodeService.getChildByName(companyHome, ContentModel.ASSOC_CONTAINS, TEST_ROOT_PATH);
if(rootNode != null)
{
logger.debug("Clean up test root node");
nodeService.deleteNode(rootNode);
}
return null;
}
};
final RetryingTransactionHelper tran = transactionService.getRetryingTransactionHelper();
tran.doInTransaction(removeRootCB, false, true);
}
示例5: setUp
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void setUp() throws Exception
{
super.setUp();
ApplicationContext appContext = getServer().getApplicationContext();
nodeService = (NodeService)appContext.getBean("NodeService");
replicationService = (ReplicationService)appContext.getBean("ReplicationService");
actionTrackingService = (ActionTrackingService)appContext.getBean("actionTrackingService");
repositoryHelper = (Repository)appContext.getBean("repositoryHelper");
transactionService = (TransactionService)appContext.getBean("transactionService");
executingActionsCache = (SimpleCache<String, ExecutionDetails>)appContext.getBean("executingActionsCache");
MutableAuthenticationService authenticationService = (MutableAuthenticationService)appContext.getBean("AuthenticationService");
PersonService personService = (PersonService)appContext.getBean("PersonService");
personManager = new TestPersonManager(authenticationService, personService, nodeService);
UserTransaction txn = transactionService.getUserTransaction();
txn.begin();
personManager.createPerson(USER_NORMAL);
// Ensure we start with no replication definitions
// (eg another test left them behind)
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
for(ReplicationDefinition rd : replicationService.loadReplicationDefinitions())
{
replicationService.deleteReplicationDefinition(rd);
}
txn.commit();
// Grab a reference to the data dictionary
dataDictionary = nodeService.getChildByName(
repositoryHelper.getCompanyHome(),
ContentModel.ASSOC_CONTAINS,
"Data Dictionary"
);
AuthenticationUtil.clearCurrentSecurityContext();
}