本文整理汇总了Java中org.alfresco.service.cmr.repository.NodeService.getChildAssocs方法的典型用法代码示例。如果您正苦于以下问题:Java NodeService.getChildAssocs方法的具体用法?Java NodeService.getChildAssocs怎么用?Java NodeService.getChildAssocs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.repository.NodeService
的用法示例。
在下文中一共展示了NodeService.getChildAssocs方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateAssociations
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
@Override
protected void updateAssociations(NodeService nodeService)
{
List<ChildAssociationRef> existingChildren = nodeService.getChildAssocs(sourceNodeRef);
for (ChildAssociationRef assoc : existingChildren)
{
if (assoc.getChildRef().equals(targetNodeRef))
{
if (logger.isWarnEnabled())
{
logger.warn("Attempt to add existing child association prevented. " + assoc);
}
return;
}
}
// We are following the behaviour of the JSF client here in using the same
// QName value for the 3rd and 4th parameters in the below call.
nodeService.addChild(sourceNodeRef, targetNodeRef, assocQName, assocQName);
}
示例2: processExcludedSet
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
/**
* @param thisNode NodeRef
* @return Set<NodeRef>
*/
private Set<NodeRef> processExcludedSet(NodeRef thisNode)
{
Set<NodeRef> results = new HashSet<NodeRef>(89);
NodeService nodeService = serviceRegistry.getNodeService();
// Find all the child nodes (filtering as necessary).
List<ChildAssociationRef> children = nodeService.getChildAssocs(thisNode);
boolean filterChildren = !childAssociationTypes.isEmpty();
for (ChildAssociationRef child : children)
{
if (!filterChildren || !childAssociationTypes.contains(child.getTypeQName()))
{
results.add(child.getChildRef());
}
}
return results;
}
示例3: getSystemContainer
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
/**
* Returns the System Container for the current tenant
*/
public static NodeRef getSystemContainer(final NodeService nodeService, final Repository repositoryHelper)
{
// Grab the root of the repository, for the current tennant
final NodeRef root = repositoryHelper.getRootHome();
// Locate the system folder, in the root
List<ChildAssociationRef> sysRefs = nodeService.getChildAssocs(
root, ContentModel.ASSOC_CHILDREN, SYSTEM_FOLDER_QNAME);
if (sysRefs.size() != 1)
{
throw new IllegalStateException("System folder missing / duplicated! Found " + sysRefs);
}
final NodeRef system = sysRefs.get(0).getChildRef();
return system;
}
示例4: getSystemChildContainer
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
/**
* Returns the NodeRef of a given Child Container within the current Tenant's
* System Container, if found
*/
public static NodeRef getSystemChildContainer(final QName childName, final NodeService nodeService, final Repository repositoryHelper)
{
NodeRef system = getSystemContainer(nodeService, repositoryHelper);
// Find the container, under system
List<ChildAssociationRef> containerRefs = nodeService.getChildAssocs(
system, ContentModel.ASSOC_CHILDREN, childName);
NodeRef container = null;
if (containerRefs.size() > 0)
{
container = containerRefs.get(0).getChildRef();
if (containerRefs.size() > 1)
logger.warn("Duplicate Shared Credentials Containers found: " + containerRefs);
}
return container;
}
示例5: processIncludedSet
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
private Set<NodeRef> processIncludedSet(NodeRef startingNode)
{
NodeService nodeService = serviceRegistry.getNodeService();
Set<NodeRef> foundNodes = new HashSet<NodeRef>(89);
for (QName assocType : childAssociationTypes)
{
List<ChildAssociationRef> children = nodeService.getChildAssocs(startingNode, assocType,
RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef child : children)
{
foundNodes.add(child.getChildRef());
}
}
return foundNodes;
}
示例6: logInvasionHierarchy
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
/**
* Puts information about current <code>childRef</code> and its <code>parentRef</code> into log in TRACE level. Information includes 'name', 'fromRepositoryId', 'aliened' and
* 'invadedBy' properties. Additionally, collects the same information for children of <code>childRef</code>
*
* @param parentRef - {@link NodeRef} instance of child node
* @param childRef - {@link NodeRef} instance of parent of the <code>childRef</code>
* @param nodeService - {@link NodeService} instance to get properties and checking other states
* @param log - {@link Log} instance to put log for appropriate class
*/
protected void logInvasionHierarchy(NodeRef parentRef, NodeRef childRef, NodeService nodeService, Log log)
{
Map<QName, Serializable> properties = nodeService.getProperties(childRef);
Map<QName, Serializable> parentProperties = nodeService.getProperties(parentRef);
StringBuilder message = new StringBuilder("Information about '").append(properties.get(ContentModel.PROP_NAME)).append("' node:\n fromRepositoryId: ").append(
properties.get(TransferModel.PROP_FROM_REPOSITORY_ID)).append("\n").append(" invadedBy: ").append(properties.get(TransferModel.PROP_INVADED_BY)).append("\n")
.append(" alien: ").append(nodeService.hasAspect(childRef, TransferModel.ASPECT_ALIEN)).append("\n").append(" repositoryId: ").append(
properties.get(TransferModel.PROP_REPOSITORY_ID)).append("\n").append(" parent: ").append(parentProperties.get(ContentModel.PROP_NAME)).append("(")
.append(parentProperties.get(TransferModel.PROP_FROM_REPOSITORY_ID)).append(")").append(parentProperties.get(TransferModel.PROP_INVADED_BY)).append(": ").append(
nodeService.hasAspect(parentRef, TransferModel.ASPECT_ALIEN)).append("\n").append(" children:\n");
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(childRef);
if ((null != childAssocs) && !childAssocs.isEmpty())
{
for (ChildAssociationRef child : childAssocs)
{
properties = nodeService.getProperties(child.getChildRef());
message.append(" ").append(properties.get(ContentModel.PROP_NAME)).append("(").append(properties.get(TransferModel.PROP_FROM_REPOSITORY_ID)).append(")")
.append(properties.get(TransferModel.PROP_INVADED_BY)).append(": ").append(nodeService.hasAspect(child.getChildRef(), TransferModel.ASPECT_ALIEN)).append(
"\n");
}
}
log.trace(message.toString());
}
示例7: getChildAssocs
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
@Override
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern,
QNamePattern qnamePattern, int maxResults, boolean preload) throws InvalidNodeRefException
{
NodeService nodeService = apiFacet.getNodeService();
return nodeService.getChildAssocs(nodeRef,
typeQNamePattern,
qnamePattern,
maxResults,
preload);
}
示例8: listSchedules
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
private List<ScheduledPersistedAction> listSchedules(NodeService nodeService)
{
List<ChildAssociationRef> childAssocs = nodeService.getChildAssocs(
SCHEDULED_ACTION_ROOT_NODE_REF, ACTION_TYPES);
List<ScheduledPersistedAction> scheduledActions = new ArrayList<ScheduledPersistedAction>(
childAssocs.size());
for (ChildAssociationRef actionAssoc : childAssocs)
{
ScheduledPersistedActionImpl scheduleImpl = loadPersistentSchedule(actionAssoc.getChildRef());
scheduledActions.add(scheduleImpl);
}
return scheduledActions;
}
示例9: getOrCreateFolderPath
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
/**
* Helper method to find or create the folder path referenced by this bean.
* The {@link #getFolderPath() path} to the start of the folder path
* must exist. The folder path will be created, if required.
* <p>
* Authentication and transactions are the client's responsibility.
*
* @return Returns an existing or new folder reference
*/
public NodeRef getOrCreateFolderPath(
NamespaceService namespaceService,
NodeService nodeService,
SearchService searchService,
FileFolderService fileFolderService)
{
NodeRef pathStartNodeRef = super.resolveNodePath(namespaceService, nodeService, searchService);
if (pathStartNodeRef == null)
{
throw new AlfrescoRuntimeException(
"Folder path resolution requires an existing base path. \n" +
" Base path: " + getRootPath());
}
// Just choose the root path if the folder path is empty
if (folderPath.length() == 0)
{
return pathStartNodeRef;
}
else
{
StringTokenizer folders = new StringTokenizer(folderPath, "/");
NodeRef nodeRef = pathStartNodeRef;
while (folders.hasMoreTokens())
{
QName folderQName = QName.createQName(folders.nextToken(), namespaceService);
List<ChildAssociationRef> children = nodeService.getChildAssocs(nodeRef, RegexQNamePattern.MATCH_ALL, folderQName);
if (children.isEmpty())
{
nodeRef = fileFolderService.create(nodeRef, folderQName.getLocalName(), ContentModel.TYPE_FOLDER, folderQName).getNodeRef();
}
else
{
nodeRef = children.get(0).getChildRef();
}
}
return nodeRef;
}
// Done
}
示例10: setUp
import org.alfresco.service.cmr.repository.NodeService; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception
{
if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
{
fail("Dangling transaction detected, left by a previous test.");
}
ctx = (ConfigurableApplicationContext) ApplicationContextHelper.getApplicationContext();
replicationActionExecutor = (ReplicationActionExecutor) ctx.getBean("replicationActionExecutor");
replicationService = (ReplicationService) ctx.getBean("replicationService");
replicationParams = (ReplicationParams) ctx.getBean("replicationParams");
transactionService = (TransactionService) ctx.getBean("transactionService");
transferService = (TransferService2) ctx.getBean("transferService2");
contentService = (ContentService) ctx.getBean("contentService");
jobLockService = (JobLockService) ctx.getBean("jobLockService");
actionService = (ActionService) ctx.getBean("actionService");
scriptService = (ScriptService)ctx.getBean("scriptService");
nodeService = (NodeService) ctx.getBean("NodeService");
lockService = (LockService) ctx.getBean("lockService");
repositoryHelper = (Repository) ctx.getBean("repositoryHelper");
actionTrackingService = (ActionTrackingService) ctx.getBean("actionTrackingService");
scheduledPersistedActionService = (ScheduledPersistedActionService) ctx.getBean("scheduledPersistedActionService");
// Set the current security context as admin
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
replicationParams.setEnabled(true);
UserTransaction txn = transactionService.getUserTransaction();
txn.begin();
// Zap any existing replication entries
replicationRoot = ReplicationDefinitionPersisterImpl.REPLICATION_ACTION_ROOT_NODE_REF;
for(ChildAssociationRef child : nodeService.getChildAssocs(replicationRoot)) {
QName type = nodeService.getType( child.getChildRef() );
if(ReplicationDefinitionPersisterImpl.ACTION_TYPES.contains(type)) {
nodeService.deleteNode(child.getChildRef());
}
}
// Create the test folder structure
destinationFolder = makeNode(repositoryHelper.getCompanyHome(), ContentModel.TYPE_FOLDER, "ReplicationTransferDestination");
folder1 = makeNode(repositoryHelper.getCompanyHome(), ContentModel.TYPE_FOLDER);
folder2 = makeNode(repositoryHelper.getCompanyHome(), ContentModel.TYPE_FOLDER);
folder2a = makeNode(folder2, ContentModel.TYPE_FOLDER);
folder2b = makeNode(folder2, ContentModel.TYPE_FOLDER);
content1_1 = makeNode(folder1, ContentModel.TYPE_CONTENT);
content1_2 = makeNode(folder1, ContentModel.TYPE_CONTENT);
thumbnail1_3 = makeNode(folder1, ContentModel.TYPE_THUMBNAIL);
authority1_4 = makeNode(folder1, ContentModel.TYPE_AUTHORITY);
content2a_1 = makeNode(folder2a, ContentModel.TYPE_CONTENT);
thumbnail2a_2 = makeNode(folder2a, ContentModel.TYPE_THUMBNAIL);
zone2a_3 = makeNode(folder2a, ContentModel.TYPE_ZONE);
deletedFolder = makeNode(repositoryHelper.getCompanyHome(), ContentModel.TYPE_FOLDER);
nodeService.deleteNode(deletedFolder);
// Tell the transfer service not to use HTTP
makeTransferServiceLocal();
// Finish setup
txn.commit();
}