001
014
015 package com.liferay.portlet.amazonrankings.util;
016
017 import com.liferay.portal.kernel.util.PropsKeys;
018 import com.liferay.portal.kernel.util.StringPool;
019 import com.liferay.portal.kernel.util.Validator;
020 import com.liferay.portal.kernel.webcache.WebCacheItem;
021 import com.liferay.portal.kernel.webcache.WebCachePoolUtil;
022 import com.liferay.portal.util.PropsUtil;
023 import com.liferay.portlet.amazonrankings.model.AmazonRankings;
024
025
028 public class AmazonRankingsUtil {
029
030 public static String getAmazonAccessKeyId() {
031 return PropsUtil.get(PropsKeys.AMAZON_ACCESS_KEY_ID);
032 }
033
034 public static String getAmazonAssociateTag() {
035 return PropsUtil.get(PropsKeys.AMAZON_ASSOCIATE_TAG);
036 }
037
038 public static AmazonRankings getAmazonRankings(String isbn) {
039 if (!Validator.isDigit(isbn)) {
040 return null;
041 }
042
043 WebCacheItem wci = new AmazonRankingsWebCacheItem(isbn);
044
045 return (AmazonRankings)WebCachePoolUtil.get(
046 AmazonRankingsUtil.class.getName() + StringPool.PERIOD + isbn, wci);
047 }
048
049 }