use of org.alfresco.repo.node.getchildren.FilterPropBoolean in project records-management by Alfresco.
the class FilePlanComponentsApiUtils method getListChildrenFilterProps.
/**
* Returns a List of filter properties specified by request parameters.
* @param parameters The {@link Parameters} object to get the parameters passed into the request
* including:
* - filter, sort & paging params (where, orderBy, skipCount, maxItems)
* @return The list of {@link FilterProp}. Can be null.
*/
public List<FilterProp> getListChildrenFilterProps(Parameters parameters, Set<String> listFolderChildrenEqualsQueryProperties) {
List<FilterProp> filterProps = null;
Query q = parameters.getQuery();
if (q != null) {
MapBasedQueryWalker propertyWalker = new MapBasedQueryWalker(listFolderChildrenEqualsQueryProperties, null);
QueryHelper.walk(q, propertyWalker);
Boolean isPrimary = propertyWalker.getProperty(RMNode.PARAM_ISPRIMARY, WhereClauseParser.EQUALS, Boolean.class);
if (isPrimary != null) {
filterProps = new ArrayList<>(1);
filterProps.add(new FilterPropBoolean(GetChildrenCannedQuery.FILTER_QNAME_NODE_IS_PRIMARY, isPrimary));
}
Boolean isClosed = propertyWalker.getProperty(RMNode.PARAM_IS_CLOSED, WhereClauseParser.EQUALS, Boolean.class);
if (isClosed != null) {
filterProps = new ArrayList<>(1);
filterProps.add(new FilterPropBoolean(RecordsManagementModel.PROP_IS_CLOSED, isClosed));
}
// TODO see how we can filter for categories that have retention schedule
// Boolean hasRetentionSchedule = propertyWalker.getProperty(RMNode.PARAM_HAS_RETENTION_SCHEDULE, WhereClauseParser.EQUALS, Boolean.class);
// if (hasRetentionSchedule != null)
// {
// filterProps = new ArrayList<>(1);
// }
}
return filterProps;
}
use of org.alfresco.repo.node.getchildren.FilterPropBoolean in project alfresco-remote-api by Alfresco.
the class NodesImpl method getListChildrenFilterProps.
/**
* <p>Returns a List of filter properties specified by request parameters.</p>
*
* @param parameters The {@link Parameters} object to get the parameters passed into the request
* including:
* - filter, sort & paging params (where, orderBy, skipCount, maxItems)
* - incFiles, incFolders (both true by default)
* @return The list of {@link FilterProp}. Can be null.
*/
protected List<FilterProp> getListChildrenFilterProps(final Parameters parameters) {
List<FilterProp> filterProps = null;
Query q = parameters.getQuery();
if (q != null) {
MapBasedQueryWalker propertyWalker = createListChildrenQueryWalker();
QueryHelper.walk(q, propertyWalker);
Boolean isPrimary = propertyWalker.getProperty(PARAM_ISPRIMARY, WhereClauseParser.EQUALS, Boolean.class);
if (isPrimary != null) {
filterProps = new ArrayList<>(1);
filterProps.add(new FilterPropBoolean(GetChildrenCannedQuery.FILTER_QNAME_NODE_IS_PRIMARY, isPrimary));
}
}
return filterProps;
}
use of org.alfresco.repo.node.getchildren.FilterPropBoolean in project alfresco-remote-api by Alfresco.
the class SitesImpl method includeFilter.
// note: currently inclusive and OR-based
private boolean includeFilter(Map<QName, Serializable> propVals, List<FilterProp> filterProps) {
for (FilterProp filterProp : filterProps) {
Serializable propVal = propVals.get(filterProp.getPropName());
if (propVal != null) {
if ((filterProp instanceof FilterPropString) && (propVal instanceof String)) {
String val = (String) propVal;
String filter = (String) filterProp.getPropVal();
switch((FilterPropString.FilterTypeString) filterProp.getFilterType()) {
case STARTSWITH:
if (val.startsWith(filter)) {
return true;
}
break;
case STARTSWITH_IGNORECASE:
if (val.toLowerCase().startsWith(filter.toLowerCase())) {
return true;
}
break;
case EQUALS:
if (val.equals(filter)) {
return true;
}
break;
case EQUALS_IGNORECASE:
if (val.equalsIgnoreCase(filter)) {
return true;
}
break;
case ENDSWITH:
if (val.endsWith(filter)) {
return true;
}
break;
case ENDSWITH_IGNORECASE:
if (val.toLowerCase().endsWith(filter.toLowerCase())) {
return true;
}
break;
case MATCHES:
if (val.matches(filter)) {
return true;
}
break;
case MATCHES_IGNORECASE:
if (val.toLowerCase().matches(filter.toLowerCase())) {
return true;
}
break;
default:
}
}
}
if ((filterProp instanceof FilterPropBoolean) && (propVal instanceof Boolean)) {
Boolean val = (Boolean) propVal;
Boolean filter = (Boolean) filterProp.getPropVal();
return (val == filter);
}
}
return false;
}
Aggregations