Package org.eurekastreams.server.action.request.gallery

Examples of org.eurekastreams.server.action.request.gallery.GetGalleryItemsRequest


     * Ensure that the sort criteria matches the two types.
     */
    @Override
    public void validate(final ServiceActionContext inActionContext) throws ValidationException
    {
        GetGalleryItemsRequest currentRequest = (GetGalleryItemsRequest) inActionContext.getParams();

        if (!currentRequest.getSortCriteria().equals(RECENT_SORT_CRITERIA)
          && !currentRequest.getSortCriteria().equals(POPULARITY_SORT_CRITERIA))
        {
            throw new ValidationException("Invalid sort criteria for this action.");
        }
    }
View Full Code Here


    @Override
    public PagedSet<T> execute(final ServiceActionContext inActionContext) throws ExecutionException
    {
        PagedSet<T> galleryItems = null;

        GetGalleryItemsRequest currentRequest = (GetGalleryItemsRequest) inActionContext.getParams();

        if (currentRequest.getSortCriteria().equals(POPULARITY_SORT_CRITERIA))
        {
            if (!currentRequest.getCategory().isEmpty())
            {
                galleryItems = mapper.findForCategorySortedByPopularity(currentRequest.getCategory(), currentRequest
                        .getStartIndex(), currentRequest.getEndIndex());
            }
            else
            {
                galleryItems = mapper.findSortedByPopularity(currentRequest.getStartIndex(), currentRequest
                        .getEndIndex());

            }
        }
        else if (currentRequest.getSortCriteria().equals(RECENT_SORT_CRITERIA))
        {
            if (!currentRequest.getCategory().isEmpty())
            {
                galleryItems = mapper.findForCategorySortedByRecent(currentRequest.getCategory(), currentRequest
                        .getStartIndex(), currentRequest.getEndIndex());
            }
            else
            {
                galleryItems = mapper.findSortedByRecent(currentRequest.getStartIndex(), currentRequest.getEndIndex());

            }
        }

        // the calls and concatenations could slow things down
View Full Code Here

TOP

Related Classes of org.eurekastreams.server.action.request.gallery.GetGalleryItemsRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.