Class MediaDAO
- java.lang.Object
-
- org.silverpeas.components.gallery.dao.MediaDAO
-
public class MediaDAO extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
countByCriteria(MediaCriteria criteria)
Counts media according to the given criteria.static void
deleteAllMediaPath(Media media)
Deletes the album links of the specified media.static void
deleteMedia(Media media)
Deletes the specified media (and its album links).static List<Media>
findByCriteria(MediaCriteria criteria)
Finds media according to the given criteria.static Collection<String>
getAlbumIdsOf(Media media)
Gets the identifier list of albums which the given media is associated to.static List<org.silverpeas.core.socialnetwork.model.SocialInformation>
getAllMediaIdByUserId(String userId, org.silverpeas.core.date.period.Period period)
get my SocialInformationGallery according to the type of data base used (PostgresSQL,Oracle, MMS).static Media
getByCriteria(MediaCriteria criteria)
Gets the media behind the specified criteria.static List<org.silverpeas.core.socialnetwork.model.SocialInformation>
getSocialInformationListOfMyContacts(List<String> userIds, List<String> availableComponents, org.silverpeas.core.date.period.Period period)
get list of socialInformationGallery of my contacts according to the type of data base used(PostgresSQL,Oracle,MMS) .static String
saveMedia(org.silverpeas.core.persistence.datasource.OperationContext context, Media media)
Saves (insert or update) a media.static void
saveMediaPath(Media media, String albumId)
Saves the album link for the given media.
-
-
-
Method Detail
-
getByCriteria
public static Media getByCriteria(MediaCriteria criteria) throws SQLException
Gets the media behind the specified criteria.- Parameters:
criteria
- the media criteria.- Returns:
- the media behind the criteria, null if no media found and throws
IllegalArgumentException
if several media are found. - Throws:
SQLException
- on SQL errorIllegalArgumentException
- on bad argument
-
findByCriteria
public static List<Media> findByCriteria(MediaCriteria criteria) throws SQLException
Finds media according to the given criteria.- Parameters:
criteria
- the media criteria.- Returns:
- the media list corresponding to the given criteria.
- Throws:
SQLException
-
countByCriteria
public static long countByCriteria(MediaCriteria criteria) throws SQLException
Counts media according to the given criteria.- Parameters:
criteria
- the media criteria.- Returns:
- the number of media count corresponding to the given criteria.
- Throws:
SQLException
-
saveMedia
public static String saveMedia(org.silverpeas.core.persistence.datasource.OperationContext context, Media media) throws SQLException
Saves (insert or update) a media.- Parameters:
context
- the context of save operation.media
- the media to save.- Returns:
- the id of the saved media.
- Throws:
SQLException
- on SQL error
-
deleteMedia
public static void deleteMedia(Media media) throws SQLException
Deletes the specified media (and its album links).- Parameters:
media
- the media to delete.- Throws:
SQLException
- on SQL error
-
saveMediaPath
public static void saveMediaPath(Media media, String albumId) throws SQLException
Saves the album link for the given media.- Parameters:
media
- the media that must be associated to the given album.albumId
- the identifier of the album.- Throws:
SQLException
- on SQL error
-
deleteAllMediaPath
public static void deleteAllMediaPath(Media media) throws SQLException
Deletes the album links of the specified media.- Parameters:
media
- the media for which all album links must be deleted.- Throws:
SQLException
- on SQL error
-
getAlbumIdsOf
public static Collection<String> getAlbumIdsOf(Media media) throws SQLException
Gets the identifier list of albums which the given media is associated to.- Parameters:
media
- the media aimed.- Returns:
- the identifier list of albums in which the given media is attached to.
- Throws:
SQLException
- on SQL error
-
getAllMediaIdByUserId
public static List<org.silverpeas.core.socialnetwork.model.SocialInformation> getAllMediaIdByUserId(String userId, org.silverpeas.core.date.period.Period period) throws SQLException
get my SocialInformationGallery according to the type of data base used (PostgresSQL,Oracle, MMS).- Parameters:
userId
- the identifier of a user.period
- the period on which the data are requested.- Returns:
- List
- Throws:
SQLException
- on SQL error
-
getSocialInformationListOfMyContacts
public static List<org.silverpeas.core.socialnetwork.model.SocialInformation> getSocialInformationListOfMyContacts(List<String> userIds, List<String> availableComponents, org.silverpeas.core.date.period.Period period) throws SQLException
get list of socialInformationGallery of my contacts according to the type of data base used(PostgresSQL,Oracle,MMS) .- Parameters:
userIds
- the identifiers of users.availableComponents
- the list of available components.period
- the period on which the data are requested.- Returns:
- the information for social data.
- Throws:
SQLException
- on SQL error
-
-