Follow the steps below to display custom properties on advanced search screen:
1. The property which needs to be displayed on advanced search page requires modification in web-client-config.xml which is located at - ALFRESCO_TOMCAT_HOME/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/web-client-config.xml.
2. Locate following condition evaluator in web-client-config.xml -
<config evaluator=”string-compare” condition=”Advanced Search”>
3. Advanced search condition evaluator has <advanced-search> child tag which has <custom-properties> child tag.
4. <custom-properties> child tag is used to define custom properties which get displayed on advanced search screen. For example look at the following code snippet:
<meta-data aspect=”cm:algocustompayment” property=”cm:algopayment” />
Click here to view how custom aspect “cm:algocustompayment” and its properties can be created.
5. <meta-data> tag has two attribute aspect and property.
6. The aspect attribute of <meta-data> tag declares the name of the aspect which will appear in drop down on advanced search page. The text in the drop-down to be displayed will be fetched from the “title” tag defined for the aspect in defaultCustomModel.xml.
7. The property attribute of <meta-data> tag declares the property of the aspect which will appear in list of search fields.
NOTE: In this case value of the aspect is “cm:algocustompayment” which will add the human readable name of aspects e.g. “Payment Aspect” to drop down and value of property is “cm:algopayment” which will display the human readable name in search field i.e. “Payment Amount”.
Please follow the steps below to create new aspects in Alfresco:
1. New aspects can be defined in defaultCustomModel.xml file located at ALFRESCO_TOMCAT_HOME/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/model/defaultCustomModel.xml.
2. Find <aspects> tag in defaultCustomModel.xml file. There is only one <aspects> tag and <aspects> tag can contain multiple <aspect> tag.
3. Each <aspect> tag defines a new custom aspect. For example look at the following code snippets:
<aspect name=”cm:algocustompayment”>
<title>Payment Aspect</title>
<properties>
<property name=”cm:algopayment”>
<title>Payment Amount</title>
<type>d:text</type>
<mandatory>false</mandatory>
<index enabled=”true”>
<atomic>true</atomic>
<stored>true</stored>
<tokenised>true</tokenised>
</index>
</property>
</properties>
</aspect>
4. Each <aspect> tag has name attribute which is the name of the aspects.
5. Each <aspect> tag has <title> tag which is the human readable name of the aspect.
6. Each <aspect> tag has <properties> tag which defines the properties associated with that aspect.
7. Each <properties> tag can have multiple <property> tag. Each <property> tag defines a property associated with that aspect.
8. Each <property> tag has mandatory name attribute which defines the name of the property used within alfresco system to identify the property.
9. Each <property> tag has mandatory <title> child tag which is human readable name of the property.
10. Each <property> tag has <type> child tag which is used to define type of the property. The acceptable values are d:any, d:text, d:mltext, d:content, d:int, d:long, d:float, d:double, d:date, d:datetime, d:boolean, d:qname, d:noderef, d:childassocref, d:assocref, d:path, d:category, d:locale, d:version.
11. Each <property> tag has <mandatory> child tag which defines whether this property is mandatory or not. Acceptable values are true and false.
12. Each <property> tag has <index> tag which defines whether this property should be indexed by lucene or not.
Problem comes when you want to use rendered, actionListener and action attributes of < a:actionLink> with variable ‘r’.
Actually the problem is not of < a:actionLink> or of ‘r’ value but of the working process of jsf framework itself.
After rendered, JSF again checks the ‘r’ value and call for the action. And at that time it does not find the value of ‘r’ so fails to perform the action means ‘r’ is not available.
Solution:
To solve this problem you can wrap the < a:actionLink> with < a:booleanEvaluator> tag
and then there is no need to use rendered in < a:actionLink> because the condition can be checked in < a:booleanEvaluator>.
Sample code looks like this:-
< a:booleanEvaluator value=”#{r.myVariable == true/false}” id=”some-id”>
< a:actionLink value=”" id=”newid” image=”someImage.gif” action=”dialog:MyDialog” actionListener=”#{MyDialog.anyAction}” tooltip=”tooltip” showLink=”false”>
< f:param name=”paramName” value=”#{r.paramValue}”/>
< /a:actionLink>
< /a:booleanEvaluator>
Keep AlgoBlogging!!!
Scenario: you need to find noderef of a folder which contains a document of given node id
Solution:
1. First create the NodeRef for the given node id.
StoreRef storeRef = Repository.getStoreRef();
NodeRef documentNodeRef = new NodeRef(storeRef, documentId);Where documentId is the Node Id for which you are trying to get the parent folder NodeRef.
2. Now you would need to take help of “NodeService” to get the parent folder NodeRef. Suppose you have NodeService available in your bean (you can always get the NodeService from getNodeService() method of ServiceRegistry OR get if from session):
ChildAssociationRef childAssociationRef = this.nodeService.getPrimaryParent(documentNodeRef);
NodeRef documentParentNodeRef = childAssociationRef.getParentRef();
documentParentNodeRef is what you were looking for
Happy AlgoBlogging!!!