Package com.gadglet.data

Examples of com.gadglet.data.RegistrationToken


   
    if (domainUser == null)
    {
      // Registration

      RegistrationToken token = null;
      // in case of SIGNED
      if (userRegistrationMethod.equalsIgnoreCase(SharedConstants.registrationMethodSigned))
        jsonResponse.addCustomFieldError(SharedConstants.registrationProcessParamName,
            SharedConstants.registrationDoSigned);

      else
      {
     
        String tokenId = null;
        // work on token created in the current session

        if (platformRequestWrapper.getRegistrationTokenId() != null) {
          tokenId = platformRequestWrapper.getRegistrationTokenId();
          try {
            token = RegistrationTokenUtils.updateTokenForOauth(
                tokenId, user);
          } catch (Exception e) {
            printStackTrace(e);

          }
        }
        if (token == null) {
     
          try {
            token = RegistrationTokenUtils.createNew(user);

          } catch (Exception e) {
            printStackTrace(e);;
          }
        }

        //
        if (token != null) {
          jsonResponse.addCustomFieldError(
              SharedConstants.registrationTokenParamName,
              token.getTokenID());

          if (!token.isOpenSocialReady())
            jsonResponse.addCustomFieldError(
                SharedConstants.registrationProcessParamName,
                SharedConstants.registrationDoSigned);
        }
      }
View Full Code Here


    }
   
   
    if (domainUser == null) {
      // Registration
      RegistrationToken token = null;
      // 5 cases:
      //  - token is ready with both OAUTH + SIGNED - send registration url
      //  - token is ready for SIGNED and only SIGNED is needed - send
      // registration url
      // - token is already SIGNED created - send do to OAUTH
      // - token is OAUTH created and id in the session - update SIGNED and
      // send registration url
      // - token is null. send request failed

      String tokenId = null;
      if (platformRequestWrapper.getRegistrationTokenId() != null) {
        tokenId = platformRequestWrapper.getRegistrationTokenId();
        try {
          token = RegistrationTokenUtils.updateTokenForOpenSocial(
              tokenId,
              platformRequestWrapper.getOpenSocialViewerId(),
              platformRequestWrapper.getOpenSocialConsumerKey());
        } catch (Exception e) {
          printStackTrace(e);
        }
      }

      if (token == null) {
        try {
          token = RegistrationTokenUtils
              .createNew(platformRequestWrapper);
          platformRequestWrapper.getSession().setAttribute(SharedConstants.registrationTokenParamName,token.getTokenID());
        } catch (Exception e) {
          log.warning(e.getMessage());
        }
      }
      if(token ==null)
        log.warning("token is null we have a problem");
      else if (token.isTokenReady())
        jsonResponse.addCustomFieldError(
            SharedConstants.registrationTokenParamName,
            token.getTokenID());
      else if (token.isOpenSocialReady() && userRegistrationMethod.equalsIgnoreCase(SharedConstants.registrationMethodSigned))
        jsonResponse.addCustomFieldError(
            SharedConstants.registrationTokenParamName,
            token.getTokenID());
      else if (!token.isOauthReady()){
        jsonResponse.addCustomFieldError(
            SharedConstants.registrationTokenParamName,
            token.getTokenID());
        jsonResponse.addCustomFieldError(SharedConstants.registrationProcessParamName, SharedConstants.registrationDoOAuth);
      }
      else
        token =null;
     
View Full Code Here

TOP

Related Classes of com.gadglet.data.RegistrationToken

Copyright © 2018 www.massapicom. 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.