Examples of IListingSearch


Examples of com.tll.common.search.IListingSearch

            if(log.isDebugEnabled()) log.debug("Generating listing handler for listing: '" + listingId + "'...");

            final RemoteListingDefinition<? extends IListingSearch> listingDef = request.getListingDef();
            if(listingDef != null) {
              final IListingSearch search = listingDef.getSearchCriteria();
              if(search == null) {
                throw new ListingException(listingId, "No search criteria specified.");
              }

              // translate client side criteria to server side criteria
              final Criteria<? extends IEntity> criteria;
              try {
                // delegate
                criteria = context.getSearchTranslator().translateListingSearchCriteria(context, search);
              }
              catch(final IllegalArgumentException iae) {
                throw new ListingException(listingId, "Unable to translate listing search criteria: "
                    + request.descriptor(), iae);
              }

              // resolve the listing handler data provider
              final IListingDataProvider dataProvider = context.getListingDataProviderResolver().resolve(request);

              // resolve the list handler type
              final ListHandlerType lht = listingDef.getListHandlerType();
              if(lht == null) {
                throw new ListingException(listingId, "No list handler type specified.");
              }
              // resolve the sorting to use
              sorting = (sorting == null ? listingDef.getInitialSorting() : sorting);
              if(sorting == null) {
                throw new ListingException(listingId, "No sorting directive specified.");
              }
              IListHandler<SearchResult<?>> listHandler = null;
              try {
                listHandler = ListHandlerFactory.create(criteria, sorting, lht, dataProvider);
              }
              catch(final InvalidCriteriaException e) {
                throw new ListingException(listingId, "Invalid criteria: " + e.getMessage(), e);
              }
              catch(final EmptyListException e) {
                // we proceed to allow client to still show the listing
                status.addMsg(e.getMessage(), MsgLevel.WARN, MsgAttr.STATUS.flag);
              }
              catch(final ListHandlerException e) {
                // shouldn't happen
                throw new IllegalStateException("Unable to instantiate the list handler: " + e.getMessage(), e);
              }

              // transform to marshaling list handler
              MarshalOptions mo;
              try {
                mo = context.getMarshalOptionsResolver().resolve(search.getEntityType());
              }
              catch(final IllegalArgumentException e) {
                mo = MarshalOptions.NO_REFERENCES;
              }
              final MarshalingListHandler marshalingListHandler =
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.