1 17 package org.alfresco.repo.template; 18 19 import java.util.List ; 20 import java.util.StringTokenizer ; 21 22 import org.alfresco.service.ServiceRegistry; 23 import org.alfresco.service.cmr.repository.TemplateNode; 24 25 31 public final class NamePathResultsMap extends BasePathResultsMap 32 { 33 39 public NamePathResultsMap(TemplateNode parent, ServiceRegistry services) 40 { 41 super(parent, services); 42 } 43 44 47 public Object get(Object key) 48 { 49 StringBuilder xpath = new StringBuilder (128); 50 for (StringTokenizer t = new StringTokenizer (key.toString(), "/"); t.hasMoreTokens(); ) 51 { 52 if (xpath.length() != 0) 53 { 54 xpath.append('/'); 55 } 56 xpath.append("*[@cm:name='") 57 .append(t.nextToken()) .append("']"); 59 } 60 61 List <TemplateNode> nodes = getChildrenByXPath(xpath.toString(), true); 62 return (nodes.size() != 0) ? nodes.get(0) : null; 63 } 64 } 65 | Popular Tags |