mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Queries are implemented, and appear to work as expected. Added getKeys() method
to AttributeService. Fixed NPE in MapAttributeImpl. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5514 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -11,6 +11,9 @@
|
|||||||
<property name="globalAttributeEntryDao">
|
<property name="globalAttributeEntryDao">
|
||||||
<ref bean="globalAttributeEntryDAO"/>
|
<ref bean="globalAttributeEntryDAO"/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="attributeDao">
|
||||||
|
<ref bean="attributeDAO"/>
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="attributeConverter" class="org.alfresco.repo.attributes.AttributeConverter"/>
|
<bean id="attributeConverter" class="org.alfresco.repo.attributes.AttributeConverter"/>
|
||||||
|
@@ -28,6 +28,7 @@ package org.alfresco.repo.attributes;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.service.cmr.attributes.AttrQuery;
|
import org.alfresco.service.cmr.attributes.AttrQuery;
|
||||||
|
import org.alfresco.util.Pair;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for persistence operations on attributes.
|
* Interface for persistence operations on attributes.
|
||||||
@@ -49,10 +50,9 @@ public interface AttributeDAO
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Find all attributes that match a given path and AttrQuery.
|
* Find all attributes that match a given path and AttrQuery.
|
||||||
* @param path The path, starting from the top to the map in which to
|
* @param map The map within which to query.
|
||||||
* search for matching attributes.
|
|
||||||
* @param query The AttrQuery.
|
* @param query The AttrQuery.
|
||||||
* @return A List of Attributes.
|
* @return A List of key, attribute value pairs.
|
||||||
*/
|
*/
|
||||||
List<Attribute> find(String path, AttrQuery query);
|
List<Pair<String,Attribute>> find(MapAttribute map, AttrQuery query);
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,7 @@ import org.alfresco.service.cmr.attributes.AttributeService;
|
|||||||
import org.alfresco.service.cmr.avm.AVMBadArgumentException;
|
import org.alfresco.service.cmr.avm.AVMBadArgumentException;
|
||||||
import org.alfresco.service.cmr.avm.AVMNotFoundException;
|
import org.alfresco.service.cmr.avm.AVMNotFoundException;
|
||||||
import org.alfresco.service.cmr.avm.AVMWrongTypeException;
|
import org.alfresco.service.cmr.avm.AVMWrongTypeException;
|
||||||
|
import org.alfresco.util.Pair;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of the AttributeService interface.
|
* Implementation of the AttributeService interface.
|
||||||
@@ -43,6 +44,8 @@ public class AttributeServiceImpl implements AttributeService
|
|||||||
{
|
{
|
||||||
private GlobalAttributeEntryDAO fGlobalAttributeEntryDAO;
|
private GlobalAttributeEntryDAO fGlobalAttributeEntryDAO;
|
||||||
|
|
||||||
|
private AttributeDAO fAttributeDAO;
|
||||||
|
|
||||||
private AttributeConverter fAttributeConverter;
|
private AttributeConverter fAttributeConverter;
|
||||||
|
|
||||||
public AttributeServiceImpl()
|
public AttributeServiceImpl()
|
||||||
@@ -54,6 +57,11 @@ public class AttributeServiceImpl implements AttributeService
|
|||||||
fGlobalAttributeEntryDAO = dao;
|
fGlobalAttributeEntryDAO = dao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAttributeDao(AttributeDAO dao)
|
||||||
|
{
|
||||||
|
fAttributeDAO = dao;
|
||||||
|
}
|
||||||
|
|
||||||
public void setAttributeConverter(AttributeConverter converter)
|
public void setAttributeConverter(AttributeConverter converter)
|
||||||
{
|
{
|
||||||
fAttributeConverter = converter;
|
fAttributeConverter = converter;
|
||||||
@@ -138,9 +146,49 @@ public class AttributeServiceImpl implements AttributeService
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.service.cmr.attributes.AttributeService#query(java.lang.String, org.alfresco.service.cmr.attributes.AttrQuery)
|
* @see org.alfresco.service.cmr.attributes.AttributeService#query(java.lang.String, org.alfresco.service.cmr.attributes.AttrQuery)
|
||||||
*/
|
*/
|
||||||
public List<Attribute> query(String path, AttrQuery query)
|
public List<Pair<String, Attribute>> query(String path, AttrQuery query)
|
||||||
{
|
{
|
||||||
return null;
|
if (path == null)
|
||||||
|
{
|
||||||
|
throw new AVMBadArgumentException("Null Attribute Path.");
|
||||||
|
}
|
||||||
|
List<String> keys = parsePath(path);
|
||||||
|
if (keys.size() == 0)
|
||||||
|
{
|
||||||
|
throw new AVMBadArgumentException("Cannot query top level Attributes.");
|
||||||
|
}
|
||||||
|
GlobalAttributeEntry entry = fGlobalAttributeEntryDAO.get(keys.get(0));
|
||||||
|
if (entry == null)
|
||||||
|
{
|
||||||
|
throw new AVMNotFoundException("Attribute Not Found: " + keys.get(0));
|
||||||
|
}
|
||||||
|
Attribute current = entry.getAttribute();
|
||||||
|
if (current.getType() != Type.MAP)
|
||||||
|
{
|
||||||
|
throw new AVMWrongTypeException("Attribute Not Map: " + keys.get(0));
|
||||||
|
}
|
||||||
|
for (int i = 1; i < keys.size(); i++)
|
||||||
|
{
|
||||||
|
current = current.get(keys.get(i));
|
||||||
|
if (current == null)
|
||||||
|
{
|
||||||
|
throw new AVMNotFoundException("Attribute Not Found: " + keys.get(i));
|
||||||
|
}
|
||||||
|
if (current.getType() != Type.MAP)
|
||||||
|
{
|
||||||
|
throw new AVMWrongTypeException("Attribute Not Map: " + keys.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<Pair<String, Attribute>> rawResult =
|
||||||
|
fAttributeDAO.find((MapAttribute)current, query);
|
||||||
|
List<Pair<String, Attribute>> result =
|
||||||
|
new ArrayList<Pair<String, Attribute>>();
|
||||||
|
for (Pair<String, Attribute> raw : rawResult)
|
||||||
|
{
|
||||||
|
result.add(new Pair<String, Attribute>(raw.getFirst(),
|
||||||
|
fAttributeConverter.toValue(raw.getSecond())));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -267,3 +315,4 @@ public class AttributeServiceImpl implements AttributeService
|
|||||||
return new ArrayList<String>(current.keySet());
|
return new ArrayList<String>(current.keySet());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,7 +27,18 @@ package org.alfresco.repo.attributes;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.alfresco.service.cmr.attributes.AttrAndQuery;
|
||||||
|
import org.alfresco.service.cmr.attributes.AttrNotQuery;
|
||||||
|
import org.alfresco.service.cmr.attributes.AttrOrQuery;
|
||||||
|
import org.alfresco.service.cmr.attributes.AttrQueryEquals;
|
||||||
|
import org.alfresco.service.cmr.attributes.AttrQueryGT;
|
||||||
|
import org.alfresco.service.cmr.attributes.AttrQueryGTE;
|
||||||
|
import org.alfresco.service.cmr.attributes.AttrQueryLT;
|
||||||
|
import org.alfresco.service.cmr.attributes.AttrQueryLTE;
|
||||||
|
import org.alfresco.service.cmr.attributes.AttrQueryLike;
|
||||||
|
import org.alfresco.service.cmr.attributes.AttrQueryNE;
|
||||||
import org.alfresco.service.cmr.attributes.AttributeService;
|
import org.alfresco.service.cmr.attributes.AttributeService;
|
||||||
|
import org.alfresco.util.Pair;
|
||||||
import org.springframework.context.support.FileSystemXmlApplicationContext;
|
import org.springframework.context.support.FileSystemXmlApplicationContext;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
@@ -38,9 +49,9 @@ import junit.framework.TestCase;
|
|||||||
*/
|
*/
|
||||||
public class AttributeServiceTest extends TestCase
|
public class AttributeServiceTest extends TestCase
|
||||||
{
|
{
|
||||||
private FileSystemXmlApplicationContext fContext = null;
|
private static FileSystemXmlApplicationContext fContext = null;
|
||||||
|
|
||||||
private AttributeService fService;
|
private static AttributeService fService;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see junit.framework.TestCase#setUp()
|
* @see junit.framework.TestCase#setUp()
|
||||||
@@ -66,8 +77,6 @@ public class AttributeServiceTest extends TestCase
|
|||||||
{
|
{
|
||||||
fService.removeAttribute("", key);
|
fService.removeAttribute("", key);
|
||||||
}
|
}
|
||||||
fContext.close();
|
|
||||||
fContext = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBasic()
|
public void testBasic()
|
||||||
@@ -108,4 +117,114 @@ public class AttributeServiceTest extends TestCase
|
|||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the query capability.
|
||||||
|
*/
|
||||||
|
public void testQuery()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Put some attributes in place.
|
||||||
|
MapAttribute map = new MapAttributeValue();
|
||||||
|
map.put("a", new StringAttributeValue("a"));
|
||||||
|
map.put("b", new StringAttributeValue("a"));
|
||||||
|
map.put("c", new StringAttributeValue("a"));
|
||||||
|
map.put("d", new StringAttributeValue("a"));
|
||||||
|
map.put("e", new StringAttributeValue("a"));
|
||||||
|
map.put("f", new StringAttributeValue("a"));
|
||||||
|
map.put("g", new StringAttributeValue("a"));
|
||||||
|
map.put("h", new StringAttributeValue("a"));
|
||||||
|
map.put("i", new StringAttributeValue("a"));
|
||||||
|
map.put("j", new StringAttributeValue("a"));
|
||||||
|
map.put("k", new StringAttributeValue("a"));
|
||||||
|
map.put("l", new StringAttributeValue("a"));
|
||||||
|
map.put("m", new StringAttributeValue("a"));
|
||||||
|
map.put("n", new StringAttributeValue("a"));
|
||||||
|
map.put("o", new StringAttributeValue("a"));
|
||||||
|
map.put("p", new StringAttributeValue("a"));
|
||||||
|
map.put("q", new StringAttributeValue("a"));
|
||||||
|
map.put("r", new StringAttributeValue("a"));
|
||||||
|
map.put("s", new StringAttributeValue("a"));
|
||||||
|
map.put("t", new StringAttributeValue("a"));
|
||||||
|
map.put("u", new StringAttributeValue("a"));
|
||||||
|
map.put("v", new StringAttributeValue("a"));
|
||||||
|
map.put("w", new StringAttributeValue("a"));
|
||||||
|
map.put("x", new StringAttributeValue("a"));
|
||||||
|
map.put("y", new StringAttributeValue("a"));
|
||||||
|
map.put("z", new StringAttributeValue("a"));
|
||||||
|
fService.setAttribute("", "map1", map);
|
||||||
|
fService.setAttribute("", "map2", map);
|
||||||
|
List<Pair<String, Attribute>> result =
|
||||||
|
fService.query("map1", new AttrQueryEquals("w"));
|
||||||
|
assertEquals(1, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map1", new AttrQueryLT("d"));
|
||||||
|
assertEquals(3, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map1", new AttrQueryLTE("d"));
|
||||||
|
assertEquals(4, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map1", new AttrQueryGT("v"));
|
||||||
|
assertEquals(4, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map1", new AttrQueryGTE("v"));
|
||||||
|
assertEquals(5, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map1", new AttrQueryNE("g"));
|
||||||
|
assertEquals(25, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map1", new AttrNotQuery(new AttrQueryGT("d")));
|
||||||
|
assertEquals(4, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map1", new AttrAndQuery(new AttrQueryGT("g"),
|
||||||
|
new AttrQueryLT("l")));
|
||||||
|
assertEquals(4, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map1", new AttrOrQuery(new AttrQueryLT("d"),
|
||||||
|
new AttrQueryGT("w")));
|
||||||
|
assertEquals(6, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map1", new AttrQueryLike("%"));
|
||||||
|
assertEquals(26, result.size());
|
||||||
|
fService.setAttribute("map2", "submap", map);
|
||||||
|
result =
|
||||||
|
fService.query("map2/submap", new AttrQueryEquals("w"));
|
||||||
|
assertEquals(1, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map2/submap", new AttrQueryLT("d"));
|
||||||
|
assertEquals(3, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map2/submap", new AttrQueryLTE("d"));
|
||||||
|
assertEquals(4, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map2/submap", new AttrQueryGT("v"));
|
||||||
|
assertEquals(4, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map2/submap", new AttrQueryGTE("v"));
|
||||||
|
assertEquals(5, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map2/submap", new AttrQueryNE("g"));
|
||||||
|
assertEquals(25, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map2/submap", new AttrNotQuery(new AttrQueryGT("d")));
|
||||||
|
assertEquals(4, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map2/submap", new AttrAndQuery(new AttrQueryGT("g"),
|
||||||
|
new AttrQueryLT("l")));
|
||||||
|
assertEquals(4, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map2/submap", new AttrOrQuery(new AttrQueryLT("d"),
|
||||||
|
new AttrQueryGT("w")));
|
||||||
|
assertEquals(6, result.size());
|
||||||
|
result =
|
||||||
|
fService.query("map2/submap", new AttrQueryLike("%"));
|
||||||
|
assertEquals(26, result.size());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -182,7 +182,7 @@ public class MapAttributeImpl extends AttributeImpl implements MapAttribute
|
|||||||
public void put(String key, Attribute value)
|
public void put(String key, Attribute value)
|
||||||
{
|
{
|
||||||
MapEntry entry = AVMDAOs.Instance().fMapEntryDAO.get(this, key);
|
MapEntry entry = AVMDAOs.Instance().fMapEntryDAO.get(this, key);
|
||||||
if (entry == null)
|
if (entry != null)
|
||||||
{
|
{
|
||||||
Attribute oldAttr = entry.getAttribute();
|
Attribute oldAttr = entry.getAttribute();
|
||||||
entry.setAttribute(value);
|
entry.setAttribute(value);
|
||||||
|
@@ -25,15 +25,22 @@
|
|||||||
|
|
||||||
package org.alfresco.repo.attributes.hibernate;
|
package org.alfresco.repo.attributes.hibernate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.repo.attributes.AttrQueryHelperImpl;
|
||||||
import org.alfresco.repo.attributes.Attribute;
|
import org.alfresco.repo.attributes.Attribute;
|
||||||
import org.alfresco.repo.attributes.AttributeDAO;
|
import org.alfresco.repo.attributes.AttributeDAO;
|
||||||
import org.alfresco.repo.attributes.MapAttribute;
|
import org.alfresco.repo.attributes.MapAttribute;
|
||||||
|
import org.alfresco.repo.attributes.MapEntry;
|
||||||
import org.alfresco.repo.attributes.MapEntryDAO;
|
import org.alfresco.repo.attributes.MapEntryDAO;
|
||||||
import org.alfresco.repo.attributes.Attribute.Type;
|
import org.alfresco.repo.attributes.Attribute.Type;
|
||||||
import org.alfresco.service.cmr.attributes.AttrQuery;
|
import org.alfresco.service.cmr.attributes.AttrQuery;
|
||||||
|
import org.alfresco.service.cmr.attributes.AttrQueryHelper;
|
||||||
|
import org.alfresco.util.Pair;
|
||||||
|
import org.hibernate.Query;
|
||||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,10 +82,25 @@ public class AttributeDAOHibernate extends HibernateDaoSupport implements
|
|||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.repo.attributes.AttributeDAO#find(java.lang.String, org.alfresco.service.cmr.attributes.AttrQuery)
|
* @see org.alfresco.repo.attributes.AttributeDAO#find(java.lang.String, org.alfresco.service.cmr.attributes.AttrQuery)
|
||||||
*/
|
*/
|
||||||
public List<Attribute> find(String path, AttrQuery query)
|
@SuppressWarnings("unchecked")
|
||||||
|
public List<Pair<String, Attribute>> find(MapAttribute map, AttrQuery query)
|
||||||
{
|
{
|
||||||
// TODO Need to implement query processing.
|
AttrQueryHelper helper = new AttrQueryHelperImpl();
|
||||||
return null;
|
String predicate = query.getPredicate(helper);
|
||||||
|
String fullQuery = "from MapEntryImpl me where me.map = :map and " + predicate;
|
||||||
|
Query hQuery = getSession().createQuery(fullQuery);
|
||||||
|
hQuery.setEntity("map", map);
|
||||||
|
for (Map.Entry<String, String> param : helper.getParameters().entrySet())
|
||||||
|
{
|
||||||
|
hQuery.setParameter(param.getKey(), param.getValue());
|
||||||
|
}
|
||||||
|
List<MapEntry> hits = (List<MapEntry>)hQuery.list();
|
||||||
|
List<Pair<String, Attribute>> result = new ArrayList<Pair<String, Attribute>>();
|
||||||
|
for (MapEntry entry : hits)
|
||||||
|
{
|
||||||
|
result.add(new Pair<String, Attribute>(entry.getKey(), entry.getAttribute()));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@@ -44,8 +44,8 @@ public class AttrQueryEquals extends AttrQuery
|
|||||||
@Override
|
@Override
|
||||||
public String getPredicate(AttrQueryHelper helper)
|
public String getPredicate(AttrQueryHelper helper)
|
||||||
{
|
{
|
||||||
String name = ":name" + helper.getNextSuffix();
|
String name = "name" + helper.getNextSuffix();
|
||||||
helper.setParameter(name, fValue);
|
helper.setParameter(name, fValue);
|
||||||
return "me.key = " + name;
|
return "me.key = :" + name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,8 +47,8 @@ public class AttrQueryGT extends AttrQuery
|
|||||||
@Override
|
@Override
|
||||||
public String getPredicate(AttrQueryHelper helper)
|
public String getPredicate(AttrQueryHelper helper)
|
||||||
{
|
{
|
||||||
String name = ":name" + helper.getNextSuffix();
|
String name = "name" + helper.getNextSuffix();
|
||||||
helper.setParameter(name, fValue);
|
helper.setParameter(name, fValue);
|
||||||
return "me.key > " + name;
|
return "me.key > :" + name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -48,8 +48,8 @@ public class AttrQueryGTE extends AttrQuery
|
|||||||
@Override
|
@Override
|
||||||
public String getPredicate(AttrQueryHelper helper)
|
public String getPredicate(AttrQueryHelper helper)
|
||||||
{
|
{
|
||||||
String name = ":name" + helper.getNextSuffix();
|
String name = "name" + helper.getNextSuffix();
|
||||||
helper.setParameter(name, fValue);
|
helper.setParameter(name, fValue);
|
||||||
return "me.key >= " + name;
|
return "me.key >= :" + name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,8 +47,8 @@ public class AttrQueryLT extends AttrQuery
|
|||||||
@Override
|
@Override
|
||||||
public String getPredicate(AttrQueryHelper helper)
|
public String getPredicate(AttrQueryHelper helper)
|
||||||
{
|
{
|
||||||
String name = ":name" + helper.getNextSuffix();
|
String name = "name" + helper.getNextSuffix();
|
||||||
helper.setParameter(name, fValue);
|
helper.setParameter(name, fValue);
|
||||||
return "me.key < " + name;
|
return "me.key < :" + name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,8 +47,8 @@ public class AttrQueryLTE extends AttrQuery
|
|||||||
@Override
|
@Override
|
||||||
public String getPredicate(AttrQueryHelper helper)
|
public String getPredicate(AttrQueryHelper helper)
|
||||||
{
|
{
|
||||||
String name = ":name" + helper.getNextSuffix();
|
String name = "name" + helper.getNextSuffix();
|
||||||
helper.setParameter(name, fValue);
|
helper.setParameter(name, fValue);
|
||||||
return "me.key <= " + name;
|
return "me.key <= :" + name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -48,8 +48,8 @@ public class AttrQueryLike extends AttrQuery
|
|||||||
@Override
|
@Override
|
||||||
public String getPredicate(AttrQueryHelper helper)
|
public String getPredicate(AttrQueryHelper helper)
|
||||||
{
|
{
|
||||||
String name = ":name" + helper.getNextSuffix();
|
String name = "name" + helper.getNextSuffix();
|
||||||
helper.setParameter(name, fValue);
|
helper.setParameter(name, fValue);
|
||||||
return "me.key like " + name;
|
return "me.key like :" + name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,8 +47,8 @@ public class AttrQueryNE extends AttrQuery
|
|||||||
@Override
|
@Override
|
||||||
public String getPredicate(AttrQueryHelper helper)
|
public String getPredicate(AttrQueryHelper helper)
|
||||||
{
|
{
|
||||||
String name = ":name" + helper.getNextSuffix();
|
String name = "name" + helper.getNextSuffix();
|
||||||
helper.setParameter(name, fValue);
|
helper.setParameter(name, fValue);
|
||||||
return "me.key <> " + name;
|
return "me.key <> :" + name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,6 +28,7 @@ package org.alfresco.service.cmr.attributes;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.alfresco.repo.attributes.Attribute;
|
import org.alfresco.repo.attributes.Attribute;
|
||||||
|
import org.alfresco.util.Pair;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This provides services for reading, writing, and querying global attributes.
|
* This provides services for reading, writing, and querying global attributes.
|
||||||
@@ -62,7 +63,7 @@ public interface AttributeService
|
|||||||
* @param query
|
* @param query
|
||||||
* @return A List of matching attributes.
|
* @return A List of matching attributes.
|
||||||
*/
|
*/
|
||||||
public List<Attribute> query(String path, AttrQuery query);
|
public List<Pair<String, Attribute>> query(String path, AttrQuery query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the keys for a given attribute path.
|
* Get all the keys for a given attribute path.
|
||||||
|
Reference in New Issue
Block a user