class BusinessObjectDataSearchHelper {

    void validateBusinessObjectDataSearchKey(BusinessObjectDataSearchKey businessObjectDataSearchKey)
    {
        Assert.notNull(businessObjectDataSearchKey, "A business object data search key must be specified.");

        businessObjectDataSearchKey.setNamespace(alternateKeyHelper.validateStringParameter("namespace", businessObjectDataSearchKey.getNamespace()));
        businessObjectDataSearchKey.setBusinessObjectDefinitionName(
            alternateKeyHelper.validateStringParameter("business object definition name", businessObjectDataSearchKey.getBusinessObjectDefinitionName()));

        if (businessObjectDataSearchKey.getBusinessObjectFormatUsage() != null)
        {
            businessObjectDataSearchKey.setBusinessObjectFormatUsage(businessObjectDataSearchKey.getBusinessObjectFormatUsage().trim());
        }

        if (businessObjectDataSearchKey.getBusinessObjectFormatFileType() != null)
        {
            businessObjectDataSearchKey.setBusinessObjectFormatFileType(businessObjectDataSearchKey.getBusinessObjectFormatFileType().trim());
        }

        // Validate partition value filters, if specified.
        if (CollectionUtils.isNotEmpty(businessObjectDataSearchKey.getPartitionValueFilters()))
        {
            businessObjectDataHelper.validatePartitionValueFilters(businessObjectDataSearchKey.getPartitionValueFilters(), null, false);

            // TODO: For now, we only support partition values or partition range in the filter.
            for (PartitionValueFilter partitionValueFilter : businessObjectDataSearchKey.getPartitionValueFilters())
            {
                List<String> partitionValues = partitionValueFilter.getPartitionValues();
                PartitionValueRange partitionValueRange = partitionValueFilter.getPartitionValueRange();

                // The partition values array should not be empty and partition vale range start and end value should not be empty
                // as it is done above at businessObjectDataHelper.validatePartitionValueFilters().
                if (CollectionUtils.isEmpty(partitionValues) && partitionValueRange == null)
                {
                    throw new IllegalArgumentException("Only partition values or partition range are supported in partition value filter.");
                }
            }
        }

        // Validate registration date range filter, if specified.
        if (businessObjectDataSearchKey.getRegistrationDateRangeFilter() != null)
        {
            businessObjectDataHelper.validateRegistrationDateRangeFilter(businessObjectDataSearchKey.getRegistrationDateRangeFilter());
        }

        // Validate attribute value filters, if specified.
        if (CollectionUtils.isNotEmpty(businessObjectDataSearchKey.getAttributeValueFilters()))
        {
            for (AttributeValueFilter attributeValueFilter : businessObjectDataSearchKey.getAttributeValueFilters())
            {
                if (attributeValueFilter.getAttributeName() != null)
                {
                    attributeValueFilter.setAttributeName(attributeValueFilter.getAttributeName().trim());
                }
                if (StringUtils.isBlank(attributeValueFilter.getAttributeName()) && StringUtils.isEmpty(attributeValueFilter.getAttributeValue()))
                {
                    throw new IllegalArgumentException("Either attribute name or attribute value filter must be specified.");
                }
            }
        }
    }

}