ResourceFilter

public final class ResourceFilter

This class is responsible for filtering content instances based on the provided grid settings.

Methods

equalsContent

public static boolean equalsContent(ResourceDto dto, String contentName, String contentType)

Checks whether the org.motechproject.cmslite.web.ResourceDto matches the given content name and content type.

Parameters:
  • dto – the dto to check
  • contentName – the expected name
  • contentType – the expected type, string or stream
Returns:

true if the dto matches the parameters, false otherwise

filter

public static List<ResourceDto> filter(GridSettings settings, List<Content> contents)

Filters the given list of contents based on the grid settings.

Parameters:
  • settings – the grid settings to use
  • contents – a list of all contents
Returns:

a new list with the matching content instances

getContentType

public static String getContentType(Content content)

Returns the type, as in string or stream, for this content.

Parameters:
  • content – the content to check
Returns:

string for string content, stream for stream content and a blank string for other cases (null content)