Files
alfresco-community-repo/source/java/org/alfresco/repo/domain/solr/NodeParametersEntity.java
Raluca Munteanu dc6b2852d0 Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
125605 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2)
      125498 slanglois: MNT-16155 Update source headers - remove svn:eol-style property on Java and JSP source files


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125783 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2016-04-26 13:03:25 +00:00

140 lines
4.1 KiB
Java

package org.alfresco.repo.domain.solr;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.domain.qname.QNameDAO;
import org.alfresco.repo.solr.NodeParameters;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.Pair;
/**
* Stores node query parameters for use in SOLR DAO queries
*
* @since 4.0
*/
public class NodeParametersEntity extends NodeParameters
{
private List<Long> includeTypeIds;
private List<Long> excludeTypeIds;
private List<Long> includeAspectIds;
private List<Long> excludeAspectIds;
private Long originalIdPropQNameId;
/**
* Public constructor, but not generally useful
*/
public NodeParametersEntity(QNameDAO qnameDAO)
{
Pair<Long, QName> qnamePair = qnameDAO.getQName(ContentModel.PROP_ORIGINAL_ID);
this.setOriginalIdPropQNameId(qnamePair == null ? -1 : qnamePair.getFirst());
}
/**
* Construct from higher-level parameters
*/
public NodeParametersEntity(NodeParameters params, QNameDAO qnameDAO)
{
this(qnameDAO);
this.setFromNodeId(params.getFromNodeId());
this.setToNodeId(params.getToNodeId());
this.setFromTxnId(params.getFromTxnId());
this.setToTxnId(params.getToTxnId());
this.setTransactionIds(params.getTransactionIds());
this.setStoreIdentifier(params.getStoreIdentifier());
this.setStoreProtocol(params.getStoreProtocol());
// Translate the QNames, if provided
if (params.getIncludeNodeTypes() != null)
{
Set<Long> qnamesIds = qnameDAO.convertQNamesToIds(params.getIncludeNodeTypes(), false);
this.setIncludeTypeIds(new ArrayList<Long>(qnamesIds));
}
if (params.getExcludeNodeTypes() != null)
{
Set<Long> qnamesIds = qnameDAO.convertQNamesToIds(params.getExcludeNodeTypes(), false);
this.setExcludeTypeIds(new ArrayList<Long>(qnamesIds));
}
if (params.getExcludeAspects() != null)
{
Set<Long> qnamesIds = qnameDAO.convertQNamesToIds(params.getExcludeAspects(), false);
this.setExcludeAspectIds(new ArrayList<Long>(qnamesIds));
}
if (params.getIncludeAspects() != null)
{
Set<Long> qnamesIds = qnameDAO.convertQNamesToIds(params.getIncludeAspects(), false);
this.setIncludeAspectIds(new ArrayList<Long>(qnamesIds));
}
}
public void setOriginalIdPropQNameId(Long originalIdPropQNameId)
{
this.originalIdPropQNameId = originalIdPropQNameId;
}
public Long getOriginalIdPropQNameId()
{
return originalIdPropQNameId;
}
public boolean getStoreFilter()
{
return (getStoreProtocol() != null || getStoreIdentifier() != null);
}
public List<Long> getIncludeAspectIds()
{
return includeAspectIds;
}
public void setIncludeAspectIds(List<Long> includeAspectIds)
{
this.includeAspectIds = includeAspectIds;
}
public List<Long> getExcludeAspectIds()
{
return excludeAspectIds;
}
public void setExcludeAspectIds(List<Long> excludeAspectIds)
{
this.excludeAspectIds = excludeAspectIds;
}
public List<Long> getIncludeTypeIds()
{
return includeTypeIds;
}
public void setIncludeTypeIds(List<Long> includeTypeIds)
{
this.includeTypeIds = includeTypeIds;
}
public List<Long> getExcludeTypeIds()
{
return excludeTypeIds;
}
public void setExcludeTypeIds(List<Long> excludeTypeIds)
{
this.excludeTypeIds = excludeTypeIds;
}
public boolean isIncludeNodesTable()
{
return (getFromNodeId() != null || getToNodeId() != null || getIncludeTypeIds() != null || getExcludeTypeIds() != null || getIncludeAspectIds() != null || getExcludeAspectIds() != null);
}
}