protected void prepareFlickr(FeedService feedService, FlickrCredentials credentials) { List<Feed> feeds = feedService.getFeedsToUpdate(Type.FLICKR); REST rest = null; try { // This flickrj library is so poorly designed I want to puke all over myself. rest = new REST(); } catch (ParserConfigurationException e) { logger.warn(ErrorUtil.getErrorDetail("POS Flickr Library sucks ass: ", e)); } Flickr flickr = new Flickr(credentials.getKey(), credentials.getSecret(), rest); Flickr.debugStream = true; Flickr.debugRequest = true; // again, I am amazed at how much better the API is for twitter than flickr // a thread local for subsequent calls?? Is this 1999? RequestContext requestContext = RequestContext.getRequestContext(); for (int counter = 0; counter < feeds.size(); counter++) { if (counter >= maxPerRun) { logger.warn( "Hit processing limit of: " + maxPerRun + ", There are " + (feeds.size() - maxPerRun) + " left to process."); break; } Feed f = feeds.get(counter); feedService.loadFlickrFeed(f, flickr); } }
public GatewayResponse addProduct(AccountBean bean) throws Exception { Account account = bean.getAccount(); User user = bean.getOwner(); CreditCard newCard = bean.getCreditCard(); GatewayResponse g = new GatewayResponse(); try { accountService.addProductToAccount(account, bean.getSelectedPlans(), user, newCard); g.setSuccess(true); } catch (Exception e) { logger.warn(ErrorUtil.getErrorDetail(e)); g.setSuccess(false); g.setResponseText(e.getMessage() + "\n" + g.getResponseText()); } logger.warn("Account updated: " + g.isSuccess()); return g; }
/** * Creates a new account and starts billing by calling AccountService.createNewAccount() * * @param bean * @return * @throws Exception */ public GatewayResponse createAndCharge(AccountBean bean) throws Exception { Account account = bean.getAccount(); User user = bean.getOwner(); // GatewayReponse is showing up here because the AccountService did not use to perform // all steps. the charge used to happen here. Need to clean this up. GatewayResponse g = new GatewayResponse(); try { accountService.createNewAccount(account, bean.getSelectedPlans(), user, bean.getCreditCard()); g.setSuccess(true); } catch (Exception e) { logger.warn(ErrorUtil.getErrorDetail(e)); g.setSuccess(false); g.setResponseText(e.getMessage() + "\n" + g.getResponseText()); } logger.warn("Account created: " + g.isSuccess()); return g; }