Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package pt.webdetails.cda.connections.mondrian;
 
 
 import  org.apache.commons.logging.Log;
 import  org.apache.commons.logging.LogFactory;
 import  org.dom4j.Element;
 import  org.pentaho.platform.api.engine.IConnectionUserRoleMapper;
 import  org.pentaho.platform.engine.core.system.PentahoSessionHolder;
import  org.pentaho.platform.engine.core.system.PentahoSystem;
import  org.pentaho.platform.plugin.services.connections.mondrian.MDXConnection;
Created by IntelliJ IDEA. User: pedro Date: Feb 2, 2010 Time: 5:09:59 PM
public abstract class AbstractMondrianConnection extends AbstractConnection implements MondrianConnection
  private static final Log logger = LogFactory.getLog(AbstractMondrianConnection.class);
  {
  }
  {
    super(id);
  }
  public AbstractMondrianConnection(final Element connectionthrows InvalidConnectionException
  {
    super(connection);
  }
  {
    return .;
  }
  {
    final ArrayList<PropertyDescriptorproperties = new ArrayList<PropertyDescriptor>();
    return properties;
  }
  protected String assembleRole(String catalog)
  {
	  try
	  {
		  if (PentahoSystem.getObjectFactory().objectDefined(MDXConnection.MDX_CONNECTION_MAPPER_KEY)) {
			  final IConnectionUserRoleMapper mondrianUserRoleMapper =
				  PentahoSystem.get(IConnectionUserRoleMapper.class, MDXConnection.MDX_CONNECTION_MAPPER_KEY, null);
			  final String[] validMondrianRolesForUser =
				  mondrianUserRoleMapper.mapConnectionRoles(PentahoSessionHolder.getSession(), "solution:" + catalog.replaceAll("solution/",""));
			  if ((validMondrianRolesForUser != null) && (validMondrianRolesForUser.length > 0))
			  {
				  final StringBuffer buff = new StringBuffer();
				  for (int i = 0; i < validMondrianRolesForUser.lengthi++)
				  {
					  final String aRole = validMondrianRolesForUser[i];
					  // According to http://mondrian.pentaho.org/documentation/configuration.php
					  // double-comma escapes a comma
					  if (i > 0)
					  {
						  buff.append(",");
					  }
					  buff.append(aRole.replaceAll(","",,"));
				  }
				  .debug("Assembled role: " + buff.toString() + " for catalog: " + catalog);
				  return buff.toString();
			  }
		  }
	  }
	  catch (Exception e)
	  {
		  .error("Error assembling role for mondrian connection"e);
	  }
	  return "";
  }
New to GrepCode? Check out our FAQ X