Class MediaDAO
java.lang.Object
org.silverpeas.components.gallery.dao.MediaDAO
-
Method Summary
Modifier and TypeMethodDescriptionstatic longcountByCriteria(MediaCriteria criteria) Counts media according to the given criteria.static voiddeleteAllMediaPath(Media media) Deletes the album links of the specified media.static voiddeleteMedia(Media media) Deletes the specified media (and its album links).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 database used (PostgresSQL,Oracle, MMS).static MediagetByCriteria(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 database used(PostgresSQL,Oracle,MMS) .static StringSaves (insert or update) a media.static voidsaveMediaPath(Media media, String albumId) Saves the album link for the given media.
-
Method Details
-
getByCriteria
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
IllegalArgumentExceptionif several media are found. - Throws:
SQLException- on SQL errorIllegalArgumentException- on bad argument
-
findByCriteria
Finds media according to the given criteria.- Parameters:
criteria- the media criteria.- Returns:
- the media list corresponding to the given criteria.
- Throws:
SQLException
-
countByCriteria
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
Deletes the specified media (and its album links).- Parameters:
media- the media to delete.- Throws:
SQLException- on SQL error
-
saveMediaPath
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
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
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 database used (PostgresSQL,Oracle, MMS).- Parameters:
userId- the identifier of a user.period- the period on which the data are requested.- Returns:
- a
List<SocialInformation> - 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 database 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
-