Package org.ametys.cms.data
Class ContentDataHelper
- java.lang.Object
-
- org.ametys.cms.data.ContentDataHelper
-
public final class ContentDataHelper extends Object
Helper for data of type 'content'
-
-
Constructor Summary
Constructors Modifier Constructor Description privateContentDataHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetContentIdFromContentData(ModelAwareDataHolder dataHolder, String dataPath)Retrieves the content identifier of a content datastatic StringgetContentIdFromContentData(ModelAwareDataHolder dataHolder, String dataPath, String defaultValue)Retrieves the content identifier of a content datastatic String[]getContentIdsArrayFromMultipleContentData(ModelAwareDataHolder dataHolder, String dataPath)Retrieves the content identifiers in an array from a multiple content datastatic List<String>getContentIdsListFromMultipleContentData(ModelAwareDataHolder dataHolder, String dataPath)Retrieves the content identifiers in aListfrom a multiple content datastatic Stream<String>getContentIdsStreamFromMultipleContentData(ModelAwareDataHolder dataHolder, String dataPath)Retrieves aStreamof the content identifiers from a multiple content datastatic booleanisMultipleContentDataEmpty(ModelAwareDataHolder dataHolder, String dataPath)Retrieves the content identifiers in an array from a multiple content data
-
-
-
Constructor Detail
-
ContentDataHelper
private ContentDataHelper()
-
-
Method Detail
-
getContentIdFromContentData
public static String getContentIdFromContentData(ModelAwareDataHolder dataHolder, String dataPath, String defaultValue) throws BadItemTypeException
Retrieves the content identifier of a content data- Parameters:
dataHolder- data holder that contains the content datadataPath- path to the content datadefaultValue- The default value to return- Returns:
- the content identifier
- Throws:
BadItemTypeException- if the data at the given path is not a content data
-
getContentIdFromContentData
public static String getContentIdFromContentData(ModelAwareDataHolder dataHolder, String dataPath) throws BadItemTypeException
Retrieves the content identifier of a content data- Parameters:
dataHolder- data holder that contains the content datadataPath- path to the content data- Returns:
- the content identifier, empty string if it is invalid
- Throws:
BadItemTypeException- if the data at the given path is not a content data
-
isMultipleContentDataEmpty
public static boolean isMultipleContentDataEmpty(ModelAwareDataHolder dataHolder, String dataPath) throws BadItemTypeException
Retrieves the content identifiers in an array from a multiple content data- Parameters:
dataHolder- data holder that contains the multiple content datadataPath- path to the multiple content data- Returns:
- an array containing the content identifiers
- Throws:
BadItemTypeException- if the data at the given path is not a content data
-
getContentIdsListFromMultipleContentData
public static List<String> getContentIdsListFromMultipleContentData(ModelAwareDataHolder dataHolder, String dataPath) throws BadItemTypeException
Retrieves the content identifiers in aListfrom a multiple content data- Parameters:
dataHolder- data holder that contains the multiple content datadataPath- path to the multiple content data- Returns:
- a
Listcontaining the content identifiers - Throws:
BadItemTypeException- if the data at the given path is not a content data
-
getContentIdsArrayFromMultipleContentData
public static String[] getContentIdsArrayFromMultipleContentData(ModelAwareDataHolder dataHolder, String dataPath) throws BadItemTypeException
Retrieves the content identifiers in an array from a multiple content data- Parameters:
dataHolder- data holder that contains the multiple content datadataPath- path to the multiple content data- Returns:
- an array containing the content identifiers
- Throws:
BadItemTypeException- if the data at the given path is not a content data
-
getContentIdsStreamFromMultipleContentData
public static Stream<String> getContentIdsStreamFromMultipleContentData(ModelAwareDataHolder dataHolder, String dataPath) throws BadItemTypeException
Retrieves aStreamof the content identifiers from a multiple content data- Parameters:
dataHolder- data holder that contains the multiple content datadataPath- path to the multiple content data- Returns:
- a
Streamof the content identifiers - Throws:
BadItemTypeException- if the data at the given path is not a content data
-
-