@Override protected Object doProcessRequest(ActionParam inParam) throws InvalidParameterException, NoSuchProductException { final int skip = inParam.getInt(GetPressClip.SKIP_PARAM, 0); final int count = inParam.getInt(GetPressClip.COUNT_PARAM, 10); final String theLangCode = inParam.getString(GetPressClip.LANGUAGE_PARAM, true); final String theProductName = inParam.getString(GetPressClip.PRODUCT_PARAM, true); final ProductData theProductData = ProductData.findByName(theProductName); final SiteLangData theLang = SiteLangData.getByISOCode(theLangCode); final Product theProduct = theProductData.getReference(); if (theProduct == null) { throw new NoSuchProductException(APIErrorMessage.NO_SUCH_PRODUCT, theProductName); } final List<PressInformationMap> pressFromProductAndLanguage = new LinkedList<PressInformationMap>(); for (final PressData aPressData : PressData.findByLangAndProduct(theLang.getReference(), theProduct, skip, count)) { pressFromProductAndLanguage.add(new PressInformationMap(inParam.getCaller(), aPressData)); } return pressFromProductAndLanguage; }
@Override protected Object doProcessRequest(ActionParam inParam) throws InvalidParameterException { final String startWith = inParam.getMainParamAsString(); final String language = inParam.getString(GetApplications.LANGUAGE_PARAM, true); final List<ApplicationInformationMap> appInfoMaps = new ArrayList<ApplicationInformationMap>(); final SiteLangData theLangData = SiteLangData.getByISOCode(language); if (!startWith.matches("net.violet.(rss|podcast|webradio|js|external).")) { throw new InvalidParameterException(APIErrorMessage.BAD_FORMAT, startWith); } final List<ApplicationData> appList = ApplicationData.findByLangAndApplicationNameStartingWith(theLangData, startWith); for (final ApplicationData appData : appList) { appInfoMaps.add(new ApplicationInformationMap(inParam.getCaller(), appData)); } return appInfoMaps; }