我有一个新的内容模型,我创建了一个名为“organization”的新节点,该节点将保存在组织文件夹下。
创建节点后,我注意到节点浏览器和搜索服务将无法找到位于组织文件夹中的组织节点,直到我导航到组织文件夹节点。
可以帮助我吗?
所有回复都受到高度赞赏。
我的代码是:
// Acquire organization folder
Node organizationsFolder = new Node(NodeUtil
.acquireOrganizationsFolder(searchService));
// current organization created
currentOrganization = new Node(
nodeService.createNode(
organizationsFolder.getNodeRef(),
ContentModel.ASSOC_CONTAINS,
QName.createQName(
Constants.DIGITAL_SERIES_SECURITY_MODEL_NAMEPSACE_PREFIX_STRING,
Constants.TYPE_SEC_ORGANIZATION_STRING),
Constants.SecurityModelQNames.TYPE_SEC_ORGANIZATION,
new HashMap<QName,Serializable>()).getChildRef());
// PREPARE ORGANIZATION SEQUENCE ID
Node organizationSeq = new Node(SequenceUtil.prepareSequence(
SequenceUtil.ORGANIZATION_SEQUENCE_NODE_NAME_STRING,
nodeService, searchService));
// LOCK ORGANIZATION SEQUENCE
if(!organizationSeq.isLocked()){
lockService.lock(organizationSeq.getNodeRef(), LockType.NODE_LOCK);
// GET THE NEXT SEQUENCE
SequenceUtil.addCurrentSequence(organizationSeq.getNodeRef(), nodeService);
}
// PREPARE ORGANIZATION PROPERTIES
Map<QName, Serializable> orgProps = new HashMap<QName, Serializable>();
// UPDATE ORGANIZATION SEQUENCE ID
orgProps.put(Constants.SecurityModelQNames.PROP_SEC_ORGANIZATION_ORGANIZATION_ID,
SequenceUtil.getCurrentSequence(
organizationSeq.getNodeRef(), nodeService));
// UPDATE ORGANIZATION/CONTENT NAME PROPERTY
orgProps.put(ContentModel.PROP_NAME,
NodeUtil.extractNodeProperty(Constants.SecurityModelQNames.PROP_SEC_ORGANIZATION_ORGANIZATION_NAME,
currentOrganization).toString() +
"_"+orgProps.get(Constants.SecurityModelQNames.PROP_SEC_ORGANIZATION_ORGANIZATION_ID));
// UPDATE ORGANIZATION NAME PROPERTY
orgProps.put(Constants.SecurityModelQNames.PROP_SEC_ORGANIZATION_ORGANIZATION_NAME,
NodeUtil.extractNodeProperty(Constants.SecurityModelQNames.PROP_SEC_ORGANIZATION_ORGANIZATION_NAME,
currentOrganization).toString());
// UPDATE ORGANIZATION DESCRIPTION
orgProps.put(Constants.SecurityModelQNames.PROP_SEC_ORGANIZATION_ORGANIZATION_DESCRIPTION,
NodeUtil.extractNodeProperty(Constants.SecurityModelQNames.PROP_SEC_ORGANIZATION_ORGANIZATION_DESCRIPTION,
currentOrganization).toString());
// UPDATE THE PROPERTIES TO AN ORGANIZATION NODE
nodeService.setProperties(currentOrganization.getNodeRef(), orgProps);
// UNLOCK
lockService.unlock(organizationSeq.getNodeRef());
由于 穆罕默德·阿姆 高级系统开发人员 数码系列公司
答案 0 :(得分:2)
奇怪,通常它应该有用。
如果您直接尝试搜索创建的内容,索引过程仍然可以处于活动状态。
您可以发布代码如何创建节点吗?