cancel
Showing results for 
Search instead for 
Did you mean: 

Asset collection query placeholders

aussen2
Champ in-the-making
Champ in-the-making
The standard query definitions for the dynamic asset collections contain a placeholder for a section path. Is there any documentation available on what other placeholders could be used here? Or could you point me to the location in the code where these placeholders are processed?
3 REPLIES 3

bremmington
Champ on-the-rise
Champ on-the-rise
There are a couple of others provided: "siteid" and "sectionid".

However, as you might hope, this is a pluggable component, so you can add in as many more as you want. If you take a look in the file "context-parsers-context.xml" you will see all the provided placeholder processors (they are called "context parsers") along with an abstract bean definition named "wcmquickstartmodule_contextParser". To plug-in a new context parser, create a new class that extends the abstract class "org.alfresco.module.org_alfresco_module_wcmquickstart.util.contextparser.ContextParser" and register a bean for it using the abstract "wcmquickstartmodule_contextParser" bean as its parent.

To take the "section" parser as an example, this is defined by the class "SectionPathContextParser" and the bean "wcmquickstartmodule_sectionPathContextParser". The bean definition looks like this:

    <bean id="wcmquickstartmodule_sectionPathContextParser"
          parent="wcmquickstartmodule_contextParser"
          class="org.alfresco.module.org_alfresco_module_wcmquickstart.util.contextparser.SectionPathContextParser">
        <property name="name" value="section" />
    </bean>
Note the reference to the parent bean: "wcmquickstartmodule_contextParser". Also note the value of the name property of this bean: "section" - by default this is used as the key that ties your parser to a particular placeholder (although this is overridden by this particular parser).

Hopefully that makes sense and gives you the starting point you need. Come back to me if you need more information.

aussen2
Champ in-the-making
Champ in-the-making
Thanks you very much for the quick reply! Based on your explanation I could already implement what I needed using a copy of SectionIdContextParser.java and changing it to return the name of the section instead of the nodeRef.


package org.alfresco.module.org_alfresco_module_wcmquickstart.util.contextparser;

import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeRef;

public class SectionNameContextParser extends ContextParser
{   
   @Override
   public String execute(NodeRef context)
   {
      String result = null;
      NodeRef nodeRef = siteHelper.getRelevantSection(context);
      if (nodeRef != null)
      {
         String nodeName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
         result = nodeName;
      }
      return result;
   }
}

bremmington
Champ on-the-rise
Champ on-the-rise
Great. Glad it helped.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.