final Boolean enabled,
final Boolean active,
final Boolean includeNotExposed,
final List<String> properties)
{
CapabilityReferenceFilter filter = CapabilityReferenceFilterBuilder.capabilities();
if (type != null) {
filter = filter.withType(capabilityType(type));
}
if (enabled != null) {
filter = filter.enabled(enabled);
}
if (active != null) {
filter = filter.active(active);
}
if (includeNotExposed != null && includeNotExposed) {
filter = filter.includeNotExposed();
}
if (properties != null) {
for (String property : properties) {
String propertyName = property;
String propertyValue = "*";
if (property.contains(":")) {
propertyName = property.substring(0, propertyName.indexOf(':'));
if (propertyName.length() < property.length() - 1) {
propertyValue = property.substring(propertyName.length() + 1);
}
}
if ("*".equals(propertyValue)) {
filter = filter.withBoundedProperty(propertyName);
}
else {
filter = filter.withProperty(propertyName, propertyValue);
}
}
}
return filter;
}