com.silverpeas.gallery.web
Class AbstractGalleryResource

java.lang.Object
  extended by com.silverpeas.web.RESTWebService
      extended by com.silverpeas.gallery.web.AbstractGalleryResource
Direct Known Subclasses:
GalleryResource

public abstract class AbstractGalleryResource
extends com.silverpeas.web.RESTWebService

Author:
Yohann Chastagnier

Nested Class Summary
 
Nested classes/interfaces inherited from class com.silverpeas.web.RESTWebService
com.silverpeas.web.RESTWebService.WebProcess<RETURN_VALUE>, com.silverpeas.web.RESTWebService.WebTreatment<RETURN_VALUE>
 
Field Summary
 
Fields inherited from class com.silverpeas.web.RESTWebService
RESPONSE_HEADER_ARRAYSIZE, REST_WEB_SERVICES_URI_BASE
 
Constructor Summary
AbstractGalleryResource()
           
 
Method Summary
protected  AlbumEntity asWebEntity(AlbumDetail album)
          Converts the album into its corresponding web entity.
protected  void checkNotFoundStatus(Object object)
          Centralization
 String getComponentId()
           
protected  javax.ws.rs.core.Response getMediaContent(MediaType expectedMediaType, String mediaId, MediaResolution requestedMediaResolution)
          Centralization of getting of media content.
protected  com.sun.jersey.api.view.Viewable getMediaEmbed(MediaType expectedMediaType, String mediaId, MediaResolution requestedMediaResolution)
          Centralization of getting of media embed.
protected  AbstractMediaEntity getMediaEntity(MediaType expectedMediaType, String albumId, String mediaId)
          Centralization of getting of media data.
protected  GalleryBm getMediaService()
          Gets Gallery EJB.
protected  javax.ws.rs.core.Response getMediaThumbnail(MediaType expectedMediaType, String mediaId, String thumbnailId, String sizeDirective)
          Centralization of getting video media thumbnail.
protected  boolean hasUserMediaAccess(Media media)
          Centralization
protected  boolean isUserPrivileged()
          Indicates if the current user is a privileged one.
protected  boolean isViewAllPhotoAuthorized()
          Checking if the authenticated user is authorized to view all photos.
protected  void verifyMediaIsInAlbum(Media media, AlbumDetail album)
          Verifying that the given photo is included in the given album.
protected  void verifyUserMediaAccess(Media media)
          Verifying that the authenticated user is authorized to view the given photo.
 
Methods inherited from class com.silverpeas.web.RESTWebService
getBundle, getBundleLocation, getGreaterUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getUriInfo, getUserDetail, getUserPreferences, getUserRoles, process, validateUserAuthentication, validateUserAuthorization
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGalleryResource

public AbstractGalleryResource()
Method Detail

getComponentId

public String getComponentId()
Specified by:
getComponentId in class com.silverpeas.web.RESTWebService

asWebEntity

protected AlbumEntity asWebEntity(AlbumDetail album)
Converts the album into its corresponding web entity.

Parameters:
album - the album.
Returns:
the corresponding photo entity.

getMediaEntity

protected AbstractMediaEntity getMediaEntity(MediaType expectedMediaType,
                                             String albumId,
                                             String mediaId)
Centralization of getting of media data.

Parameters:
expectedMediaType -
albumId - the identifier of the album in which the media must exist
mediaId - the identifier of the expected media
Returns:

getMediaContent

protected javax.ws.rs.core.Response getMediaContent(MediaType expectedMediaType,
                                                    String mediaId,
                                                    MediaResolution requestedMediaResolution)
Centralization of getting of media content.

Parameters:
expectedMediaType -
mediaId -
requestedMediaResolution -
Returns:

getMediaEmbed

protected com.sun.jersey.api.view.Viewable getMediaEmbed(MediaType expectedMediaType,
                                                         String mediaId,
                                                         MediaResolution requestedMediaResolution)
Centralization of getting of media embed.

Parameters:
expectedMediaType -
mediaId -
requestedMediaResolution -
Returns:

getMediaThumbnail

protected javax.ws.rs.core.Response getMediaThumbnail(MediaType expectedMediaType,
                                                      String mediaId,
                                                      String thumbnailId,
                                                      String sizeDirective)
Centralization of getting video media thumbnail.

Parameters:
expectedMediaType -
mediaId -
thumbnailId -
sizeDirective - the size directive with pattern (optional)
Returns:

isUserPrivileged

protected boolean isUserPrivileged()
Indicates if the current user is a privileged one.

Returns:

checkNotFoundStatus

protected void checkNotFoundStatus(Object object)
Centralization

Parameters:
object - any object

hasUserMediaAccess

protected boolean hasUserMediaAccess(Media media)
Centralization

Parameters:
media -
Returns:

verifyUserMediaAccess

protected void verifyUserMediaAccess(Media media)
Verifying that the authenticated user is authorized to view the given photo.

Parameters:
media -

isViewAllPhotoAuthorized

protected boolean isViewAllPhotoAuthorized()
Checking if the authenticated user is authorized to view all photos.

Returns:

verifyMediaIsInAlbum

protected void verifyMediaIsInAlbum(Media media,
                                    AlbumDetail album)
Verifying that the given photo is included in the given album.


getMediaService

protected GalleryBm getMediaService()
Gets Gallery EJB.

Returns:


Copyright © 2016 Silverpeas. All Rights Reserved.