Package com.tensegrity.palo.gwt.core.client.models.cubeviews

Examples of com.tensegrity.palo.gwt.core.client.models.cubeviews.XDirectLinkData


    return data;   
  }
 
  public XDirectLinkData openViewAfterLogin(String locale, String sessionId, String link) {
    myInitDbConnection(getServletContext(), true);
    XDirectLinkData data = new XDirectLinkData();
    AuthUser user = null;
    try {
      user = getLoggedInUser(sessionId);
    } catch (SessionExpiredException e) {
    }
    if (user == null) {
      data.setAuthenticated(false);
      try {
        UserSession userSession = getUserSession(sessionId);     
        data.addError(userSession.translate("directLinkAuthenticationFailed"));
      } catch (SessionExpiredException e) {
        data.addError("You specified an invalid username/password combination. The user in the direct link could not be authenticated.");
      }
      return data;
    }
   
    List <Boolean> gFlags = createGlobalDisplayFlags(link);
    data.setAuthenticated(true);
    data.setGlobalDisplayFlags(gFlags);
   
    if (link.indexOf("[") != -1) {     
      return parseMultipleViews(sessionId, user, link, data);
    }
    return parseSingleView(sessionId, user, link, data);
View Full Code Here


    String encodedLink = link.length() > 0 ? link.substring(1) : link;
    try {
      link = URLDecoder.decode(link, "UTF-8");
    } catch (UnsupportedEncodingException e1) {
    }
    XDirectLinkData data = new XDirectLinkData();
    List <Boolean> list = new ArrayList<Boolean>();
   
    PaloSuiteData psd;
       
    try {
View Full Code Here

      link = URLDecoder.decode(link, "UTF-8");
    } catch (UnsupportedEncodingException e1) {
      logger.error(e1.getMessage());
    }
    log.debug("Decoded Link: " + link);
    XDirectLinkData data = new XDirectLinkData();
    List <Boolean> list = new ArrayList<Boolean>();
   
    try {
    myInitDbConnection(getServletContext(), false);
    PaloSuiteData psd;
       
    try {
      psd = initPaloSuiteData(log);
    } catch (IOException e) {
      e.printStackTrace();
      logger.error(e.getMessage());
      return null;
    }
    if (psd.secret == null) {
      data.addError("No shared secret information found. Can't continue.<br/>");
    }
    if (psd.host == null) {
      data.addError("No palo configuration database host specified. Can't continue.<br/>");
    }
    if (psd.port == null) {
      data.addError("No palo configuration database port specified. Can't continue.<br/>");
    }
    if (data.getErrors() != null && data.getErrors().length > 0) {
      psd.secret = null;
      psd = null;
      return data;
    }   
   
    StringTokenizer tok = new StringTokenizer(link, "&");
    Map <String, String> parameters = new HashMap<String, String>();
    parameters.put("hideviewtabs", "1");
    parameters.put("hidenavigator", "1");
    parameters.put("hidetitlebar", "1");
    parameters.put("hidesaveas", "1");
    parameters.put("hideconnectionpicker", "1");
    while (tok.hasMoreTokens()) {
      String parameter = tok.nextToken();
      if (parameter.startsWith("?")) {
        parameter = parameter.substring(1);
      }
      int equal = parameter.indexOf("=");
      if (equal == -1) {
        continue;
      }
      String key = parameter.substring(0, equal);
      String value = "";
      if ((equal + 1) < parameter.length()) {
        value = parameter.substring(equal + 1);
      }
      parameters.put(key.toLowerCase(), value);
    }
    list.add(checkFlag("hideviewtabs", parameters));
    list.add(checkFlag("hidenavigator", parameters));
    data.setGlobalDisplayFlags(list);
    String user = parameters.get("user");
    String passEnc64 = parameters.get("pass");
    String viewId = parameters.get("viewid");
   
    if (user == null) {
      data.addError(UserSession.trans(locale, "noDirectLinkUsernameSpecified"));
    }
    if (passEnc64 == null) {
      data.addError(UserSession.trans(locale, "noDirectLinkPasswordSpecified"));
    }
    if (viewId == null) {
      data.addError(UserSession.trans(locale, "noDirectLinkViewSpecified"));
    }
    if (data.getErrors() != null && data.getErrors().length > 0) {
      return data;
    }
   
    if (!checkChecksum(encodedLink, psd.secret, log)) {
      data.addError(UserSession.trans(locale, "checksumDoesNotMatch"));
      return data;
    }
   
   
    String decPass = null;
    try {
      decPass = decodePass(psd.secret, user, passEnc64, viewId, log);
    } catch (Exception e) {
      data.addError(UserSession.trans(locale, "directLinkAuthenticationFailed"));
    }
    if (decPass == null || (data.getErrors() != null && data.getErrors().length > 0)) {
      return data;
    }
   
    data = readConfigForUser(user, decPass, psd, viewId, data, log, locale);
    List <Boolean> displayFlags = new ArrayList<Boolean>();
    displayFlags.add(checkFlag("hidetitlebar", parameters));
    displayFlags.add(checkFlag("hidetoolbar", parameters));
    displayFlags.add(checkFlag("hidesave", parameters));
    displayFlags.add(true); //checkFlag("hidesaveas", link));
    displayFlags.add(checkFlag("hidefilter", parameters));
    displayFlags.add(checkFlag("hidestaticfilter", parameters));
    displayFlags.add(checkFlag("hidehorizontalaxis", parameters));
    displayFlags.add(checkFlag("hideverticalaxis", parameters));
    displayFlags.add(checkFlag("hideconnectionpicker", parameters));
    int counter = 0;
    for (Boolean b: displayFlags) {
      log.debug("Display flag " + counter++ + ": " + b);
    }
    if (data.getViews() != null && data.getViews().length == 1) {
      XView xView = data.getViews()[0];

      xView.setDisplayFlags(displayFlags);
    }
    data.setDisplayFlags(displayFlags);
//    log.debug("DecPass = " + decPass);   
    } catch (Throwable t) {
      log.error("Error parsing configuration: ", t);
    }   
    return data;
View Full Code Here

  }
 
  public XDirectLinkData openViewDirectly(String locale, String link) {   
    myInitDbConnection(getServletContext(), true);

    XDirectLinkData data = new XDirectLinkData();
   
    // Parse link information:
//    String connectionId = getValue("connection", link);
//    if (connectionId == null) return null;
       
    String user = getValue("user", link);
    if (user == null) {
      data.setAuthenticated(false);
      data.addError(UserSession.trans(locale, "noDirectLinkUsernameSpecified"));
      return data;
    }
   
    String pass = getValue("pass", link);
    if (pass == null) {
      data.setAuthenticated(false);
      data.addError(UserSession.trans(locale, "noDirectLinkPasswordSpecified"));
      return data;
    }
    //SpagoBI informations
    String spagoBIUser = getValue("spagobiusr", link);
    if (spagoBIUser != null) {     
      getSession().setAttribute("spagobiuser", spagoBIUser);
    }
    String spagoBIDoc = getValue("spagobidoc", link);
    if (spagoBIDoc != null) {     
      getSession().setAttribute("spagobidocument", spagoBIDoc);
    }
    String isDeveloper = getValue("isdeveloper", link);
    if (isDeveloper != null) {     
      getSession().setAttribute("isdeveloper", isDeveloper);
    }
   
    List <Boolean> gFlags = createGlobalDisplayFlags(link);
    data.setGlobalDisplayFlags(gFlags);
   
    int index = link.indexOf("pass=\"");
    int index2 = link.indexOf("\"", index + 6);
    String modifiedLink = link.substring(0, index) + link.substring(index2 + 1);
   
    AuthUser authUser = null;
    try {
      authUser = ServiceProvider.getAuthenticationService().authenticateHash(user, pass);
    } catch (AuthenticationFailedException e) {
      logger.error(e.getMessage());
    }
    if (authUser == null) {
      logger.error("direct link auth failed");
      data.setAuthenticated(false);
      data.addError("directLinkAuthenticationFailed");
      return data;
    }
       
    data.setAuthenticated(true);
    if (modifiedLink.indexOf("[") != -1) {
      // Multiple views...     
      return parseMultipleViews(locale, authUser, modifiedLink, data);
    }
View Full Code Here

TOP

Related Classes of com.tensegrity.palo.gwt.core.client.models.cubeviews.XDirectLinkData

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.