mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
More SearchService refactor. Added CMIS SQL to the search service. Tidy ups. FTS supports default namespace and templates via search parameters API. (MOB-568, MOB-569)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14463 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,6 +24,9 @@
|
||||
*/
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* CMIS Property Types Enum
|
||||
*
|
||||
@@ -31,19 +34,74 @@ package org.alfresco.cmis;
|
||||
*/
|
||||
public enum CMISDataTypeEnum implements EnumLabel
|
||||
{
|
||||
STRING("string"),
|
||||
DECIMAL("decimal"),
|
||||
INTEGER("integer"),
|
||||
BOOLEAN("boolean"),
|
||||
DATETIME("datetime"),
|
||||
URI("uri"),
|
||||
ID("id"),
|
||||
XML("xml"),
|
||||
HTML("html");
|
||||
|
||||
|
||||
STRING("string")
|
||||
{
|
||||
public QName getDefaultDataType()
|
||||
{
|
||||
return DataTypeDefinition.TEXT;
|
||||
}
|
||||
},
|
||||
DECIMAL("decimal")
|
||||
{
|
||||
public QName getDefaultDataType()
|
||||
{
|
||||
return DataTypeDefinition.DOUBLE;
|
||||
}
|
||||
},
|
||||
INTEGER("integer")
|
||||
{
|
||||
public QName getDefaultDataType()
|
||||
{
|
||||
return DataTypeDefinition.LONG;
|
||||
}
|
||||
},
|
||||
BOOLEAN("boolean")
|
||||
{
|
||||
public QName getDefaultDataType()
|
||||
{
|
||||
return DataTypeDefinition.BOOLEAN;
|
||||
}
|
||||
},
|
||||
DATETIME("datetime")
|
||||
{
|
||||
public QName getDefaultDataType()
|
||||
{
|
||||
return DataTypeDefinition.DATETIME;
|
||||
}
|
||||
},
|
||||
URI("uri")
|
||||
{
|
||||
public QName getDefaultDataType()
|
||||
{
|
||||
return DataTypeDefinition.TEXT;
|
||||
}
|
||||
},
|
||||
ID("id")
|
||||
{
|
||||
public QName getDefaultDataType()
|
||||
{
|
||||
return DataTypeDefinition.TEXT;
|
||||
}
|
||||
},
|
||||
XML("xml")
|
||||
{
|
||||
public QName getDefaultDataType()
|
||||
{
|
||||
return DataTypeDefinition.TEXT;
|
||||
}
|
||||
},
|
||||
HTML("html")
|
||||
{
|
||||
public QName getDefaultDataType()
|
||||
{
|
||||
return DataTypeDefinition.TEXT;
|
||||
}
|
||||
};
|
||||
|
||||
public abstract QName getDefaultDataType();
|
||||
|
||||
private String label;
|
||||
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
@@ -54,7 +112,9 @@ public enum CMISDataTypeEnum implements EnumLabel
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.alfresco.cmis.EnumLabel#label()
|
||||
*/
|
||||
public String getLabel()
|
||||
@@ -62,5 +122,5 @@ public enum CMISDataTypeEnum implements EnumLabel
|
||||
return label;
|
||||
}
|
||||
|
||||
public static EnumFactory<CMISDataTypeEnum> FACTORY = new EnumFactory<CMISDataTypeEnum>(CMISDataTypeEnum.class, null, true);
|
||||
public static EnumFactory<CMISDataTypeEnum> FACTORY = new EnumFactory<CMISDataTypeEnum>(CMISDataTypeEnum.class, null, true);
|
||||
}
|
||||
|
@@ -24,6 +24,8 @@
|
||||
*/
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.service.cmr.search.ResultSetSPI;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -31,7 +33,7 @@ package org.alfresco.cmis;
|
||||
*
|
||||
* @author andyh
|
||||
*/
|
||||
public interface CMISResultSet extends Iterable<CMISResultSetRow>
|
||||
public interface CMISResultSet extends ResultSetSPI<CMISResultSetRow, CMISResultSetMetaData>
|
||||
{
|
||||
/**
|
||||
* Get the result set meta-data.
|
||||
@@ -39,13 +41,6 @@ public interface CMISResultSet extends Iterable<CMISResultSetRow>
|
||||
*/
|
||||
public CMISResultSetMetaData getMetaData();
|
||||
|
||||
/**
|
||||
* Get the start point for this results set in the overall
|
||||
* set of rows that match the query - this will be equal to the skip count
|
||||
* set when executing the query.
|
||||
* @return the start position
|
||||
*/
|
||||
public int getStart();
|
||||
|
||||
/**
|
||||
* Get the number of rows in this result set.
|
||||
@@ -60,25 +55,5 @@ public interface CMISResultSet extends Iterable<CMISResultSetRow>
|
||||
*/
|
||||
public int getLength();
|
||||
|
||||
/**
|
||||
* Close the result set and release any resources held/
|
||||
* The result set is also bound to the transaction and will auto close at
|
||||
* the end of the transaction.
|
||||
*/
|
||||
public void close();
|
||||
|
||||
/**
|
||||
* Was this result set curtailed - are there more pages to the result set?
|
||||
* @return true if there are more results
|
||||
*/
|
||||
public boolean hasMore();
|
||||
|
||||
|
||||
/**
|
||||
* Get the given row
|
||||
* @param i -the position in this result set - start + i gives the position in the overall result set
|
||||
* @return the row
|
||||
*/
|
||||
public CMISResultSetRow getRow(int i);
|
||||
|
||||
}
|
||||
|
@@ -24,6 +24,8 @@
|
||||
*/
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.service.cmr.search.ResultSetColumn;
|
||||
|
||||
|
||||
/**
|
||||
* The column meta data for a result set
|
||||
@@ -31,23 +33,17 @@ package org.alfresco.cmis;
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public interface CMISResultSetColumn
|
||||
{
|
||||
/**
|
||||
* The column name
|
||||
* @return - the column name
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
public interface CMISResultSetColumn extends ResultSetColumn
|
||||
{
|
||||
/**
|
||||
* The property definition if there is one for the column
|
||||
* @return - the property definition or null if it does not make sense for the column
|
||||
*/
|
||||
public CMISPropertyDefinition getPropertyDefinition();
|
||||
public CMISPropertyDefinition getCMISPropertyDefinition();
|
||||
|
||||
/**
|
||||
* The type of the column
|
||||
* @return - the CMIS type for the column
|
||||
*/
|
||||
public CMISDataTypeEnum getPropertyType();
|
||||
public CMISDataTypeEnum getCMISDataType();
|
||||
}
|
||||
|
@@ -24,6 +24,8 @@
|
||||
*/
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.service.cmr.search.ResultSetMetaData;
|
||||
|
||||
|
||||
/**
|
||||
* The meta data associated with a result set
|
||||
@@ -31,7 +33,7 @@ package org.alfresco.cmis;
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public interface CMISResultSetMetaData
|
||||
public interface CMISResultSetMetaData extends ResultSetMetaData
|
||||
{
|
||||
/**
|
||||
* The selector meta-data.
|
||||
|
@@ -24,10 +24,7 @@
|
||||
*/
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.search.ResultSetRow;
|
||||
|
||||
/**
|
||||
* A row in a CMISResultSet
|
||||
@@ -35,64 +32,11 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public interface CMISResultSetRow
|
||||
public interface CMISResultSetRow extends ResultSetRow
|
||||
{
|
||||
/**
|
||||
* Get all the column data.
|
||||
* @return - a map of serializable column values with the column name as the key
|
||||
*/
|
||||
public Map<String, Serializable> getValues();
|
||||
|
||||
/**
|
||||
* Get the data for a single column
|
||||
* @param columnName
|
||||
* @return the value
|
||||
*/
|
||||
public Serializable getValue(String columnName);
|
||||
|
||||
/**
|
||||
* Get the overall score.
|
||||
*
|
||||
* @return the overall score
|
||||
*/
|
||||
public float getScore();
|
||||
|
||||
/**
|
||||
* Get the scores.
|
||||
* @return a map of selector name to score.
|
||||
*/
|
||||
public Map<String, Float> getScores();
|
||||
|
||||
/**
|
||||
* Get the score related to the named selector.
|
||||
* @param selectorName
|
||||
* @return - the score.
|
||||
*/
|
||||
public float getScore(String selectorName);
|
||||
|
||||
/**
|
||||
* Gets the node refs
|
||||
* @return a map of selector name to node ref
|
||||
*/
|
||||
public Map<String, NodeRef> getNodeRefs();
|
||||
|
||||
/**
|
||||
* Gets the node ref related to the named selector
|
||||
* @param selectorName
|
||||
* @return the node ref
|
||||
*/
|
||||
public NodeRef getNodeRef(String selectorName);
|
||||
|
||||
/**
|
||||
* Get the index of this result set in the result set
|
||||
* If you want the overall position in paged results you have to add the skipCount fo the result set.
|
||||
* @return the index of the row.
|
||||
*/
|
||||
public int getIndex();
|
||||
|
||||
/**
|
||||
* Get the result set for which this row is a member.
|
||||
* @return - the result set.
|
||||
*/
|
||||
public CMISResultSet getResultSet();
|
||||
public CMISResultSet getCMISResultSet();
|
||||
}
|
||||
|
@@ -24,6 +24,8 @@
|
||||
*/
|
||||
package org.alfresco.cmis;
|
||||
|
||||
import org.alfresco.service.cmr.search.ResultSetSelector;
|
||||
|
||||
|
||||
/**
|
||||
* The meta-data for a result set selector.
|
||||
@@ -31,14 +33,8 @@ package org.alfresco.cmis;
|
||||
* @author andyh
|
||||
*
|
||||
*/
|
||||
public interface CMISResultSetSelector
|
||||
{
|
||||
/**
|
||||
* The name of the selector
|
||||
* @return - the selector name
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
public interface CMISResultSetSelector extends ResultSetSelector
|
||||
{
|
||||
/**
|
||||
* Get the type definition for the selector.
|
||||
* @return - the CMIS type definition.
|
||||
|
@@ -1049,6 +1049,10 @@ public class CMISQueryParser
|
||||
qualifer = columnReferenceNode.getChild(1).getText();
|
||||
}
|
||||
CMISPropertyDefinition propDef = cmisDictionaryService.findProperty(cmisPropertyName, null);
|
||||
if(propDef == null)
|
||||
{
|
||||
throw new CMISQueryException("Unknown column/property " + cmisPropertyName);
|
||||
}
|
||||
return factory.createPropertyArgument(argumentName, propDef.isQueryable(), propDef.isOrderable(), qualifer, propDef.getPropertyId().getName());
|
||||
}
|
||||
|
||||
|
@@ -38,6 +38,7 @@ import org.alfresco.cmis.CMISServices;
|
||||
import org.alfresco.repo.search.impl.querymodel.Query;
|
||||
import org.alfresco.repo.search.impl.querymodel.QueryEngine;
|
||||
import org.alfresco.repo.search.impl.querymodel.QueryEngineResults;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
|
||||
@@ -53,6 +54,8 @@ public class CMISQueryServiceImpl implements CMISQueryService
|
||||
private QueryEngine queryEngine;
|
||||
|
||||
private NodeService nodeService;
|
||||
|
||||
private DictionaryService alfrescoDictionaryService;
|
||||
|
||||
/**
|
||||
* @param service
|
||||
@@ -90,6 +93,17 @@ public class CMISQueryServiceImpl implements CMISQueryService
|
||||
this.nodeService = nodeService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param alfrescoDictionaryService
|
||||
* the Alfresco Dictionary Service to set
|
||||
*/
|
||||
public void setAlfrescoDictionaryService(DictionaryService alfrescoDictionaryService)
|
||||
{
|
||||
this.alfrescoDictionaryService = alfrescoDictionaryService;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -121,7 +135,7 @@ public class CMISQueryServiceImpl implements CMISQueryService
|
||||
wrapped.put(selector, current);
|
||||
}
|
||||
}
|
||||
CMISResultSet cmis = new CMISResultSetImpl(wrapped, options, nodeService, query, cmisDictionaryService);
|
||||
CMISResultSet cmis = new CMISResultSetImpl(wrapped, options, nodeService, query, cmisDictionaryService, alfrescoDictionaryService);
|
||||
return cmis;
|
||||
}
|
||||
|
||||
|
@@ -25,8 +25,10 @@
|
||||
package org.alfresco.cmis.search;
|
||||
|
||||
import org.alfresco.cmis.CMISDataTypeEnum;
|
||||
import org.alfresco.cmis.CMISDictionaryService;
|
||||
import org.alfresco.cmis.CMISPropertyDefinition;
|
||||
import org.alfresco.cmis.CMISResultSetColumn;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* @author andyh
|
||||
@@ -39,13 +41,19 @@ public class CMISResultSetColumnImpl implements CMISResultSetColumn
|
||||
|
||||
private CMISPropertyDefinition propertyDefinition;
|
||||
|
||||
private CMISDataTypeEnum propertyType;
|
||||
private CMISDataTypeEnum dataType;
|
||||
|
||||
CMISResultSetColumnImpl(String name, CMISPropertyDefinition propertyDefinition, CMISDataTypeEnum propertyType)
|
||||
private QName alfrescoPropertyQName;
|
||||
|
||||
private QName alfrescoDataTypeQName;
|
||||
|
||||
CMISResultSetColumnImpl(String name, CMISPropertyDefinition propertyDefinition, CMISDataTypeEnum dataType, QName alfrescoPropertyQName, QName alfrescoDataTypeQName)
|
||||
{
|
||||
this.name = name;
|
||||
this.propertyDefinition = propertyDefinition;
|
||||
this.propertyType = propertyType;
|
||||
this.dataType = dataType;
|
||||
this.alfrescoPropertyQName = alfrescoPropertyQName;
|
||||
this.alfrescoDataTypeQName = alfrescoDataTypeQName;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +68,7 @@ public class CMISResultSetColumnImpl implements CMISResultSetColumn
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.search.CMISResultSetColumn#getPropertyDefinition()
|
||||
*/
|
||||
public CMISPropertyDefinition getPropertyDefinition()
|
||||
public CMISPropertyDefinition getCMISPropertyDefinition()
|
||||
{
|
||||
return propertyDefinition;
|
||||
}
|
||||
@@ -68,9 +76,21 @@ public class CMISResultSetColumnImpl implements CMISResultSetColumn
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.search.CMISResultSetColumn#getPropertyType()
|
||||
*/
|
||||
public CMISDataTypeEnum getPropertyType()
|
||||
public CMISDataTypeEnum getCMISDataType()
|
||||
{
|
||||
return propertyType;
|
||||
return dataType;
|
||||
}
|
||||
|
||||
|
||||
public QName getDataType()
|
||||
{
|
||||
return alfrescoDataTypeQName;
|
||||
}
|
||||
|
||||
|
||||
public QName getPropertyType()
|
||||
{
|
||||
return alfrescoPropertyQName;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -25,9 +25,11 @@
|
||||
package org.alfresco.cmis.search;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -37,10 +39,13 @@ import org.alfresco.cmis.CMISResultSet;
|
||||
import org.alfresco.cmis.CMISResultSetMetaData;
|
||||
import org.alfresco.cmis.CMISResultSetRow;
|
||||
import org.alfresco.repo.search.impl.querymodel.Query;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.search.LimitBy;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.cmr.search.ResultSetRow;
|
||||
|
||||
/**
|
||||
* @author andyh
|
||||
@@ -58,15 +63,18 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable
|
||||
Query query;
|
||||
|
||||
CMISDictionaryService cmisDictionaryService;
|
||||
|
||||
DictionaryService alfrescoDictionaryService;
|
||||
|
||||
|
||||
public CMISResultSetImpl(Map<String, ResultSet> wrapped, CMISQueryOptions options, NodeService nodeService, Query query, CMISDictionaryService cmisDictionaryService)
|
||||
public CMISResultSetImpl(Map<String, ResultSet> wrapped, CMISQueryOptions options, NodeService nodeService, Query query, CMISDictionaryService cmisDictionaryService, DictionaryService alfrescoDictionaryService)
|
||||
{
|
||||
this.wrapped = wrapped;
|
||||
this.options = options;
|
||||
this.nodeService = nodeService;
|
||||
this.query = query;
|
||||
this.cmisDictionaryService = cmisDictionaryService;
|
||||
this.alfrescoDictionaryService = alfrescoDictionaryService;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -95,7 +103,7 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable
|
||||
*/
|
||||
public CMISResultSetMetaData getMetaData()
|
||||
{
|
||||
return new CMISResultSetMetaDataImpl(options, query, cmisDictionaryService);
|
||||
return new CMISResultSetMetaDataImpl(options, query, cmisDictionaryService, alfrescoDictionaryService);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -197,4 +205,68 @@ public class CMISResultSetImpl implements CMISResultSet, Serializable
|
||||
return scores;
|
||||
}
|
||||
|
||||
public ChildAssociationRef getChildAssocRef(int n)
|
||||
{
|
||||
NodeRef nodeRef = getNodeRef(n);
|
||||
return nodeService.getPrimaryParent(nodeRef);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<ChildAssociationRef> getChildAssocRefs()
|
||||
{
|
||||
ArrayList<ChildAssociationRef> cars = new ArrayList<ChildAssociationRef>(length());
|
||||
for (ResultSetRow row : this)
|
||||
{
|
||||
cars.add(row.getChildAssocRef());
|
||||
}
|
||||
return cars;
|
||||
}
|
||||
|
||||
public NodeRef getNodeRef(int n)
|
||||
{
|
||||
Map<String, NodeRef> refs = getNodeRefs(n);
|
||||
if(refs.size() == 1)
|
||||
{
|
||||
return refs.values().iterator().next();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException("Ambiguous selector");
|
||||
}
|
||||
}
|
||||
|
||||
public List<NodeRef> getNodeRefs()
|
||||
{
|
||||
ArrayList<NodeRef> nodeRefs = new ArrayList<NodeRef>(length());
|
||||
for (ResultSetRow row : this)
|
||||
{
|
||||
nodeRefs.add(row.getNodeRef());
|
||||
}
|
||||
return nodeRefs;
|
||||
}
|
||||
|
||||
public CMISResultSetMetaData getResultSetMetaData()
|
||||
{
|
||||
return getMetaData();
|
||||
}
|
||||
|
||||
public float getScore(int n)
|
||||
{
|
||||
Map<String, Float> scores = getScores(n);
|
||||
if(scores.size() == 1)
|
||||
{
|
||||
return scores.values().iterator().next();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException("Ambiguous selector");
|
||||
}
|
||||
}
|
||||
|
||||
public int length()
|
||||
{
|
||||
return getLength();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -40,6 +40,12 @@ import org.alfresco.repo.search.impl.querymodel.PropertyArgument;
|
||||
import org.alfresco.repo.search.impl.querymodel.Query;
|
||||
import org.alfresco.repo.search.impl.querymodel.Selector;
|
||||
import org.alfresco.repo.search.impl.querymodel.impl.functions.PropertyAccessor;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.search.LimitBy;
|
||||
import org.alfresco.service.cmr.search.PermissionEvaluationMode;
|
||||
import org.alfresco.service.cmr.search.ResultSetType;
|
||||
import org.alfresco.service.cmr.search.SearchParameters;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
@@ -53,7 +59,7 @@ public class CMISResultSetMetaDataImpl implements CMISResultSetMetaData
|
||||
|
||||
private Map<String, CMISResultSetSelector> selectorMetaData;
|
||||
|
||||
public CMISResultSetMetaDataImpl(CMISQueryOptions options, Query query, CMISDictionaryService cmisDictionaryService)
|
||||
public CMISResultSetMetaDataImpl(CMISQueryOptions options, Query query, CMISDictionaryService cmisDictionaryService, DictionaryService alfrescoDictionaryService)
|
||||
{
|
||||
this.options = options;
|
||||
|
||||
@@ -71,10 +77,22 @@ public class CMISResultSetMetaDataImpl implements CMISResultSetMetaData
|
||||
{
|
||||
CMISPropertyDefinition propertyDefinition = null;
|
||||
CMISDataTypeEnum type = null;
|
||||
QName alfrescoPropertyQName = null;
|
||||
QName alfrescoDataTypeQName = null;
|
||||
if (column.getFunction().getName().equals(PropertyAccessor.NAME))
|
||||
{
|
||||
PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(PropertyAccessor.ARG_PROPERTY);
|
||||
String propertyName = arg.getPropertyName();
|
||||
alfrescoPropertyQName = QName.createQName(propertyName);
|
||||
PropertyDefinition alfPropDef = alfrescoDictionaryService.getProperty(alfrescoPropertyQName);
|
||||
if(alfPropDef == null)
|
||||
{
|
||||
alfrescoPropertyQName = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
alfrescoDataTypeQName = alfPropDef.getDataType().getName();
|
||||
}
|
||||
propertyDefinition = cmisDictionaryService.findProperty(propertyName, null);
|
||||
type = propertyDefinition.getDataType();
|
||||
}
|
||||
@@ -82,7 +100,11 @@ public class CMISResultSetMetaDataImpl implements CMISResultSetMetaData
|
||||
{
|
||||
type = cmisDictionaryService.findDataType(column.getFunction().getReturnType());
|
||||
}
|
||||
CMISResultSetColumn cmd = new CMISResultSetColumnImpl(column.getAlias(), propertyDefinition, type);
|
||||
if(alfrescoDataTypeQName == null)
|
||||
{
|
||||
alfrescoDataTypeQName = type.getDefaultDataType();
|
||||
}
|
||||
CMISResultSetColumn cmd = new CMISResultSetColumnImpl(column.getAlias(), propertyDefinition, type, alfrescoPropertyQName, alfrescoDataTypeQName);
|
||||
columnMetaData.put(cmd.getName(), cmd);
|
||||
}
|
||||
}
|
||||
@@ -157,4 +179,24 @@ public class CMISResultSetMetaDataImpl implements CMISResultSetMetaData
|
||||
return selectorMetaData.values().toArray(new CMISResultSetSelector[0]);
|
||||
}
|
||||
|
||||
public LimitBy getLimitedBy()
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public PermissionEvaluationMode getPermissionEvaluationMode()
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public ResultSetType getResultSetType()
|
||||
{
|
||||
return ResultSetType.COLUMN_AND_NODE_REF;
|
||||
}
|
||||
|
||||
public SearchParameters getSearchParameters()
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -30,11 +30,16 @@ import java.util.Map;
|
||||
|
||||
import org.alfresco.cmis.CMISDictionaryService;
|
||||
import org.alfresco.cmis.CMISResultSet;
|
||||
import org.alfresco.cmis.CMISResultSetMetaData;
|
||||
import org.alfresco.cmis.CMISResultSetRow;
|
||||
import org.alfresco.repo.search.impl.querymodel.Column;
|
||||
import org.alfresco.repo.search.impl.querymodel.Query;
|
||||
import org.alfresco.repo.search.results.ResultSetSPIWrapper;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* @author andyh
|
||||
@@ -87,9 +92,9 @@ public class CMISResultSetRowImpl implements CMISResultSetRow
|
||||
*
|
||||
* @see org.alfresco.cmis.search.CMISResultSetRow#getResultSet()
|
||||
*/
|
||||
public CMISResultSet getResultSet()
|
||||
public ResultSet getResultSet()
|
||||
{
|
||||
return resultSet;
|
||||
return new ResultSetSPIWrapper<CMISResultSetRow, CMISResultSetMetaData>(resultSet);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -186,4 +191,37 @@ public class CMISResultSetRowImpl implements CMISResultSetRow
|
||||
return answer;
|
||||
}
|
||||
|
||||
public CMISResultSet getCMISResultSet()
|
||||
{
|
||||
return resultSet;
|
||||
}
|
||||
|
||||
public ChildAssociationRef getChildAssocRef()
|
||||
{
|
||||
NodeRef nodeRef = getNodeRef();
|
||||
return nodeService.getPrimaryParent(nodeRef);
|
||||
}
|
||||
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
if(getCMISResultSet().getMetaData().getColumns().length == 1)
|
||||
{
|
||||
return getNodeRef(getCMISResultSet().getMetaData().getColumns()[0].getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new UnsupportedOperationException("Ambiguous selector");
|
||||
}
|
||||
}
|
||||
|
||||
public QName getQName()
|
||||
{
|
||||
return getChildAssocRef().getQName();
|
||||
}
|
||||
|
||||
public Serializable getValue(QName qname)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ package org.alfresco.cmis.search;
|
||||
|
||||
import org.alfresco.cmis.CMISResultSetSelector;
|
||||
import org.alfresco.cmis.CMISTypeDefinition;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
|
||||
/**
|
||||
* @author andyh
|
||||
@@ -60,4 +61,10 @@ public class CMISResultSetSelectorImpl implements CMISResultSetSelector
|
||||
return typeDefinition;
|
||||
}
|
||||
|
||||
|
||||
public QName getType()
|
||||
{
|
||||
return typeDefinition.getTypeId().getQName();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user