CMSLiteService

public interface CMSLiteService

CMS Lite is a lightweight content management system based on MDS storage. It supports storing and retrieving of stream / text content along with custom metadata for each language.

Methods

addContent

void addContent(Content content)

Add content to the CMS data-store.

Parameters:
  • content – the content to add

See also: org.motechproject.cmslite.model.StreamContent, org.motechproject.cmslite.model.StringContent

getAllContents

List<Content> getAllContents()

Retrieves a list of all String and Stream contents. Returned list is defined as a list of generic Content instances, containing basic information such as language, name and metadata. To make better use of instances retrieved this way an instanceof check should be performed, followed by a cast to either StringContent or StreamContent

Returns:list of all contents

See also: org.motechproject.cmslite.model.StringContent, org.motechproject.cmslite.model.StreamContent

getStreamContent

StreamContent getStreamContent(String language, String name)

Get stream content with the given name and language.

Parameters:
  • language – the language of the content
  • name – the name of the content
Throws:
Returns:

StreamContent that matches the parameters

getStreamContent

StreamContent getStreamContent(long streamContentId)

Retrieved StreamContent by its ID.

Parameters:
  • streamContentId – ID of a StreamContent to retrieved
Returns:

StreamContent of a given ID

See also: org.motechproject.cmslite.model.StreamContent

getStringContent

StringContent getStringContent(String language, String name)

Get text content for given name and language.

Parameters:
  • language – the language of the content
  • name – the name of the content
Throws:
Returns:

StringContent that matches the parameters

getStringContent

StringContent getStringContent(long stringContentId)

Retrieved StringContent by its ID.

Parameters:
  • stringContentId – ID of a StringContent to retrieved
Returns:

StringContent of a given ID

See also: org.motechproject.cmslite.model.StringContent

isStreamContentAvailable

boolean isStreamContentAvailable(String language, String name)

Check if a stream content with the given name and language exists.

Parameters:
  • language – the language of the content
  • name – the name of the content
Returns:

true if a matching stream content exists, false otherwise

isStringContentAvailable

boolean isStringContentAvailable(String language, String name)

Check if a text content with the given name and language exists.

Parameters:
  • language – the language of the content
  • name – the name of the content
Returns:

true if a matching text content exists, false otherwise

removeStreamContent

void removeStreamContent(String language, String name)

Remove stream content for given name and language.

Parameters:
  • language – the language of the content to remove
  • name – the name of the content to remove
Throws:

removeStringContent

void removeStringContent(String language, String name)

Remove text content for given name and language.

Parameters:
  • language – the language of the content to remove
  • name – the name of the content to remove
Throws:

retrieveStreamContentData

Byte[] retrieveStreamContentData(StreamContent instance)

Helper method, retrieving data of a StreamContent. The data is returned as a byte array.

Parameters:
  • instance – Instance of a StreamContent
Returns:

byte array, containing data of a StreamContent