Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
169 views
in Technique[技术] by (71.8m points)

alfresco - Node Browser does not work properly

I have a new content model and by it i create a new node called "organization" and that node will be saved under organizations folder.

After create a node i noticed that Node Browser and search Service will not be able to find my organization(s) nodes which are located in the organizations folder until i navigate to the organizations folder node.

Can any on help me ?

All of your replies are highly appreciated.

My Code Is:

                // 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());

Thanks Mohammed Amr Senior System Developer Digital Series Co.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Strange, normally it should work.

The indexing process could be still active if you directly try to search the created content.

Can you post your code how you create the node?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...