public DashboardSelection applyFacetSelection(AppContext ctx,Universe universe,List<Domain> domains,FacetSelection selection) throws ComputingException, ScopeException, InterruptedException {
  DashboardSelection ds=new DashboardSelection();
  if (selection != null) {
    addFacetSelection(ctx,universe,selection.getFacets(),ds,null);
    if (selection.hasCompareFacets()) {
      DashboardSelection compare=new DashboardSelection();
      addFacetSelection(ctx,universe,selection.getCompareTo(),compare,ds);
      for (      DomainSelection s : compare.get()) {
        for (        Axis filter : s.getFilters()) {
          for (          DimensionMember member : s.getMembers(filter)) {
            ds.addCompareTo(filter,member);
          }
        }
      }
    }
  }
  for (  Domain domain : domains) {
    DomainHierarchy hierarchy=universe.getDomainHierarchy(domain,true);
    for (    DimensionIndex index : hierarchy.getDimensionIndexes()) {
      DimensionOption option=DimensionOptionUtils.computeContextOption(index.getDimension(),ctx);
      if (option != null) {
        Collection<DimensionMember> sel=ds.getMembers(index.getAxis());
        if (option.isSingleSelection() && sel.size() > 1) {
          throw new ScopeException("Dimension '" + index.getDimensionName() + "' does not allow multi-selection");
        }
        if (option.isUnmodifiableSelection()) {
          if (option.getDefaultSelection() == null) {
            throw new ScopeException("Dimension '" + index.getDimensionName() + "' is unmodifiable but does not set a default value - report the isue to the application support");
          }
          if (!sel.isEmpty()) {
            ds.clear(index.getAxis());
            sel=ds.getMembers(index.getAxis());
          }
        }
        if (sel.isEmpty() && option.getDefaultSelection() != null) {
          List<DimensionMember> defaultMembers=DimensionOptionUtils.computeDefaultSelection(index,option,ctx);
          if (defaultMembers.isEmpty()) {
          }
 else {
            ds.add(index.getAxis(),defaultMembers);
            sel=ds.getMembers(index.getAxis());
          }
        }
        if (sel.isEmpty() && option.isMandatorySelection()) {
          DomainFacetCompute compute=new DomainFacetCompute(universe);
          List<DimensionMember> members=compute.populateDimensionFacets(index,ds,null,0,1);
          if (!members.isEmpty()) {
            ds.add(index.getAxis(),members.get(0));
            sel=ds.getMembers(index.getAxis());
          }
        }
      }
    }
  }
  return ds;
}

public DashboardSelection applyFacetSelection ( AppContext ctx , Universe universe , List < Domain > domains , FacetSelection selection ) throws ComputingException , ScopeException , InterruptedException { DashboardSelection ds = new DashboardSelection ( ) ; if ( selection != null ) { addFacetSelection ( ctx , universe , selection . getFacets ( ) , ds , null ) ; if ( selection . hasCompareFacets ( ) ) { DashboardSelection compare = new DashboardSelection ( ) ; addFacetSelection ( ctx , universe , selection . getCompareTo ( ) , compare , ds ) ; for ( DomainSelection s : compare . get ( ) ) { for ( Axis filter : s . getFilters ( ) ) { for ( DimensionMember member : s . getMembers ( filter ) ) { ds . addCompareTo ( filter , member ) ; } } } } } for ( Domain domain : domains ) { DomainHierarchy hierarchy = universe . getDomainHierarchy ( domain , true ) ; for ( DimensionIndex index : hierarchy . getDimensionIndexes ( ) ) { DimensionOption option = DimensionOptionUtils . computeContextOption ( index . getDimension ( ) , ctx ) ; if ( option != null ) { Collection < DimensionMember > sel = ds . getMembers ( index . getAxis ( ) ) ; if ( option . isSingleSelection ( ) && sel . size ( ) > 1 ) { throw new ScopeException ( "Dimension '" + index . getDimensionName ( ) + "' does not allow multi-selection" ) ; } if ( option . isUnmodifiableSelection ( ) ) { if ( option . getDefaultSelection ( ) == null ) { throw new ScopeException ( "Dimension '" + index . getDimensionName ( ) + "' is unmodifiable but does not set a default value - report the isue to the application support" ) ; } if ( ! sel . isEmpty ( ) ) { ds . clear ( index . getAxis ( ) ) ; sel = ds . getMembers ( index . getAxis ( ) ) ; } } if ( sel . isEmpty ( ) && option . getDefaultSelection ( ) != null ) { List < DimensionMember > defaultMembers = DimensionOptionUtils . computeDefaultSelection ( index , option , ctx ) ; if ( defaultMembers . isEmpty ( ) ) { } else { ds . add ( index . getAxis ( ) , defaultMembers ) ; sel = ds . getMembers ( index . getAxis ( ) ) ; } } if ( sel . isEmpty ( ) && option . isMandatorySelection ( ) ) { DomainFacetCompute compute = new DomainFacetCompute ( universe ) ; List < DimensionMember > members = compute . populateDimensionFacets ( index , ds , null , 0 , 1 ) ; if ( ! members . isEmpty ( ) ) { ds . add ( index . getAxis ( ) , members . get ( 0 ) ) ; sel = ds . getMembers ( index . getAxis ( ) ) ; } } } } } return ds ; }
apply a facet selection to a dashboard .
