@Override
 protected Void doExecute(PartakeConnection con, IPartakeDAOs daos)
     throws DAOException, PartakeException {
   IEventSearchService searchService = PartakeApp.getEventSearchService();
   EventDAOFacade.recreateEventIndex(con, daos, searchService);
   return null;
 }
예제 #2
0
  @Override
  protected Result doExecute() throws DAOException, PartakeException {
    UserEx user = ensureLogin();
    ensureValidSessionToken();
    String eventId = getValidEventIdParameter();
    Map<String, String[]> params = getFormParameters();

    ModifyTransaction transaction = new ModifyTransaction(user, eventId, params);
    transaction.execute();

    Event event = transaction.getEvent();
    List<EventTicket> tickets = transaction.getEventTickets();

    // If the event is already published, We update event search index.
    IEventSearchService searchService = PartakeApp.getEventSearchService();
    if (!event.isSearchable()) searchService.remove(eventId);
    else if (searchService.hasIndexed(eventId)) searchService.update(event, tickets);
    else searchService.create(event, tickets);

    JSONObject obj = transaction.getJSONObject();
    obj.put("eventId", eventId);
    return renderOK(obj);
  }
  public String doExecute() throws DAOException, PartakeException {
    String verifier = getParameter("oauth_verifier");
    if (StringUtils.isBlank(verifier)) return renderInvalid(UserErrorCode.INVALID_OAUTH_VERIFIER);

    TwitterLoginInformation loginInformation = getPartakeSession().takeTwitterLoginInformation();
    if (loginInformation == null) return renderInvalid(UserErrorCode.UNEXPECTED_REQUEST);

    MessageCode messageCode = null;
    try {
      ITwitterService twitterService = PartakeApp.getTwitterService();
      UserTwitterLink linkage =
          twitterService.createTwitterLinkageFromLoginInformation(loginInformation, verifier);

      UserEx user = new VerifyForTwitterActionTransaction(linkage).execute();
      session.put(Constants.ATTR_USER, user);

      messageCode = MessageCode.MESSAGE_AUTH_LOGIN;
    } catch (TwitterException e) {
      return renderError(ServerErrorCode.TWITTER_OAUTH_ERROR);
    }

    String redirectURL = loginInformation.getRedirectURL();
    if (StringUtils.isEmpty(redirectURL)) return renderRedirect("/", messageCode);

    // If the redirect page is the error page, we do not want to show it. Showing the top page is
    // better.
    String errorPagePaths[] =
        new String[] {
          "/error", "/notfound", "/invalid", "/prohibited", "/forbidden", "/loginRequired"
        };
    for (String errorPagePath : errorPagePaths) {
      String errorPageURL = PartakeProperties.get().getTopPath() + errorPagePath;
      if (redirectURL.startsWith(errorPageURL)) return renderRedirect("/", messageCode);
    }

    return renderRedirect(redirectURL, messageCode);
  }
예제 #4
0
 @Before
 public void setup() throws Exception {
   super.setup(PartakeApp.getDBService().getDAOs().getEnrollmentAccess());
 }
 @Before
 public void setup() throws Exception {
   super.setup(PartakeApp.getDBService().getDAOs().getUserNotificationAccess());
 }